Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Extending java syntax coloring
Extending java syntax coloring [message #518333] Wed, 03 March 2010 15:10 Go to next message
Eclipse UserFriend
Hi all,

I work a lot with java code, that uses some DSL inside strings, like

myJavaMethod("from x : V with x.count < 17 reportSet x end");

Is there a way to extend the usual syntax coloring for java with some
basic highlighting inside java string literals?

For now, I would be fully satisfied with making a fixed set of DSL
keywords bold inside strings. In the example above, those are "from",
"with", "reportSet" and "end".

I had a brief look at the JDT docs, and if I understand correctly, the
coloring is done by some lexer (aka RuleBasedScanner) returning a token
list, and the color for each token is determined by some IColorManager.
And of course, for a java lexer a string literal is one single token, so
any highlighting inside string literals is impossible.

Please tell me that I am either totally wrong, or that I'm right but the
thing I want to do is still easily possible. ;-)

I appreciate any pointers!

Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Extending java syntax coloring [message #523419 is a reply to message #518333] Fri, 26 March 2010 07:46 Go to previous message
Eclipse UserFriend
Tassilo Horn wrote:
> Hi all,
>
> I work a lot with java code, that uses some DSL inside strings, like
>
> myJavaMethod("from x : V with x.count < 17 reportSet x end");
>
> Is there a way to extend the usual syntax coloring for java with some
> basic highlighting inside java string literals?
>
No.

Dani
> For now, I would be fully satisfied with making a fixed set of DSL
> keywords bold inside strings. In the example above, those are "from",
> "with", "reportSet" and "end".
>
> I had a brief look at the JDT docs, and if I understand correctly, the
> coloring is done by some lexer (aka RuleBasedScanner) returning a token
> list, and the color for each token is determined by some IColorManager.
> And of course, for a java lexer a string literal is one single token, so
> any highlighting inside string literals is impossible.
>
> Please tell me that I am either totally wrong, or that I'm right but the
> thing I want to do is still easily possible. ;-)
>
> I appreciate any pointers!
>
> Tassilo
>
Previous Topic:existence error on non-java file
Next Topic:Help with compiler and AST needed
Goto Forum:
  


Current Time: Fri Mar 21 09:58:27 EDT 2025

Powered by FUDForum. Page generated in 0.02963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top