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

霸气de小男生 提交于 2019-12-07 18:31:11

问题


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 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.


回答1:


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



来源:https://stackoverflow.com/questions/6447444/hints-regarding-the-use-of-antlr-v3-generated-files-in-flash-builder-4-5-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!