[antlr-interest] two (simple?) questions
Jerry Ro
jerrro at gmail.com
Mon Sep 3 18:50:27 PDT 2007
Hi,
I was wondering if anyone can help with two simple (newbie) questions:
The first is:
I define in the Lexer rules the following rule for defining alphanumeric
strings:
ALPHANUMERIC : (DIGIT | LOWER | UPPER | '_')+ ;
where digit is a fragement of 0..9 and lower and upper are fragments of a to
z and A to Z. However, strings which are just numbers are not accepted as
"alphanumeric". I have to add a lower case letter for the parser to accept
the string according to the alphanumeric rule, but I would expect a just
numbers string to match the alphanumeric lex rule.
Second thing is:
How do I make the parser parse even if there are no spaces between the
tokens? Right now I have to separate all tokens with spaces in order for the
parser to parse anything... I do have a rule of the following form:
WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel = HIDDEN;
} ;
in the lexer rules.
Thanks
Jerr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070903/aa64477e/attachment.html
More information about the antlr-interest
mailing list