[antlr-interest] Interactive Editing with Antlr?

Bogdan Mitu bogdan_mt at yahoo.com
Mon Jul 22 05:56:04 PDT 2002


--- Torsten Juergeleit <tjuergeleit at yahoo.de> wrote:
> Hi Bogdan,
> 
> > Another tricky point is that text being edited is
> > not always "correct". For
> > instance, when you start to type a string literal,
> > you have something like
> > "abc , which is probably not a valid token. The
> > ANTLR lexer won't return any
> > token, so you won't see anything until you type the
> > closing quote. There is
> > a workaround for this, but it's not trivial. 
> 
> I have the same problem with the outline view in my
> ANTLR grammar editor
> (http://sourceforge.net/projects/antlreclipse/ ).
> While a user is modifying the grammar code the
> according outline is truncated.
> Did you found a way to skip this "incomplete code"
> while lexing/parsing?

For the lexer, I modified the JavaCodeGenerator so that generated lexers
return an INVALID token istead of throwing an exception. For the Parser, I
don't see an easy solution. One idea:

- always keep available the previous version of the outline. When the
current outline gets truncated due to a change in progress, divide the text
in three zones: 
1. The part that can be parsed (although truncated). This should extend from
the begining to (near) the position of the change.
2. The part being modified.
3. The part after the modification, for which there exist a subtree in the
_previous_ version of the outline. 
You can then merge the subtree for 1. with the subtree for 3. to obtain a
reasonable guess for the next valid outline.

> > I have written a package for syntax highlighting
> > using ANTLR lexers.
> 
> Which languages are supported?

Java, ANTLR, Verilog (and a subset of XML).
 
> > I can send you the package, if you think it
> > might be useful to you.
> 
> I'm interested too ;-)
 
I will put it soon on the Yahoo ANTLR group under Files section.

Regards,
Bogdan

> 
> Cheers,
> Torsten
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list