From 0ad1c0b2f4c23c880464d3eb784d998e02f01ae6 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 17 Aug 2022 01:04:52 -0400 Subject: [PATCH] Fixed extraneous newlines after complex initialization values --- parser/tree-tostring.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index 6970df7..e9d5b0e 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -158,35 +158,40 @@ func (argument *Argument) ToString (indent int, breakLine bool) (output string) case ArgumentKindObjectInitializationValues: // this should only appear in contexts where breakLine is true output += argument.value.(*ObjectInitializationValues). - ToString (indent) + ToString(indent) case ArgumentKindArrayInitializationValues: // this should only appear in contexts where breakLine is true output += argument.value.(*ArrayInitializationValues). - ToString (indent) + ToString(indent) case ArgumentKindIdentifier: output += doIndent ( indent, argument.value.(*Identifier).ToString()) + if breakLine { output += "\n" } case ArgumentKindDeclaration: output += doIndent ( indent, argument.value.(*Declaration).ToString()) + if breakLine { output += "\n" } case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat: output += doIndent(indent, fmt.Sprint(argument.value)) + if breakLine { output += "\n" } case ArgumentKindString: output += doIndent ( indent, "\"" + argument.value.(string) + "\"") + if breakLine { output += "\n" } case ArgumentKindRune: output += doIndent ( indent, "'" + string(argument.value.(rune)) + "'") + if breakLine { output += "\n" } case ArgumentKindOperator: // TODO @@ -195,7 +200,6 @@ func (argument *Argument) ToString (indent int, breakLine bool) (output string) // phrase command. } - if breakLine { output += "\n" } return }