I have two rules for assignments to handle an optional LET keyword:
...
| KW_let // Rule A
lhs = var
op = operator
rhs = expression
-> ^(KW_let $lhs $op $rhs)
| lhs = var // Rule B
op = operator
rhs = expression
-> ^(KW_let $lhs $op $rhs)
...
Here's two related gunit test cases:
"let $var = 15" -> (let $var = 15)
"$var = 15" -> (let $var = 15)
But when I run it, it fails on the second case:
test10 (assignmentStatement, line22) -
expected: (let $var = 15)
actual: (KW_let $var = 15)
Is there a way to set the text of the root node of the tree constructed with
"Rule B" that would allow this test case to pass?
I tried something similar to what's shown on pg. 183 of TDAR but I couldn't
figure out how to add the child nodes for $lhs, $op and $rhs.
Thanks!
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/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
-~----------~----~----~----~------~----~------~--~---