[antlr-interest] Need help: How to Remove comments before Parsing?

Premkumar Rathanavelu rprememail at yahoo.com
Thu Mar 17 14:48:36 PST 2005


Hi to all ANTLR -ers,
   New to ANTLR, I'm writing a Preprocessor Grammar file and strucking with the comments... i have got an idea to remove all the comments before doing parsing/lexing .. so please give me some tipps to embed java codes through actions({..}) in the grammar file itself .. so that the rules should act on the input file only after removing all the comments.. 
 
The rules like 

Comment 

: "/*" 

( {LA(2) != '/'}? '*'

| EndOfLine {newline();}

| ~('*'|'\r' | '\n'|' ')

| Whitespace

)* 

"*/" {$setType(Token.SKIP);}

;

CPPComment

: "//" (~('\n' | '\r'))* EndOfLine

{$setType(Token.SKIP); newline();} 

;

are not suitable for me .. 

Please help me to solve the problem ..I will be grateful to you..

Thanks,

PREM


		
---------------------------------
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050317/88d14a8a/attachment.html


More information about the antlr-interest mailing list