[antlr-interest] Problems with semantic predicates
    Jim Idle 
    jimi at temporal-wave.com
       
    Fri Apr 18 07:35:36 PDT 2008
    
    
  
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Thomas Brandon
> But if as your example suggests you just want to alter the AST
> construction not the actual parsing then I think you want predicated
> rewrite rules not semantic predicates (as I believe Jim was suggesting
> though I think he gave the wrong syntax). Like:
> r2[boolean flag]
>  : Token1
>    -> {$flag}? ^(NODE Token1)
>    -> Token1
>  ;
Yep - I just copied Gavin's suggestion and forgot to correct the position of the -> even though that was what I was actually replying to the post for. Doh!
Jim
 
No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.1/1384 - Release Date: 4/17/2008 3:47 PM
 
    
    
More information about the antlr-interest
mailing list