Hello,
I have too small a brain to really understand grammars and ANTLR. But I love ANTLR because it saved my life a few times already. The enclosed grammar parses classical expressions (assignments, conditions and function calls) with one specific expression that I added with 'codeList' rule. This rule parses a shortcut to enumerate 'or' conditions :
which means
x=1 or x=2 or x=3 or x = 18
Everything went fine until I I added the 'functionCall' rule, I got the warning :
Decision can match input such as "COMMA INT" using multiple alternatives
In rule codeList, I have tried to use a syntactic predicate :
codeList : codeListElement (((COMMA)=>COMMA|PLUS) codeListElement)*
But I still got the warning.
Then I tried a rule option :
codeList
options {greedy = true; }
: codeListElement ((COMMA|PLUS) codeListElement)*
;
And it still displays the warning.
It is not an issue yet because it works anyway, but I would like to understand what went wrong with the syntactic predicate.
Thans a lot for your help,
Ghislain
PS : the purpose is to produce AST but I have not defined rewrite rules yet
PPS : The warning disappears if I add the grammar option 'backtrack=true' but then ANTLRworks interpreter doesn't work anymore