[antlr-interest] "interactive" option
Brian Smith
brian-l-smith at uiowa.edu
Fri Oct 11 03:22:52 PDT 2002
In the documentation (http://www.antlr.org/doc/options.html#Options)
there is a mention of a "interactive" property, with this note:
"Both the lexer and the parser have an interactive option, which
defaults to "false". See the parser speed section above."
However, I can't find any reference to a "parser speed section." So,
what does "interactive" do? It seems from the source code that it
doesn't have any effect.
I ask because I am working on patches for ANTLR to better support
interactive, incremental lexing in NetBeans.
I have already created a patch that allows the lexer to return
partially-recognized tokens like this:
"Hi, I am a string that is almost fini
Normally, the lexer would throw an exception. But, the NetBeans editor
would prefer that instead the lexer returned STRING_LITERAL instead. So,
I created an option "returnIncompleteTokens" that, when enabled at
runtime (it is not set in the grammar file), causes the lexer to work in
the way expected by the NetBeans lexer framework.
The patch is very simple, just a few extra lines in JavaCodeGenerator.
It is similar to Bogdan's patch to JavaCodeGenerator for SATC (except
his patch always returns INVALID_TOKEN when an incomplete token is
reached). Since it is a runtime-only option (does not affect the grammar
file) it isn't necessary to "port" to C# or C++ code generators. Please
let me know if you are interested in this patch.
- Brian
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list