Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top