[antlr-interest] Filter option
nilesh.kapile at tcs.com
nilesh.kapile at tcs.com
Mon May 12 05:58:32 PDT 2008
Hi,
I'm using Filter option to generate only Lexer. The problem is, I'm not
able to get line number for the token.
How can I get the line number? Sample .g below:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
lexer grammar FuzzyQPP;
options {filter=true;}
BLOCK :
BEG WS? ID WS? END
{
int line = 0;
line = $BEG.line; /* $BEG.text works but
$BEG.line doesn't */
System.out.println(line);
}
;
SL_COMMENT
: '//' .* '\n'
;
WS : (' ' |'\t' |'\r' |'\n' )+
;
BEG :'{'
;
END :'}'
;
fragment
ID : ('a'..'z' |'A'..'Z' |'_' ) ('a'..'z' |'A'..'Z' |'_' |'0'..'9' )*
;
Any help will be highly appreciated!
Thanks,
Nilesh Sudhakar Kapile
Tata Consultancy Services
Mailto: nilesh.kapile at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080512/8db85200/attachment.html
More information about the antlr-interest
mailing list