antlr3 - Xtext grammar QualifiedName ambiguity -


i have following problem. part of grammar looks this

rexpr     : setop     ;  setop returns rexpr     : primaryexpr (({union.left=current} '+'|{difference.left=current} '-'|{intersection.left=current} '&') right = primaryexpr)*     ;  primaryexpr returns rexpr     : '(' rexpr ')'     | (this = 'this.')? slot = [slot | qualifiedname]       | (this = 'this' | ensname = [ensemble | qualifiedname])     | 'all'     ; 

when generating xtext artifacts antlr says due ambiguity disables option(3). ambiguity because of qualifiedname slot , ensemble share. how refactor kind of cases? guess syntactic predicate wont here since it'll force one(slot/ensemble) resolved only.

thanks.

xtext can't choose between 2 references slot , ensemble. can merge these references 1 reference adding rule grammar:

slotorensemble:     slot | ensemble ; 

then primaryexpr rule like:

primaryexpr returns rexpr     : '(' rexpr ')'     | ((this = 'this.')? ref= [slotorensemble | qualifiedname])     | = 'this'     | 'all'     ; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -