[metaas-dev] No viable alternative error

David Holroyd dave at badgers-in-foil.co.uk
Sun Feb 18 20:45:31 UTC 2007


On Sun, Feb 18, 2007 at 09:18:49PM +0100, kiroukou wrote:
> I've the following error :
> 
> line 1:0 no viable alternative at character '?'
> line 1:1 no viable alternative at character '?'
> line 1:2 no viable alternative at character '?'
> line 1:0 no viable alternative at character '?'
> line 1:1 no viable alternative at character '?'
> line 1:2 no viable alternative at character '?'
> Exception in thread "main"  
> uk.co.badgersinfoil.metaas.SyntaxException: Unexpected token RCURLY  
> (expecting SEMI) at line 64
>         at  
> uk.co.badgersinfoil.metaas.impl.ASTUtils.buildSyntaxException 
> (ASTUtils.java:177)
>         at  
> uk.co.badgersinfoil.metaas.impl.ASTActionScriptParser.parse 
> (ASTActionScriptParser.java:25)
>         at asprofiler.ASProfiler.<init>(ASProfiler.java:42)
>         at asprofiler.SocketASProfiler.<init>(SocketASProfiler.java:26)
>         at asprofiler.ProfilingApp.profileFile(ProfilingApp.java:53)
>         at asprofiler.ProfilingApp.<init>(ProfilingApp.java:39)
>         at asprofiler.ProfilingApp.main(ProfilingApp.java:101)
> Caused by: MismatchedTokenException(50!=51)
> 
> 
> Do you know where it may come from? I need to  add more exceptions  
> managment to my application, so I don't know more.
> 
> If you need the file that can't be parsed correctly, just ask me :)

Ok, so looking at your file, the error is actually pretty descriptive,
if you ignore the 'no viable alt' messages.

At line 63 in the file, the return-statement lacks a semicolon, and the
ActionScript parser is unfortunately super-strict at the moment :(
I disabled the 'virtual semicolon' handling in the grammar, because it
was causing ANTLR problems.

Is it ok for you to just insert that missing ';'?  :D


I'd still be interested to know where the 'no viable alt' messages are
coming from though.  Given that they are all reported at 'line 1', I
imagine this is actually a message about the code you are generating,
rather than the code you are parsing.  I suspect that the error
reporting in some part of the lexical analysis needs to be tightened up.

Were the reported characters question marks ('?') at your end, or are
these actually non-ascii characters that are getting mangled by my mail
client?


ta,
dave

-- 
http://david.holroyd.me.uk/



More information about the metaas-dev mailing list