sdlang-dev / SDL

SDL (Simple Declarative Language) for java
11 stars 1 forks source link

Add comment support when creating SDL #7

Closed SingingBush closed 6 years ago

SingingBush commented 6 years ago

it's now possible to use:

Tag tag = SDL.tag("thing")
            .withNamespace("my")
            .withComment("some comment that is only available\nwhen serialised using pretty print")
            .withValue(SDL.value('g'))
            .withChild(SDL.tag("child")
                .withComment("some line comment")
                .withValues(SDL.value(dateTime), SDL.value(541L))
                .build()
            )
            .withAttribute("flt", SDL.value(0.0f))
            .build();

        tag.toString();

to output:

// some comment that is only available
// when serialised using pretty print
my:thing 'g' flt=0.0F {
    // some line comment
    child 2018/7/21 18:23:39.750 541L
}