no incomplete parses

23 views
Skip to first unread message

armin...@googlemail.com

unread,
Apr 7, 2014, 8:34:21 AM4/7/14
to antlr-di...@googlegroups.com

In ANTLR 4, the parsers exits successfully even if the input does match the grammer only partially. Can this behavior be changed? I would like the parser to either recognize a complete parse or fail. There may be some of the input left, but the input parsed so far must match the complete grammar.

Mike Lischke

unread,
Apr 7, 2014, 8:47:19 AM4/7/14
to antlr-di...@googlegroups.com

That's probably a FAQ already. End your main rule with EOF, so it only matches if the the given text exactly can be matched by that rule.


In ANTLR 4, the parsers exits successfully even if the input does match the grammer only partially. Can this behavior be changed? I would like the parser to either recognize a complete parse or fail. There may be some of the input left, but the input parsed so far must match the complete grammar.

Message has been deleted

armin...@googlemail.com

unread,
Apr 7, 2014, 9:30:52 AM4/7/14
to antlr-di...@googlegroups.com, mike.l...@googlemail.com
Hi Mike,

that's not what I meant. Using EOF, input and parse must end at the same time. Without EOF, the parse may be incomplete and there may be some input left. I'd like to have a complete parse and probably some left over input.

Regards,

Armin
Reply all
Reply to author
Forward
0 new messages