[antlr-interest] newline?
ronald.petty at milliman.com
ronald.petty at milliman.com
Thu Apr 8 12:14:22 PDT 2004
I was reading the Antlr tutorial by Ashley J.S Mills and was wondering
about the newline function. She (or maybe he), says
"newline() method which tells Antlr to bump up it's line count and goto
the next line. Without this the lexer would be stuck on one line!" page 9
if printed
This has to do with her example of
WS :
( ' '
| '\t'
| '\r' '\n' { newline(); }
| '\n' { newline(); }
)
{ $setType(Token.SKIP); }
;
I am also checking for which space and newlines, however I do not have the
newline function being used (also don't have the setType call). When I do
java Main
test
MATCHED TEST
test
MATCHED TEST
test
MATCHED TEST
that appears to me that antlr is handling newline just fine without the
function call. Any idea if I am wrong or am I missing something from the
tutorial?
Thanks
Ron
**************************************************************************************
This communication is intended solely for the addressee and is
confidential. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. Unless indicated
to the contrary: it does not constitute professional advice or
opinions upon which reliance may be made by the addressee or any
other party, and it should be considered to be a work in progress.
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040408/2845359f/attachment.html
More information about the antlr-interest
mailing list