Dear Tim
    Thank you for your sincerity. The reason i develop my own antlr plugin for 
netbeans is to support my assembler development. 
https://www.youtube.com/watch?v=rDFkhrHxHMw

    So I believe in my netbeans-antlr project, i have developed some useful 
thing dedicated for assembler development, but not useful for others.


Thanks
>From Peter
________________________________
From: Tim Boudreau <niftin...@gmail.com>
Sent: Thursday, October 17, 2019 4:06 AM
To: dev@netbeans.apache.org <dev@netbeans.apache.org>
Subject: Re: Syntax highlighting question

Hi, Peter,

I would strongly suggest we collaborate on that here:
https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans - since that
way, not only would it be implementable for Antlr, but for *any* language
using an Antlr grammar (it is two layers of modules - one for writing
language modules with most features generated for you from *any *Antlr
grammar, and then modules for Antlr grammar language built on top of that -
here are some docs on general-language support -
https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans/blob/master/api.md
- and I hope to have a continuous build w/ javadocs up soon).

NetBeans lexer and parser APIs have straightforward support for this - see
LanguagePath and the method on Parser.Result that takes an integer and
gives you a Parser.Result for an embedded language.

Done right, supporting an embedded language would be as simple as

@EmbeddedLanguage("text/x-java")
public static final RegionsKey<Whatever> THE_KEY = ...

(the generic language support API revolves around defining typed keys, and
then extracting what you're actually going to use from the parse tree as
character ranges with any data you need tied to those ranges, and then you
can retrieve the actual results from a parser result when a file is parsed).

That's been on my todo list too - the original antlr plugin author had
included a crude Antlr grammar for Java to do that, which isn't a terribly
sensible way to do it when you have a really good Java parser available for
use.

-Tim


On Tue, Oct 15, 2019 at 6:16 AM Peter Cheung <mcheun...@hotmail.com> wrote:

> Dear All
>    I have developed a module (https://gitlab.com/mcheung63/netbeans-antlr)
> for antlr, it provides antlr grammar syntax highlight, but it is not
> perfect. I want to enhance it but problem is : antlr supports "embed
> action", which is in Java, so two languages in same file.
>
>    To provide the best syntax highlight, i need to send those embed
> actions to "java lexer", this point has no problem to me. But Is there
> anyway merge those tokens (java-lexer) back to the one (antlr-lexer) which
> used by netbeans to provide syntax highlight?
>
>     Is there any way to provide syntax highlight but not using lexer? Let
> say i want to hight the second line from character 2-4 in red. Whatever the
> text is, i just want to highlight those positions, is it possible?
>
> Thanks
> From Peter
>
>
>

--
http://timboudreau.com

Reply via email to