[antlr-interest] Another Parser skipping error

G R relationalalgebra at gmail.com
Sun Dec 9 11:16:06 PST 2007


The problem is that with Java, you don't have any end of string char like \0
with C (I know, C don't know strings, just a way to illustrate it).
My input comes from a JTextArea, then I don't know how to define my EOF
token.

Using a ";" is not something I want to do. So I've try to define my input
with the method that takes a char[] and the length of this array (sorry, I'm
not in front of my code, i cannot tell you the name) hopping that the lexer
will parse the entire char[], but this doesn't work.

Any idea how to do this without a ";" ?

Thanks
G.R.


2007/12/9, Gavin Lambert <antlr at mirality.co.nz>:
>
> At 06:09 10/12/2007, G R wrote:
> >When I use a correct input but, put some others character at the
> >end, and then make the input invalid, I, sometimes, get an error
> >(that's what I want^^), but sometimes not.
> >Using character that are not define in the lexer will raised an
> >error (a lexer error then). Everythings Ok here.
> [...]
> >But, using this input, non error is raised (whereas it should be)
> >Relation1 \JOIN Relation2 [
> >(where the left bracket is define by the rule LeftBrack of the
> >lexer)
>
> You need to make sure that your entrypoint rule ends with EOF.  If
> you don't do this then ANTLR will assume that it doesn't need to
> consume all of the input, so won't object to trailing constructs
> that it doesn't understand.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071209/d9feb4c8/attachment.html 


More information about the antlr-interest mailing list