[antlr-interest] Rewrite Problem; Rule terminates without exception.
Michael Ernst
chiptv at web.de
Fri Mar 14 12:47:07 PDT 2008
Hi,
I want to rewrite =, +=, -= *= and /= into a better parseable tree. The following rule terminates without any Exception, but I dont know why. Any ideas?
expression
:
//orExpression (assignmentOperator^ expression)? // works fine, but thats not the desired result.
a=orExpression
(
(ASSIGNMENT expression) -> ^(ASSIGNMENT $a expression)
| (ADDITION_ASSIGNMENT expression) -> ^(ASSIGNMENT $a ^(PLUS $a expression))
| (MINUS_ASSIGNMENT expression) -> ^(ASSIGNMENT $a ^(MINUS $a expression))
| (MULTIPLY_ASSIGNMENT expression) -> ^(ASSIGNMENT $a ^(MULTIPLY $a expression))
| (DIVIDE_ASSIGNMENT expression) -> ^(ASSIGNMENT $a ^(DIVIDE $a expression))
|
) // terminates without exception
;
assignmentOperator
: ASSIGNMENT // =
| ADDITION_ASSIGNMENT // +=
| MINUS_ASSIGNMENT // -=
| MULTIPLY_ASSIGNMENT // *=
| DIVIDE_ASSIGNMENT // /=
;
Thanks in advance!
Regards
Michael
______________________________________________________
Bis 50 MB Dateianhänge? Kein Problem!
http://freemail.web.de/club/landingpage.htm/?mc=025556
More information about the antlr-interest
mailing list