[antlr-interest] antlr 3.1b - actionscript - commontokenstream error

Gavin Lambert antlr at mirality.co.nz
Sun Jun 1 06:08:01 PDT 2008


At 23:13 1/06/2008, Jiiii Uuuuu wrote:
>     I was trying to use generated actionscript code in the 
> following way, and hit type conversion error, any help please?
>
>-----------------SNIP----------
>             var lexer:myLexer = new myLexer ( new 
> ANTLRStringStream ( input.text + "\r\n" ) );
>             var tokens:CommonTokenStream = 
> CommonTokenStream(lexer);
>
>             var parser:myParser = myParser(tokens);
>             parser.prog();
>------------------SNIP-----------
>
>TypeError: Error #1034: Type Coercion failed: cannot convert 
>com.jithu::myLexer at 3b964a1 to org.antlr.runtime.CommonTokenStream.
>     at VirtualLab/AntlrActionScriptTest()
>     at VirtualLab/___VirtualLab_Button1_click()

While I don't know the first thing about ActionScript (so could 
easily be wrong) -- could it be that you didn't say 'new' when 
creating the token stream and the parser, so it thinks it's a type 
conversion instead of a constructor call?



More information about the antlr-interest mailing list