Following these instructions , I am trying to use the ANTLR * .as files created in the current Flash Builder 4.5.1 project.
So I added this ANTLR Actionscript to my project - no problem.
I compiled the lexer / parser specifications using ANTLRWorks without any problems.
I added a language parameter to the * .g source file so that ANTLR generates ActionScript sources:
options { backtrack = true; memoize = true; k=2; output = AST; language=ActionScript; // Added this ASTLabelType = CommonTree; }
Unfortunately, the ANTLR / ANTLRworks generated ActionScript code does not work:
To pop up statements read as follows catch (RecognitionException re)
, but should look like this: catch ( re:RecognitionException )
.
In addition, Flash Builder complains about using an array here:
public override function get tokenNames():Array { return PhpParser.tokenNames; }
Can someone confirm these problems and possibly give hints how to solve them?
UPDATE-1
A quick look at ANTLR v3.3 sources showed this template code [line 142 @ ActionScript.stg]:
catch ( re:RecognitionException )
So the current 3.3 branch seems to know the correct syntax.
Unfortunately, the current ANTLRworks 1.4.2, which includes branch 3.3, fails.
flex antlr antlrworks flash-builder
SteAp Jun 22 '11 at 10:45 2011-06-22 22:45
source share