[antlr-interest] Actions in predicates

Marcin Rzeźnicki marcin.rzeznicki at gmail.com
Mon Feb 22 10:09:22 PST 2010

On Mon, Feb 22, 2010 at 6:21 PM, Jim Idle <jimi at temporal-wave.com> wrote:

> It's not completely flawed. To do what you asked, you do not need to
> influence the lexer, just look ahead in the off-channel at certain points
> and change the channel of the SEMI back to the default if you wanted it to
> appear; but as I said, that is an awkward way to do it I think.
> Jim

My ideas was more or less that whenever I have ambigous syntax (with no
semicolons whatsoever in the parser)  I resolve problems using syntactic
predicates  taking "optional" parts of syntax (like semicolons) into
consideration. If syntactic predicate hit the optional part then it would
fail - meaning that separator divided potentially ambigous construct and it
is time to try the next alternative. It seemed clean to me, but you've made
me think about it again. I could use your suggestion to make semicolon
tokens reappear but how do I do this? CommonTokenStream does not seem to
provide any public method of inspecting non-default channels

Marcin Rzeźnicki

More information about the antlr-interest mailing list