Finished Pretty Print function
This commit is contained in:
parent
84013cb4a0
commit
7aa80376bb
2 changed files with 4 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue