[antlr-interest] Weird parser bug with character ranges
Rupert Mazzucco
mazzucco at iiasa.ac.at
Mon Sep 3 07:35:37 PDT 2007
> IDENT
> : ('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
> ;
> ...
> but this fails...
>
> a = 1
>
> with
>
> line 15:8 required (...)+ loop did not match anything at input 'a'
>
> I'm puzzled as to why 'a' should fail but not 'b'. My grammar is
> obviously much longer than that one line so I guess it's possible that
> it could be a problem elsewhere in my file but it seems like such a
> strange problem.
>
> Any clues?
Find a minimal grammar that exhibits the problem, because the snippet you posted sure doesn't if combined with a reasonable set of tokens and a rule to identify an assignment. And/or use antlrworks to see what the grammar really does with your input.
Regards
--
Rupert Mazzucco <mazzucco at iiasa.ac.at>
Research Scholar, Evolution and Ecology Program
IIASA - Institute for Applied Systems Analysis
Schlossplatz 1, 2361 Laxenburg, Austria
Phone: +43 2236 807 522 Fax: +43 2236 713 13
More information about the antlr-interest
mailing list