[antlr-interest] Bug or badly written error case
Benjamin Shropshire
shro8822 at vandals.uidaho.edu
Mon Mar 3 15:02:51 PST 2008
I have run into a case where some antler generated code goes into an
error state but gives little or no helpful information. The error was
cause by having these two rules in the same grammar:
WS : (' '|'\t')+ {Skip();} ;
import
: 'import' (' ' | '\t')+ FText eol_ -> ^(IMPORT FText)
;
the error was removed by changeling this to
WS : (' '|'\t')+ {Skip();} ;
import
: 'import' WS FText eol_ -> ^(IMPORT FText)
;
This error in my code seems to be exposing a bug (or what looks like
one) in antlr because it causes some of the C# antlr runtime to throw a
RewriteEmptyStreamException. This gives no useful information (with
regards to finding my error) and seems like it exposes to much of the
underlying runtime.
I hope this is useful.
--Benjamin Shropshire
More information about the antlr-interest
mailing list