Skip to content

Commit

Permalink
fixing 3 bugs that were exposed around save\current, block types, pip…
Browse files Browse the repository at this point in the history
…esecond, |_-> loader err
  • Loading branch information
refaktor committed Oct 26, 2024
1 parent 7131b88 commit 7959265
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
30 changes: 26 additions & 4 deletions env/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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()
}

Expand Down Expand Up @@ -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
}

//
Expand Down Expand Up @@ -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
}

//
Expand Down
2 changes: 1 addition & 1 deletion loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down

0 comments on commit 7959265

Please sign in to comment.