[antlr-interest] Why BANG after rule id ?

Kaleb Pederson kaleb.pederson at gmail.com
Tue Oct 6 15:46:35 PDT 2009


On Tue, Oct 6, 2009 at 2:57 PM, Kirby Bohling <kirby.bohling at gmail.com> wrote:
> Kaleb,
>
> Neither of your example sites talk about what he is discussing.  It
> isn't applied to a node, it is applied to a rule
> definition/declaration, not to a rule invoked as part of the
> production of a rule.

Yeah, thanks for gently pointing that out :).  I noticed and sent out
my correction at almost the exact same time you did.

> I'm guessing that this is mostly likely what you are looking for,
> assuming that I'm correct and the grammar you are looking at is really
> an ANTLRv2 grammar:
> http://www.antlr2.org/doc/lexer.html#Manipulating_Token_Text_and_Objects

The fragment he quoted is actually from the ANTLR v3 grammar for
ANTLR.  It's available int the 3.2 source under
tool/src/main/antlr3/org/antlr/grammar/v3/ANTLRv3.g.  The version 2
grammar is available under
tool/src/main/antlr2/org/antlr/grammar/v2/antlr.g.

The rule that I quoted in my response is also from the v3 grammar.

If I were to guess, I'd say that the feature you reference in v2 is
probably making a comeback in version 3, but that's guess. I gave it a
cursory test in ANTLRWorks 1.3.0 and didn't see a visible difference
in the AST/Parse Tree.

--Kaleb

http://twitter.com/kalebpederson
http://kalebpederson.com


More information about the antlr-interest mailing list