有关在Flash Builder 4.5.1中使用ANTLR v3生成的文件的提示 [英] Hints regarding the use of ANTLR v3 generated files in Flash Builder 4.5.1

查看:212
本文介绍了有关在Flash Builder 4.5.1中使用ANTLR v3生成的文件的提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这些说明,我试图用ANTLR生成* .as文件在当前Flash Builder 4.5.1项目中。

因此,我添加了这个 ANTLR的Actionscript运行时到我的项目中 - 没有问题。
$ b 我使用 ANTLRWorks 也没有问题。



语言选项的源* .g文件,使ANTLR生成Actionscript源:

  options {
backtrack = true;
memoize = true;
k = 2;
输出= AST;
语言= ActionScript; //添加了这个$​​ b $ b ASTLabelType = CommonTree;





$ b

不幸的是,ANTLR / ANTLRworks生成的Actionscript代码是错误的:


$ b catch语句读起来像 catch(RecognitionException re),但是应该这样读: catch(re :RecognitionException)



此外,Flash Builder在这里抱怨使用数组:

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

任何人都可以确认这些问题,并提供提示如何解决这些问题?
$ b

UPDATE-1

快速查看ANTLR v3.3的源代码,发现这个模板代码[第142行@ ActionScript.stg]:
$ b $ pre $ catch $($:$ RecognitionException)

因此,目前的3.3分支似乎知道正确的语法。不幸的是,目前的ANTLRworks 1.4.2(其中包括3.3分支)失败了。

解决方案ANTLR的项目负责人Terence Parr刚刚证实,ANTLRworks需要一个新的编译。感谢您的支持!


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.

解决方案

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

这篇关于有关在Flash Builder 4.5.1中使用ANTLR v3生成的文件的提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆