Hi All,

I am trying to use ANTLR for checking the return values from my Tree
grammar.
I have a simple rule which just returns the text found.

start_tree_parser walks start_parser:
"this is text" returns ["this is text"]


However, the Answer returned from this rule is the actual AST built up by
the parser,

i.e. (TEXT this is text) is the actual value returned.

The options I have in my Tree grammar are.

options {
  language     = Java;
  output       = AST;
  tokenVocab   = text_parser;
  ASTLabelType = CommonTree;
}

And my tree grammar is as follows:

start_tree_parser returns [String result = " "] :
    ^(TEXT text) {$result = $text.result;}

text returns [String result = ""; ]:
    (TEXTTOKEN)  {$result = $text;}

The tree being formed from the parser is correct, however, I want to test
the output of walking the tree and checking the string returned.

I am not sure if I am using the correct syntax for checking the return
values. If anyone could point me in the right direction, that would be
great!

Thanks,
Kunal

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.

Reply via email to