From 7959265839388173ba420554eb70e673c7f6a578 Mon Sep 17 00:00:00 2001 From: refaktor Date: Sun, 27 Oct 2024 01:23:10 +0200 Subject: [PATCH] fixing 3 bugs that were exposed around save\current, block types, pipesecond, |_-> loader err --- env/object.go | 30 ++++++++++++++++++++++++++---- loader/loader.go | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/env/object.go b/env/object.go index ad7ce3f6..960df660 100644 --- a/env/object.go +++ b/env/object.go @@ -483,7 +483,14 @@ func (i Block) Equal(o Object) bool { func (i Block) Dump(e Idxs) string { var bu strings.Builder - bu.WriteString("{ ") + switch i.Mode { + case 0: + bu.WriteString("{ ") + case 1: + bu.WriteString("[ ") + case 2: + bu.WriteString("( ") + } for _, obj := range i.Series.GetAll() { if obj != nil { bu.WriteString(obj.Dump(e)) @@ -492,7 +499,14 @@ func (i Block) Dump(e Idxs) string { bu.WriteString("'nil ") } } - bu.WriteString("}") + switch i.Mode { + case 0: + bu.WriteString(" }") + case 1: + bu.WriteString(" ]") + case 2: + bu.WriteString(" )") + } return bu.String() } @@ -769,7 +783,11 @@ func (i Opword) Equal(o Object) bool { } func (i Opword) Dump(e Idxs) string { - return "." + e.GetWord(i.Index) + var ssecond string + if i.Force == 1 { + ssecond = "*" + } + return "." + e.GetWord(i.Index) + ssecond } // @@ -820,7 +838,11 @@ func (i Pipeword) Equal(o Object) bool { } func (i Pipeword) Dump(e Idxs) string { - return "|" + e.GetWord(i.Index) + var ssecond string + if i.Force == 1 { + ssecond = "*" + } + return "|" + e.GetWord(i.Index) + ssecond } // diff --git a/loader/loader.go b/loader/loader.go index 72f61aa0..eedcc208 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -448,7 +448,7 @@ func newParser() *Parser { // TODO -- add string eaddress path url time LSETWORD <- ":" LETTER LETTERORNUM* LMODWORD <- "::" LETTER LETTERORNUM* GETWORD <- "?" LETTER LETTERORNUM* - PIPEWORD <- "\\" LETTER LETTERORNUM* / "|" LETTER LETTERORNUM* / PIPEARROWS / "|" NORMOPWORDS + PIPEWORD <- "\\" LETTER LETTERORNUM* / "|" LETTER LETTERORNUM* / PIPEARROWS / "|_" PIPEARROWS / "|" NORMOPWORDS ONECHARPIPE <- "|" ONECHARWORDS OPWORD <- "." LETTER LETTERORNUM* / "." NORMOPWORDS / OPARROWS / ONECHARWORDS / "[*" LETTERORNUM* TAGWORD <- "'" LETTER LETTERORNUM*