John Källén
John Källén

Reputation: 7973

What do the ':!' and '|!' tokens mean in an (Python) Antlr grammar

I have inherited an old Antlr grammar which is used in a Python program. One of the productions looks like this:

merge 
    :! l:expr
        ( n:name_list r:expr 
           { /* do something  with n and r*/ }
          |
           { /* do something else */ }
        )
    |!
        n2:name_list '*' o:expr
           { /* do something with n2 and o */ }
    ;

Now, I'm familiar with the : and | tokens from Yacc and Antlr, but what significance does that extra ! have, if any?

Upvotes: 1

Views: 79

Answers (1)

Terence Parr
Terence Parr

Reputation: 5962

:! and |! mean to not build AST for the surrounding rules.

Upvotes: 1

Related Questions