[antlr-interest] Detecting incomplete input in ANTLR V2
Thomas Rolfs
thomas.rolfs at cox.net
Tue Aug 8 15:29:34 PDT 2006
Peggy wrote:
> I don't know about the right way to solve your
> probleem, but you can specify an uponEOF() routine of
> your own.
Thanks, I saw that. Unfortunately it only hooks "normal" EOFs that
appear between rules so you can do lexer state transitions for features like
"#include". It doesn't catch abnormal EOFs that occur within rules due
to incomplete input.
Again, I hacked TokenStreamRecognitionException to propagate the info
I needed and it works now. I am using this feature to automatically
buffer up user input until there is enough valid input to continue.
Up till now I have avoided hacking ANTLR. However, my compiler has
been stable for over a year and I don't plan any upgrades to
newer versions of V2. My next upgrade will be to V3.
I hope V3 won't have the same limitations with exceptions/error
trapping. However, I plan to write my own C++ code generator to meet
my particular runtime needs so the ball will be in my court in that
regard :-)
BTW Ter and Co., I have been using ANTLR in for the last two years to develop a
new scripting language for video game development. I can't begin to
express how powerful and effective ANLTR has been for me. And V3 looks like
it'll be da'bomb too! Well done, all!
--
Thomas Rolfs
More information about the antlr-interest
mailing list