[antlr-interest] ANTLR lexer vs. JFace RuleBasedScanner

Magnus Knuth mai00cas at studserv.uni-leipzig.de
Wed Aug 9 07:33:25 PDT 2006


>
> >/ For syntax highlighting I'm at a loss. What is not obvious to me is
> />/ how to avoid the PresentationReconciler, or at least make it use my
> />/ scan/parse already performed.
> /
> As far as I understand that underdocumented and overcomplicated API, you
> can't. They consider reconciling and text highlighting to be two
> completely different things (which might actually be a sane decision).
> You can however implement the Scanner interface and return tokens
> wrapping the ANTLR tokens.
>
> >/ Can someone point me to an example where ANTLR is used for syntax
> />/ highlighting in an Eclipse TextEditor project? Thanks.
> /
> I guess ANTLREclipse does?
>   

No sorry, it doesn't.
That is the reason why the ANTLREclipse editor is somehow boring and
still an embryonic help, it only highlights the ANTLR & JAVA keywords
and comments to you, it does not know much about your grammar, nor it's own.
ANTLR itself is mainly used for cursor-awareness: outline generation and
hovers, not even for simple syntax error recognition or colourful
distinction of token and rule elements.



More information about the antlr-interest mailing list