hclbaur / sdt-core

SDT Core Implementation
The Unlicense
0 stars 0 forks source link

Not possible to create a vacant parent node. #11

Closed hclbaur closed 3 months ago

hclbaur commented 4 months ago

There seems to be no way to create a node with an empty child set. Not quite sure if that is an issue. It probably is in some cases. Anyway it seems strange this cannot be done. For example:

    node "empty" {}
    node "empty" { value "''" }
    node "empty" { value "'abc'" }
        node "parent" { copy "0" }  
    node "parent" { if "0" { node "a" { } } }   

Output:

    empty ""
    empty ""
    empty "abc"
    parent ""
    parent ""

The last 2 examples could/should create a vacant parent node, e.g. parent { }. The logic being that if the compound statement contains another node or copy statement, a parent node is implied, but will be vacant if no actual child nodes are created.

It is an odd way to create a parent that is deliberately vacant, but how often will you need to do this anyway?

hclbaur commented 3 months ago

Available as of 1.3.1.