Here's a simple gunit test for a portion of my grammar which generates a flat
list of nodes:
objectOption walks objectOption:
<<one:"value">> -> (one "value")
In the above, I purposefully left out the caret (i.e. ^(one "value)) since
it's a flat list of nodes and not a tree. Another option which seems intuitive
is to leave off the parenthesis, like this:
objectOption walks objectOption:
<<one:"value">> -> one "value"
In the first case the parenthesis cause an error
1 failures found:
test2 (objectOption walks objectOption, line17) -
expected: (one \"value\")
actual: one \"value\"
And in the second case I get an exception:
line 17:20 no viable alternative at input 'one'
line 17:24 missing ':' at 'value'
line 0:-1 no viable alternative at input '<EOF>'
java.lang.NullPointerException
at org.antlr.gunit.OutputTest.getExpected(OutputTest.java:65)
at org.antlr.gunit.gUnitExecutor.executeTests(gUnitExecutor.java:245)
...
What is the correct way to match a flat tree?
Thanks.
--
Kaleb Pederson
Blog - http://kalebpederson.com
Twitter - http://twitter.com/kalebpederson
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.