Finished Pretty Print function
This commit is contained in:
parent
84013cb4a0
commit
7aa80376bb
2 changed files with 4 additions and 4 deletions
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
||||||
package shsh
|
package shsh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"collections"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func FmtToken(arg *Token) string {
|
func FmtToken(arg *Token) string {
|
||||||
|
|
@ -39,17 +39,17 @@ func PrintSExpression(arg *Token) {
|
||||||
lists.push(arg)
|
lists.push(arg)
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
// string builder?
|
var constructor strings.Builder
|
||||||
i := lists.pop()
|
i := lists.pop()
|
||||||
if i == nil {
|
if i == nil {
|
||||||
goto done
|
goto done
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iter := i; iter != nil; iter = i.next {
|
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
|
goto loop
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue