Hello everyone,
I started working with ANTLR a few days ago and ran into a problem with 
certain rewriting rules. Basically, there is the following rule:
    exprOr : exprXor (opGroupOr exprXor)*;

I want an AST node to be created everytime the parentheses* *matches. My 
first solution was to apply the following rewrite rule:
    exprOr : l=exprXor (o=opGroupOr r=exprXor -> ^(Expression $l $o $r))*;

However, this always results in a RewriteEmptyStreamException. Which is 
kind of strange since the following rules work perfectly:
    exprOrRight : opGroupOr exprXor -> ^(Expression opGroupOr exprXor);
    exprOr : l=exprXor (exprOrRight)*;

However there's no way to access $l in exprOrRight as it's in a 
different rule(at least i'm not aware of any way to do that). Is there 
any simpler way to solve the problem? What am I doing wrong?

Cheers,
Ralf Hund


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to