Skip to main content



      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 10:15 Go to next message
Eclipse UserFriend
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 11:57 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to globally disable addition of spaces between keywords? [message #1782762 is a reply to message #1782736] Thu, 01 March 2018 01:55 Go to previous messageGo to next message
Eclipse UserFriend
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 02:24 Go to previous message
Eclipse UserFriend
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 ;)

[Updated on: Thu, 01 March 2018 02:25] by Moderator

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


Current Time: Wed Nov 05 16:32:28 EST 2025

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

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

Back to the top