[antlr-interest] tree grammar and tokens
ben.corne at gmail.com
Mon Sep 5 12:25:51 PDT 2011
OK I'm clueless here.
I have a tree grammar ATDocWalker.g
and a parser grammar AmbientTalk.g generating the AST for ATDocWalker.
When I feed the parser this input:
deftype x <: y, z;
it outputs the following pretty printed AST:
END OF TREE----------
Everything looks normal (the newline after "test" is normal, since it's
included in the SINGLE_LINE_ANNOTATION lexer token).
When passing this AST to my tree grammar consisting of only a few rules so
far, just enough to parse this, I get the following exception:
/home/bcorne/ATDOC/Documenter/grammar/ATDocWalker.g: node from line 1:0
mismatched tree node: //@"test"
This is the tree rule causing the mismatched node:
: ^( AGDOCUMENTATION
In this tree grammar I use almost exactly the same rules to obtain the type
definition names x, y and z. I have no clue what goes wrong with the
Replacing the SINGLE_LINE_ANNOTATION token with the token definition from my
AmbientTalk.g file ('//@' ~( '\n' | '\r' )* '\r'? '\n') also has no effect.
then says that it expects '//@'.
Any ideas on what goes wrong here?
More information about the antlr-interest