[antlr-interest] how do i generate an error if input is not fully consumed
fedot
fedot at stockworm.com
Wed Mar 19 12:03:19 PST 2003
I have the following java code (approximately) to go with some
simple calculator grammar:
MyLexer lexer = new MyLexer(new StringReader(string));
MyParser parser = new MyParser(lexer);
parser.start(); // start variable
System.out.println(parser.getAST().toStringList());
If input string is such that only beginning of it matches lexer and
parser rules, an AST is properly constructed for the beginning of
the string and the remainder is silently ignored.
I need to detect such a state (syntactically invalid input remaining
unconsumed) and "raise an error flag". What are my options?
Thank you in advance!
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list