|
|
|
@ -46,6 +46,11 @@ func (tree *SyntaxTree) ToString (indent int) (output string) {
|
|
|
|
|
|
|
|
|
|
output += doIndent(indent, "---\n")
|
|
|
|
|
|
|
|
|
|
typeSectionKeys := sortMapKeysAlphabetically(tree.typeSections)
|
|
|
|
|
for _, name := range typeSectionKeys {
|
|
|
|
|
output += tree.typeSections[name].ToString(indent)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataSectionKeys := sortMapKeysAlphabetically(tree.dataSections)
|
|
|
|
|
for _, name := range dataSectionKeys {
|
|
|
|
|
output += tree.dataSections[name].ToString(indent)
|
|
|
|
@ -246,3 +251,20 @@ func (section *DataSection) ToString (indent int) (output string) {
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (section *TypeSection) ToString (indent int) (output string) {
|
|
|
|
|
output += doIndent (
|
|
|
|
|
indent,
|
|
|
|
|
"type ",
|
|
|
|
|
section.permission.ToString(), " ",
|
|
|
|
|
section.name, ":",
|
|
|
|
|
section.what.ToString())
|
|
|
|
|
|
|
|
|
|
if section.defaultValue.value == nil {
|
|
|
|
|
// TODO: print out members
|
|
|
|
|
} else {
|
|
|
|
|
output += " " + section.defaultValue.ToString(0, false)
|
|
|
|
|
output += "\n"
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|