Finished Pretty Print function

This commit is contained in:
Aidan Hahn 2019-11-28 10:23:02 -08:00
parent 84013cb4a0
commit 7aa80376bb
No known key found for this signature in database
GPG key ID: 327711E983899316
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
package shsh
import (
"collections"
"strings"
)
func FmtToken(arg *Token) string {
@ -39,17 +39,17 @@ func PrintSExpression(arg *Token) {
lists.push(arg)
loop:
// string builder?
var constructor strings.Builder
i := lists.pop()
if i == nil {
goto done
}
for (iter := i; iter != nil; iter = i.next {
// add each string to string builder?
constructor.WriteString(FmtToken(iter))
}
// print stringbuilder?
print(constructor.String())
goto loop
done: