[antlr-interest] Preprocessor

Omry Yadan omry at yadan.net
Sun Feb 4 07:43:10 PST 2007


Hi all,

I want to write a Java preprocessor, and I bumped into this in the FAQ: 
http://www.jguru.com/faq/view.jsp?EID=893706

as I understand it, the problem is that its hard to detect the beginning 
of the line with grammar because there is nothing to match against.

The suggestion approach (java loop breaking the lines and sending them 
for preprocessing) would work, but its not as nice as having ANLR spit 
lines for me


I was thinking of the following little hack, that might work:

to append a special symbol that indicate the beginning of the next line 
when an EOL is encountered. and also before the first line using a 
syntactic start point.

my question is really

1. how do I consume the EOL and insert the LINE_START symbol in its place?

2. am I in the right direction?


Thanks,

    Omry.





More information about the antlr-interest mailing list