[antlr-interest] Ignoring syntax errors
David Piepgrass
qwertie256 at gmail.com
Wed Nov 22 17:51:01 PST 2006
I would like to ignore syntax errors in my grammar (because if the syntax is
wrong, I presume that some other parser in an expandable system might
understand it), yet if the syntax is correct, I want to flag semantic errors
that are detected within semantic actions. Therefore I have a start rule
like this:
real_starting_rule returns[AST u=null]:
( (starting_rule)=> u=starting_rule
| (.)*
);
In order to avoid an exception thrown by the lexer, I also have this scanner
rule (as the last rule):
INVALID_CHARACTER: '\u0001'..'\uFFFE';
This works, but it causes a boatload of nondeterminism exceptions. I know I
could use the filter option, but that's no good, because the parser would
not see the invalid characters.
How can I get the behavior I want without the warnings?
// Note: generateAmbigWarnings=false doesn't help
INVALID_CHARACTER options { generateAmbigWarnings = false; }:
'\u0001'..'\uFFFE';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061122/f216a490/attachment.html
More information about the antlr-interest
mailing list