[antlr-interest] Error rollback on incomplete input?

Darien Hager darien.hager at etelos-inc.com
Tue Feb 12 10:57:13 PST 2008


I'm experimenting with using ANTLR to parse some streaming (network) data
broken up into statements. The statements come in a stream, but the end may
be fragmentary.


For example, suppose a statement was just a quoted string (which could
contain a semicolon as the terminator)
_________________
tokens{ TERM=';';
example_statement : WS? QUOTEDSTRING WS? TERM;
/* QUOTEDSTRING, WS, omitted. */
_________________
example fragmentary input:
 "hello world" ; "how are you today?" ; "fine; thank y
_________________



What I'd like to do is run parser.example_statement(); repeatedly
until an error occurs,
and then defer further runs until more data has arrived.

Does this sound feasible to anyone? I'm guessing I cannot do this on an
inputstream/lexer
level, since the lexer attempts to lex everything in one pass.

-- 
Darien Hager
Developer
Etelos, Inc.
darien at etelos.com

http://www.etelos.com
"Revolutionizing the way applications are developed, distributed and
consumed."

This e-mail message, including attachments, may contain confidential
information for the sole use of the intended recipient(s). If you are not
the intended recipient, then this is notice that any use, disclosure,
dissemination, distribution or copying is strictly prohibited. If you have
received this message in error please contact the sender by reply mail and
destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080212/dda30935/attachment.html 


More information about the antlr-interest mailing list