some improvments

This commit is contained in:
Adrian Zürcher
2026-01-01 11:00:23 +01:00
parent 8f313c00f0
commit ef0778c8b3
20 changed files with 305 additions and 385 deletions

View File

@@ -1,5 +1,7 @@
package ps
import "strings"
type PSStack []PSObject
func NewPSStack() *PSStack {
@@ -60,24 +62,26 @@ func (stack *PSStack) PopNumberAsFloat64() (float64, error) {
}
}
func (this *PSStack) String() string {
s := "[ "
for _, obj := range *this {
s += obj.String()
s += " "
func (pS *PSStack) String() string {
var s strings.Builder
s.WriteString("[ ")
for _, obj := range *pS {
s.WriteString(obj.String())
s.WriteString(" ")
}
s += "]"
s.WriteString("]")
return s
return s.String()
}
func (this *PSStack) DebugString() string {
s := "[ "
for _, obj := range *this {
s += obj.DebugString()
s += " "
func (pS *PSStack) DebugString() string {
var s strings.Builder
s.WriteString("[ ")
for _, obj := range *pS {
s.WriteString(obj.DebugString())
s.WriteString(" ")
}
s += "]"
s.WriteString("]")
return s
return s.String()
}