Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » manage syntax highlighting
manage syntax highlighting [message #893818] Thu, 05 July 2012 14:49 Go to next message
frank fotso is currently offline frank fotsoFriend
Messages: 91
Registered: May 2012
Member
hi everybody,

i wanted to know if it is possible to give a specific color to element types , just imagine in your grammar you have define number having INT as a type or name having String type , and you want xtext to put a specific color to the name you enter or the integer you put?

if it is possible , can you tell me how to do it .

Best regard
Re: manage syntax highlighting [message #893824 is a reply to message #893818] Thu, 05 July 2012 15:12 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

the basics are covered in the Xtext documentation and there are blog posts and forum posts on the topic (search the web for Xtext semantic highlighting). Feel free to follow up in this thread with more specific questions you have.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: manage syntax highlighting [message #894416 is a reply to message #893824] Mon, 09 July 2012 07:33 Go to previous messageGo to next message
frank fotso is currently offline frank fotsoFriend
Messages: 91
Registered: May 2012
Member
thks for the news , but i have searched the web for what you proposed but there was nothing interesting.
my big problem is this :

i have the following xtext grammar for example :

  MUX_CONFIG returns io::MUX_CONFIG:
	{io::MUX_CONFIG}
	'MUX_CONFIG'
	'{'
		('MultiplexedAddressLines' MultiplexedAddressLines=TypeBool)?
		('AddressLineADD0' AddressLineADD0=EString)?
		('AddressLineADD1' AddressLineADD1=EString)?
		('AddressLineADD2' AddressLineADD2=EString)?
		('MuxAdd0LSB' MuxAdd0LSB=TypeBool)?
    '}' 


and what i want is to give a specific color to the type element , that means for the type string i want that the walue enter and the element yes or no of the type bool have the same color but i also want that color to be different from the color of the word in quotes.
that means , base on the above grammar , imagine you have the folor editor file:

  	muxconfig MUX_CONFIG {
			MultiplexedAddressLines No
			AddressLineADD0 ggdjd
			AddressLineADD1 tgklgkl
			AddressLineADD2 jgdkd
			MuxAdd0LSB Yes
			}  



so i want the No , Yes and tthe differents names like ggdjd, tgklgk or jgdkd to have a specific color..

any ideas on how to do it?

Best regard,
Frank
Re: manage syntax highlighting [message #894498 is a reply to message #894416] Mon, 09 July 2012 12:44 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Take a look at
org.cloudsmith.geppetto.pp.dsl.ui.coloring.PPSemanticHighlightingCalculator
in repository cloudsmith/geppetto @ github for various ways to provide
highlighting. My implementation supports regular (token based), as well
as node based, textual based, and resource-properties based
highlighting. (Basically different ways to find an offset and a length
of text to highlight).

Hope that helps you.
- henrik

On 2012-09-07 9:33, frank fotso wrote:
> thks for the news , but i have searched the web for what you proposed
> but there was nothing interesting.
> my big problem is this :
> i have the following xtext grammar for example :
>
> MUX_CONFIG returns io::MUX_CONFIG:
> {io::MUX_CONFIG}
> 'MUX_CONFIG'
> '{'
> ('MultiplexedAddressLines' MultiplexedAddressLines=TypeBool)?
> ('AddressLineADD0' AddressLineADD0=EString)?
> ('AddressLineADD1' AddressLineADD1=EString)?
> ('AddressLineADD2' AddressLineADD2=EString)?
> ('MuxAdd0LSB' MuxAdd0LSB=TypeBool)?
> '}'
> and what i want is to give a specific color to the type element , that
> means for the type string i want that the walue enter and the element
> yes or no of the type bool have the same color but i also want that
> color to be different from the color of the word in quotes.
> that means , base on the above grammar , imagine you have the folor
> editor file:
>
> muxconfig MUX_CONFIG {
> MultiplexedAddressLines No
> AddressLineADD0 ggdjd
> AddressLineADD1 tgklgkl
> AddressLineADD2 jgdkd
> MuxAdd0LSB Yes
> }
>
> so i want the No , Yes and tthe differents names like ggdjd, tgklgk
> or jgdkd to have a specific color..
>
> any ideas on how to do it?
>
> Best regard,
> Frank
Re: manage syntax highlighting [message #894504 is a reply to message #894498] Mon, 09 July 2012 13:17 Go to previous messageGo to next message
frank fotso is currently offline frank fotsoFriend
Messages: 91
Registered: May 2012
Member
thks for the help, but i'm not using Git , so canyou explain to me how to have access to your project on Git, means what am i supposed to do step by step to have access to it?

thks
Best regards,
Frank
Re: manage syntax highlighting [message #894513 is a reply to message #894504] Mon, 09 July 2012 13:47 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-09-07 15:18, frank fotso wrote:
> thks for the help, but i'm not using Git , so canyou explain to me how
> to have access to your project on Git, means what am i supposed to do
> step by step to have access to it?
>

You can view the logic in a browser - just go to github and navigate to
the file.

Use this link:

https://github.com/cloudsmith/geppetto/blob/master/org.cloudsmith.geppetto.pp.dsl.ui/src/org/cloudsmith/geppetto/pp/dsl/ui/coloring/PPSemanticHighlightingCalculator.java

Regards
- henrik
Previous Topic:automatically adding a xtext nature to an existing file
Next Topic:Preprocessing in XText
Goto Forum:
  


Current Time: Tue Apr 23 14:09:50 GMT 2024

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

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

Back to the top