[antlr-interest] Another Parser skipping error

Randall R Schulz rschulz at sonic.net
Sun Dec 9 11:23:47 PST 2007


On Sunday 09 December 2007 11:16, G R wrote:
> 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.

I forget at the moment, but isn't it necessary to construct some kind of 
java.io.XYZInputStream (or XYZReader) for the ANTLR parser? If so, it 
will generate the necessary end-of-file indication (even if the 
underlying byte or character source is not literally a file).

Perhaps what you're missing is the fact that EOF is built in to ANTLR, 
not something you define or supply. You simply use that built-in 
pseudo-token in your grammar productions where you want to require that 
the complete input has been consumed.


> ...
>
> Thanks
> G.R.


Randall Schulz


More information about the antlr-interest mailing list