diff --git a/internal/compilation-engine/compilation-engine.go b/internal/compilation-engine/compilation-engine.go
index b2dcdad..438ac74 100644
--- a/internal/compilation-engine/compilation-engine.go
+++ b/internal/compilation-engine/compilation-engine.go
@@ -81,7 +81,7 @@ func compileParameterList(output *strings.Builder, tokens []tokenizer.Token, ind
*(index)++
if tokens[*index].Type == tokenizer.SYMBOL && tokens[*index].Value == "," {
- output.WriteString(" " + tokens[*index].Value + " \n")
+ output.WriteString(" " + tokens[*index].Value + " \n")
*(index)++
return compileParameterList(output, tokens, index)
@@ -95,6 +95,8 @@ func compileVariableDeclaration(output *strings.Builder, tokens []tokenizer.Toke
return nil
}
+ output.WriteString("\n")
+
output.WriteString(" " + tokens[*index].Value + " \n")
*(index)++
@@ -136,6 +138,8 @@ func compileVariableDeclaration(output *strings.Builder, tokens []tokenizer.Toke
output.WriteString(" " + tokens[*index].Value + " \n")
(*index)++
+ output.WriteString("\n")
+
return compileVariableDeclaration(output, tokens, index)
}
@@ -500,13 +504,9 @@ func compileStatements(output *strings.Builder, tokens []tokenizer.Token, index
func compileSubroutineBody(output *strings.Builder, tokens []tokenizer.Token, index *int) error {
if tokens[*index].Type == tokenizer.KEYWORD && tokens[*index].Value == "var" {
- output.WriteString("\n")
-
if err := compileVariableDeclaration(output, tokens, index); err != nil {
return err
}
-
- output.WriteString("\n")
}
output.WriteString("\n")