[antlr-interest] Getting input from an alternate source (sockets)

Monty Zukowski monty at codetransform.com
Tue May 29 20:11:42 PDT 2007


This is actually an interesting problem.  java.regex.Matcher has two
methods specifically to address whether more input would change the
last match: hitEnd() and requireEnd().  See
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Matcher.html#hitEnd()

I haven't totally digested the semantics of the two, but inspection of
the source would help in that effort.  Ter, I think something similar
to this may be possible to incorporate into your DFAs.  For this
situation it would be extremely useful to have something similar, and
I bet it would be an interesting enhancement to your algorithm.

Monty

On 5/29/07, Glenn Jones <gjones at coopknow.com> wrote:
> I am writing an application that will be receiving its input through a
> network socket.  I have been working with Antlr 3 and trying to get a series
> of input from the client to be parsed by Antlr.  I am able to get the data
> from the socket into the lexer's input stream, but the lexer appears to be
> wanting to read the data to the end.  Since I need to send responses back to
> the client after specific parts of the input has been parsed, I can't wait
> for the end of data to be reached.
>
> Is there a way of having the lexer return tokens to the parser as it
> recognizes them as opposed to waiting?
>
> Glenn Jones
>
>
>
>


More information about the antlr-interest mailing list