[antlr-interest] accessing multiple return values
Des Hartman
des at deshartman.com
Mon May 4 05:58:52 PDT 2009
I have an interesting problem. I have written a tree parser for Actionscript
and in it I call external code to convert a reference from Stirng to Number.
I also calculate additional attributes of this reference (Type and format)
The details of the actual reference call is not really relevant. the code
snippets look like this:
@members{
public function
evaluateInternalReference(ref:CommonTree):TreeRuleReturnScope {return null;}
}
reference returns [Object value, String formulaType, String formatString]
: ^(IREF ir=INT ) { $value =
(evaluateInternalReference($ir) as TreeRuleReturnScope).values.value;
$formulaType =
(evaluateInternalReference($ir) as TreeRuleReturnScope).values.formulaType;
$formatString =
(evaluateInternalReference($ir) as
TreeRuleReturnScope).values.formatString;}
I am now converting this same Tree Grammar to Java and having a tough time
doing the same thing. Could someone help me out here with what I think
should be a simple solution? I need to somehow access value, formulaType and
formatString as I did above, but in Java?
@members{
public TreeRuleReturnScope evaluateInternalReference(CommonTree ref) {return
null;}
}
reference returns [Object value, String formulaType, String formatString]
: ^(IREF ir=INT ) { $value =
(TreeRuleReturnScope)(evaluateInternalReference($ir)).values.value; ?????
Thanks
Des
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090504/8b8f82c7/attachment.html
More information about the antlr-interest
mailing list