[antlr-interest] accessing the current node

mzukowski at bco.com mzukowski at bco.com
Tue Feb 19 13:34:51 PST 2002


I think you can only make Tokens into root nodes, not rules like you are
trying to do with "binaryPointcutOp^".

Also I find it weird that you have LOR and LAND at the same precedence.  Try


pointcut:  
: pointcuts ((LAND^ {##.setType(AND_POINTCUT);}| LOR^
##.setType(LOR_POINTCUT);) pointcuts)*
     ;

Also, I'm guessing 'cause you didn't say what was going wrong with the rules
below.  Any error messages or wrong tree structures?

Monty

> -----Original Message-----
> From: Greg Smolyn [mailto:smolyn at cs.ubc.ca]
> Sent: Tuesday, February 19, 2002 1:26 PM
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] accessing the current node
> 
> 
> 
> Thanks for the help, Monty. 
> 
> I just have one other dumb question that is causing me 
> difficulty at the 
> moment, can anyone help?
> 
> Say I have some structure like this:
> 
>   pointcut1 && pointcut2 && pointcut3
> (yadda yadda)
> 
> Currently my grammar is something like (yes, what I'm showing here is 
> broken... it's somewhere between what I had and what I want!):
> 
> pointcut
>     : pointcuts (binaryPointcut)*
>     ;
> 
> pointcuts
>    : "execution" LPAREN! functionSig RPAREN! body
>    { ## = #(NPointcut, ##); }
>    ;
> 
> binaryPointcut
>   : binaryPointcutOp^ pointcuts
>    { ## = #(NPointcut, ##); }
>   ;
> 
> binaryPointcutOp
>    : LAND
>    | LOR
>    ;
> 
> for reasons of simplicity in my aspect weaver, I want to turn 
> the "&&" into a 
> type of pointcut itself-- basically I want to create
> 
> andPointcut(andPointcut(pointcut1, pointcut2), pointcut3)  (I 
> *think* that's 
> the right order of operations?)./
> 
> I'm really stuck in a LALR world right now in my head, and I 
> can easily come 
> up with a yacc solution. :)  Does anyone know the ANTLR way 
> to do this?  
> 
> 
> thanks!
> 
> -- 
> Greg Smolyn (smolyn at cs.ubc.ca)
> Software Practices Lab, UBC
> http://www.cs.ubc.ca/labs/spl/
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list