Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Considering below grammar, the generated parser code tolerates illegal expression like "NotExpression1 ANND NotExpression2", the parser just ignores the part "ANND NotExpression2". The solution is to explicitly declare EOF at the end of constraint definition. i.e. constraint: orexpression EOF;

constraint: orexpression;

orexpression: andexpression ("or"^ andexpression)*;

andexpression:  notexpression ("and"^ notexpression)*;

notexpression:  ("not"^)? equalityExpression;

equalityExpression: relationalExpression ((NOTEQ^ | EQUAL^)  relationalExpression)*;

  • No labels