Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to globally disable addition of spaces between keywords?
How to globally disable addition of spaces between keywords? [message #1782731] Wed, 28 February 2018 15:15 Go to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 344
Registered: August 2013
Senior Member
Hi

A formatter generates the following code:
CREATE TABLE person (
	person_id SMALLINT PRIMARY KEY ,
	"first name" VARCHAR ( 100 ) ,
	"birth date" DATE
) ;

Is it possible to disable addition of spaces around "(", ")", ",", ";". globally for all rules? And later to add spaces for specific rules only?

Also how to use spaces for indentation instead of tabs?
Re: How to globally disable addition of spaces between keywords? [message #1782736 is a reply to message #1782731] Wed, 28 February 2018 16:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
have a look at the WS terminal rule (you might need to split it up in ws and nl)
and the hidden statement from the grammar and for rules


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to globally disable addition of spaces between keywords? [message #1782762 is a reply to message #1782736] Thu, 01 March 2018 06:55 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 344
Registered: August 2013
Senior Member
I changed my terminals from

terminal WS: ' ' | '\t' | NL;
terminal fragment NL: '\r' | '\n';

to

terminal WS: (' ' | '\t')+;
terminal NL: ('\r' | '\n')+;

I disbled my custom formatter and try to serialize XMI model (with no hidden tokens information).
I tried diferent variants:
1) Set both WS and NL as hidden for grammar
2) Set only WS as hidden
3) Set only NL as hidden
4) Set no terminals as hidden
5) Remove WS and NL from grammar at all
6) Disabe or enable formatter during serialization

But with no effect. Serializer always adds one space between all tokens
Re: How to globally disable addition of spaces between keywords? [message #1782763 is a reply to message #1782762] Thu, 01 March 2018 07:24 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
so you have onewhitespaceformatter still enabled? and/or no custom formatter implemented?

just for foramtting you dont need to do the ws change i told you.
you simply need to implement the formatter ;)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 01 March 2018 07:25]

Report message to a moderator

Previous Topic:Custom formatter not registred
Next Topic:Xtext Editor as SWT widget
Goto Forum:
  


Current Time: Thu Apr 25 23:11:25 GMT 2024

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

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

Back to the top