[antlr-interest] Sometimes significant new lines

Nicholas Clare nickclare at gmail.com
Thu May 7 16:54:45 PDT 2009


Hi Everyone,

I'm writing a simple parser for configuration files. Most of it is
working beautifully, but there's one thing I can't figure out. The
basic idea is that there are configuration items, the syntax of which
are:

configItem: ID '=' VALUE terminator

(It's obviously a touch more complicated than that, but I don't want
to bore you with details). The terminator rule is what I'm having
trouble with. What I want is to allow either semicolons or new lines.
The semicolons are easy. Since most of the time I don't want to worry
about extra new lines, I'm currently sending them to the HIDDEN
channel. Is there a way to detect them here (preferably without java
actions, but that would be acceptable if there's no other option)?

Thanks very much,
Nick


More information about the antlr-interest mailing list