I have cascading rules that define operator precedence in an expression
(taken from the C# parser example), like so:
*           thisLevelExpression :*
*               nextHigherPrecedenceExpression (OPERATOR
nextHigherPrecedenceExpression)* ;*

I managed to isolate where method invocation takes place, and now I'd like
to insert some tokens to wrap around specific invocations, so that:

*a.b().c()*

would be translated to:

*[invoke: [invoke: a.b() ].c() ]*

or something like that.

It seems to me like I should follow the precedence pattern to insert a new
rule, unfortunately the invocation part is at the end of the precedence
chain, so I can't figure out how.
Here are the rules I've isolated:

*primaryExpression*
* **:** **basicPrimaryExpression*
* **(** **options { greedy = true; } : *
* **(** **LPAREN argumentList? RPAREN** **// invocationExpression <---- THIS
IS THE ONE!!*
* **|** **LBRACK expressionList RBRACK** **// elementAccess*
* **|** **DOT identifier** **// memberAccess*
* **|** **INC ** **// postIncrementExpression*
* **|** **DEC** **// postDecrementExpression*
* **)*
* **)**
* **;*
*
*
*basicPrimaryExpression*
* **:** **literal*
* **|** **identifier** **// simpleName*
* **|** **LPAREN assignmentExpression RPAREN** **// parenthesizedExpression*
* **|** **THIS** **// thisAccess*
* **|** **newExpression*
* **;*


Sorry for the cry for help, my brain is in total meltdown at the moment...

        Ben

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

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

Reply via email to