[antlr-interest] Interactive Editing with Antlr?

Bogdan Mitu bogdan_mt at yahoo.com
Mon Jul 22 00:26:46 PDT 2002


Hi Jason,

If you want to use an existing ANTLR grammar for syntax highlighting, take
care that you don't have { $setType( Token.SKIP); } actions inside. You also
need to create an InputStream wrapper around text Documents.

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 written a package for syntax highlighting using ANTLR lexers. You can
not apply it directly, since JEdit uses a custom text component, but you can
look at the ANTLR stuff there. I can send you the package, if you think it
might be useful to you.

Regards,
Bogdan

--- mrosgood <mrosgood at yahoo.com> wrote:
> Hi Guys-
> 
> 
> Have you guys seen Jedit (www.jedit.org)?  It's a text editor that has
> syntax highlighting and "folding".  Has anyone done something similar
> using an ANTLR grammar?  
> 
> The reason I ask is because I already have an ANTLR grammar.  I'd like
> to avoid creating another grammar-like-thingies for interactive
> editing, if I can.  And I thought I'd ask before I began splunking
> through Jedit's source code.
> 
> Thanks!
> 
> 
> Cheers, Jason Osgood
> 
> 
>  
> 
> 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