[antlr-interest] Are GUnit tests for Tree Pattern matching grammars (filter=true) supported?
Stanislas Rusinsky
rusinskystanislas at yahoo.fr
Mon Oct 15 02:52:56 PDT 2012
Hi Antlr's,
I have a tree pattern matching grammar (filter=true) I want to gunit test it
I can't get Gunit to work with it or find an example online: are they known to work together?
The test fails with a
expected: (attr3 int (MODIFIERS static))
actual: java.lang.NullPointerException
My tree filter works like this (I have omitted the @package headers for readability, but they are correct):
tree grammar treeFilterA;
options{
tokenVocab=myTextGrammar;
ASTLabelType=CommonTree;
output = AST;
filter = true;
}
topdown
: attribute
;
bottomup : ;
attribute
: ^(ATTRIBUTE e=. (MODIFIERS attribute_modifier*)) -> ^(NOTRELEVANTFORTHISEXAMPLE)
;
attribute_modifier:
: 'persisted'
| 'final'
| 'volatile'
...
;
if I try with this .gunit test:
gunit treeFilterA walks myTextGrammar;
attribute walks attribute:
"static int myAttr" -> "(attr3 int (MODIFIERS static))"
Any idea?
Thx in advance
Stanislas Herman Rusinsky.
More information about the antlr-interest
mailing list