[antlr-interest] check validity of single rule

Philippe Faes philippe.faes at gmail.com
Sun Dec 30 10:16:57 PST 2007


Hi all,

I want to write tests for my grammar, but I can't figure out how to get the
correct feedback from ANTLR.

e.g. I want this to pass:
createParserFromString("a:=b;").assignment();

but this should fail:
createParserFromString("a:=b").assignment(); // no semicolon
createParserFromString("a:=b; #$%").assignment(); // junk after statement

>From the return value I can see if an 'assignment' is matched from the text,
but I cannot detect if there is junk after the valid assignment.

Any hints?

kind regards
Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071230/9a5547d7/attachment.html 


More information about the antlr-interest mailing list