Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using indent for more than one level of indentation
Using indent for more than one level of indentation [message #1782182] Tue, 20 February 2018 09:33 Go to next message
Giray Ozel is currently offline Giray OzelFriend
Messages: 1
Registered: February 2018
Junior Member
I have the following grammar:

  'Department:' name = ID
  'Company:' companyName = STRING
  'Persons:' persons += Person+

  firstName = STRING
  surname = STRING
  address = STRING

And I would like to have formatting like this:

Department: Department1
    Company: "Company1"
        "Person1FirstName" : "Person1LastName" : "Person1Address"
        "Person2FirstName" : "Person2LastName" : "Person2Address"

But when I implement the formatter code for the Person type I cannot seem to be able to use indent twice since the white space formatting gets merged instead of getting concatinated.

class TestsFormatter extends AbstractFormatter2
    def dispatch void format(Department department, extension IFormattableDocument document)



        for (Person person : department.persons)

    def dispatch void format(Person person, extension IFormattableDocument document)

I found out that there is an example with "increaseIndentation"/"decreaseIndentation" in the documentation of AbstractFormatter2. But when I try to use them, they cannot be resolved.
Re: Using indent for more than one level of indentation [message #1782231 is a reply to message #1782182] Tue, 20 February 2018 19:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11816
Registered: July 2009
Senior Member
you can do this with custom replacer as described here:

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Trying to write a DSL with Xtext to specify an XML-like language
Next Topic:Custom QualifiedNameProvider Problems
Goto Forum:

Current Time: Tue Mar 20 12:03:42 GMT 2018

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

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