Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » setWhitespaceRule
setWhitespaceRule [message #504099] Thu, 17 December 2009 09:11 Go to next message
majid  is currently offline majid Friend
Messages: 72
Registered: November 2009
Member
Hi,

I need an example for using method setWhitespaceRule when formatting.

Thanks

[Updated on: Thu, 17 December 2009 09:12]

Report message to a moderator

Re: setWhitespaceRule [message #504604 is a reply to message #504099] Mon, 21 December 2009 17:46 Go to previous messageGo to next message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
Hi mjido,
>
> I need an example for using method setWhitespaceRule when formatting.

formattingconfig.setWhitespaceRule(grammarAccess.getWSRule() );

While formatting, the formatter sometimes has to insert whitespaces into
the document. This tells which terminal rule would match them.

cheers,
Moritz


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: setWhitespaceRule [message #504702 is a reply to message #504604] Tue, 22 December 2009 09:40 Go to previous message
majid  is currently offline majid Friend
Messages: 72
Registered: November 2009
Member
But when i define a terminal in my grammar like this:

terminal TwoSpaces:
' ';

and i do formattingconfig.setWhitespaceRule(grammarAccess.getTwoSpace sRule() );

It doesn't work why?

[Updated on: Tue, 22 December 2009 09:41]

Report message to a moderator

Re: setWhitespaceRule [message #504731 is a reply to message #504702] Tue, 22 December 2009 06:08 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Mjido,

the configured WhitespaceRule is expected to match any whitespace -
especially a single one. The default formatter implementation will
insert single whitespaces and cannot handly other configurations. Please
file a ticket and describe your usecase.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

mjido schrieb:
> But when i define a terminal in my grammar like this:
>
> terminal TwoSpaces:
> ' ';
>
> and i do formattingconfig.setWhitespaceRule(grammarAccess.getTwoSpace
> sRule() );
>
> It doesn't work why?
>
Previous Topic:Terminals-only Grammar
Next Topic:Reusing parsed values
Goto Forum:
  


Current Time: Thu Apr 25 15:14:57 GMT 2024

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

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

Back to the top