关于在 Flash Builder 4.5.1 中使用 ANTLR v3 生成的文件的提示 [英] Hints regarding the use of ANTLR v3 generated files in Flash Builder 4.5.1
问题描述
根据这些说明,我正在尝试使用 ANTLR 生成的 *.as 文件在当前 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.
因此,我将这个 ANTLR 的 Actionscript 运行时添加到我的项目中 - 没有问题.
Therefore, I added this ANTLR's Actionscript runtime to my project - without problems.
我使用 ANTLRWorks 编译词法分析器/解析器规范也没有问题.
I compiled lexer/parser specs using ANTLRWorks without problems too.
我在源 *.g 文件中添加了语言选项,以使 ANTLR 生成 Actionscript 源:
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;
}
不幸的是,ANTLR/ANTLRworks 生成的 Actionscript 代码有问题:
Unfortunately, the ANTLR/ANTLRworks generated Actionscript code is buggy:
Catch 语句读起来像这样 catch (RecognitionException re)
,但应该读成这样:catch (re:RecognitionException)
.
Catch statements read like this catch (RecognitionException re)
, but should read like this: catch ( re:RecognitionException )
.
此外,Flash Builder 在这里抱怨使用 Array:
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
快速浏览一下 ANTLR v3.3 的源代码就会发现这个模板代码 [line 142 @ ActionScript.stg]:
A quick look at the sources of ANTLR v3.3 revealed this template code [line 142 @ ActionScript.stg]:
catch ( re:RecognitionException )
因此,当前的 3.3 分支似乎知道正确的语法.
Thus, the current 3.3 branch seems to know the correct syntax.
不幸的是,当前的 ANTLRworks 1.4.2(包括 3.3 分支)失败了.
Unfortunately, the current ANTLRworks 1.4.2 - which includes the 3.3 branch - fails.
推荐答案
Terence Parr,ANTLR 的项目负责人刚刚确认,ANTLRworks 需要一个新的编译.感谢大力支持!
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屋!