[antlr-interest] help requested for selective whitespace

Scott Amort jsamort at sympatico.ca
Wed Feb 1 17:46:25 PST 2006


Me again :-)

I've found a post from the archive of this mailing list that partially
addresses almost exactly the problem I am facing:

http://groups.yahoo.com/group/antlr-interest/message/13929

In this posters case, he needed to be sure that WS was not included
around certain statements, while I need to be sure that WS is included
between certain constructs.

Now, there were a few reponses to his post - but the one that seemed
most appealing to me was:

> I would recommend an alternative approach, which would be to not skip
> whitespace in the lexer.  Instead, discard it in the parser filter.
> That filter can still check that no whitespace occurs before or after
> an @ between IDENTS.

I did some reading and have implemented a filter that discards
whitespace, but I'm still unclear about how to test for this discarded
whitespace within the filter (or within the parser).

Is this the best way to approach this?  And, if anyone could provide me
with a few tips on how to approach the test for discarded whitespace, I
would most certainly appreciate it.

Thanks for any and all help!

Best, Scott




More information about the antlr-interest mailing list