[antlr-interest] Lexer confusion
FranklinChen at cmu.edu
FranklinChen at cmu.edu
Wed May 26 20:23:05 PDT 2004
The following lexer generates Java code (ANTLR 2.7.4) that does not do
what I expect. What am I doing wrong? What can I do?
I expect to lex "A-0" as
WORD HYPHEN NUMBER
but instead I get an error, because the generated code goes into WORD,
sees HYPHEN, and then wants an 'A' and bombs out because there isn't
any.
===
class SampleLexer extends Lexer;
options {
charVocabulary = '\3'..'\377';
}
WORD
:
'A'
(
HYPHEN
'A'
)*
;
HYPHEN
:
'-'
;
NUMBER
:
'0'
;
--
Franklin
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list