[antlr-interest] Code generation error in syntactic predicate?
Mark Venbrux
mark.venbrux at gmail.com
Sun May 20 15:41:34 PDT 2007
Hi,
One more time parsing comments and other text...
Syntactic predicate:
(~COMMENT_START)=>
leads to generated code:
.... if ( (input.LA(1)>='\u0000' && input.LA(1)<='\u0005')||(
input.LA(1)>='\u0007' && input.LA(1)<='\uFFFE') ) {
......
Checking only for the first character. A syntactic predicate without the '~'
will check for multiple characters by using
mCOMMENT_START();
This asymmetry indicates a code generation error to me.
Grammar:
grammar MiCoGen;
sequence: (
COMMENT
| TEXT
)*
EOF;
COMMENT : COMMENT_START (options {greedy=false;} : .)* COMMENT_END;
TEXT : ((~COMMENT_START)=> .)+ ;
fragment COMMENT_START : '/*';
fragment COMMENT_END : '*/';
--
Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070521/f1cb37c0/attachment.html
More information about the antlr-interest
mailing list