[antlr-interest] AST Rewrite & tree filters support using ActionScript
Des Hartman
des at deshartman.com
Mon Mar 16 18:51:11 PDT 2009
George
Is AST rewrite and Tree filters supported in ActionScript? I have the
following code, but keep ending up with weird compiled as file. I have
checked as many of the errors as I can, but want to make sure I am not
wasting time with an unsupported feature.
==============================
tree grammar L2ITree;
options {
language=ActionScript;
tokenVocab=Formula;
output=AST;
ASTLabelType=CommonTree;
filter=true;
rewrite=true;
}
@members {
// This code needs to be implemented in a child class
public function convertLocalReference(ref:CommonTree):Number {return
null;}
}
reference
: ^(LREF lr=NAME) { iref:Number = convertLocalReference($lr);
} -> ^(IREF [iref])
;
=================================================
I have attached the formula grammar.
Output errors are on the following lines of code:
switch (alt1) {
case 1 :
<snip>
if ( this.state.backtracking==1 ) {
iref:Number = convertLocalReference(lr);
XXXXXXXXXX Implicit coersion of Number and Class
}
<snip>
if ( this.state.backtracking==0 ) {
retval.tree =
root_0; XXXXXXXXXXXX Property
is Read-only
var stream_retval:RewriteRuleSubtreeStream=new
RewriteRuleSubtreeStream(adaptor,"token retval", retval!=null?
retval.tree:null);
<snip>
//
C:\\usr\\workspace\\SFXFormula\\src\\com\\wiredlizard\\grammar\\L2ITree.g:39:79:
^( IREF[iref] )
{
var root_1:CommonTree =
CommonTree(adaptor.nil());
root_1 =
CommonTree(adaptor.becomeRoot(CommonTree(adaptor.create(IREF, iref)),
root_1)); XXXXXXXXXXX Access of undefined property iref
adaptor.addChild(root_0, root_1);
<snip>
retval.tree =
CommonTree(adaptor.rulePostProcessing(root_0)); XXXXXXXXXXXX
Property is Read-only
input.replaceChildren(adaptor.getParent(retval.start),
adaptor.getChildIndex(retval.start),
adaptor.getChildIndex(_last),
retval.tree);}
}
Thanks
Des
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090317/71c57ac3/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Formula.g
Type: application/octet-stream
Size: 5716 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090317/71c57ac3/attachment.obj
More information about the antlr-interest
mailing list