jeudi 30 octobre 2014

Antlr4 grammar ambiguity for two same prefixed rules


Vote count:

0




So I have the following grammar rules for an SQL expression editor (simplified):



FUNCTIONID: 'sum' | 'avg';
functionExpr: FUNCTIONID '(' expr ')'

AGGFUNCTIONID: 'sum' | 'avg'
aggFunctionExpr: AGGFUNCTIONID '(' expr ')' 'over' ...


The code works for expressions such as "sum(1) over ..." but not when there's no over.


How could I make this grammar work for both cases and still have these two rules?



asked 47 secs ago







Antlr4 grammar ambiguity for two same prefixed rules

Aucun commentaire:

Enregistrer un commentaire