开发者

Hints regarding the use of ANTLR v3 generated files in Flash Builder 4.5.1

According to these instructions, I'm trying to use ANTLR generated *.as files in a current Flash Builder 4.5.1 project.

Therefore, I added this ANTLR's Actionscript runtime to my project - without problems.

I compiled lexer/parser specs using ANTLRWorks without problems too.

I added the language option to the source *.g file to make ANTLR generate Actionscript sources:

options {
    backtrack = true; 
    memoize = true;
    k=2;
    output = AST;
    language=ActionScript;        // Added this
    ASTLabelType = CommonTree;
}

Unfortunately, the ANTLR/ANTLRworks generated Actionscript code is buggy:

Catch开发者_如何学JAVA statements read like this catch (RecognitionException re), but should read like this: catch ( re:RecognitionException ).

Furthermore, Flash Builder complains about the use of Array here:

public override function get tokenNames():Array { return PhpParser.tokenNames; }

Could anybody confirm these problems and probably provide hints how to solve them?

UPDATE-1

A quick look at the sources of ANTLR v3.3 revealed this template code [line 142 @ ActionScript.stg]:

catch ( re:RecognitionException )

Thus, the current 3.3 branch seems to know the correct syntax.

Unfortunately, the current ANTLRworks 1.4.2 - which includes the 3.3 branch - fails.


Terence Parr, the project lead of ANTLR just confirmed, that ANTLRworks needs a new compile. Thanks for great support!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜