[antlr-interest] Lexer token type problem
Matthew Ford
Matthew.Ford at forward.com.au
Fri Nov 22 16:23:19 PST 2002
Hi all,
I have a lexer with the following rules (and others)
CRNL_PARAGRAPH
: ('\r' '\n' 'T')=>PARAGRAPH
| ('\r' '\n' ~('T')) => CRNL ;
protected
CRNL
: '\r' '\n'
;
protected
PARAGRAPH
: "\r\nT"
;
I expected to get token types PARAGRAPH and CRNL returned but only got CRNL_PARAGRAPH even though the rules PARAGRAPH and CRNL were called.
changing CRNL_PARAGRAPH to
CRNL_PARAGRAPH
: ('\r' '\n' 'T')=>PARAGRAPH {$setType(PARAGRAPH);}
| ('\r' '\n' ~('T')) => CRNL {$setType(CRNL);}
;
fixed the problem but I am still not clear why the original version is not valid.
Any comments?
matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20021123/c8d901ec/attachment.html
More information about the antlr-interest
mailing list