From 8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Wed, 19 Jul 2023 11:57:59 +0100 Subject: Huge refactor to a more value based system, doing away with terminals. Also introduces unit testing --- walk/value.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'walk/value.go') diff --git a/walk/value.go b/walk/value.go index 2e2c3c9..4459d89 100644 --- a/walk/value.go +++ b/walk/value.go @@ -11,7 +11,7 @@ const ( MapBegin MapEnd ) -func (value ValueTerminal) Atomise(in []Atom) []Atom { +func (value ValueTerminal) Atomise(in []AtomOLD) []AtomOLD { return append(in, NewAtomTerminal(value)) } func (value ValueTerminal) String() string { @@ -30,7 +30,7 @@ func (value ValueTerminal) String() string { } type ValueNull struct {} -func (value ValueNull) Atomise(in []Atom) []Atom { +func (value ValueNull) Atomise(in []AtomOLD) []AtomOLD { return append(in, NewAtomNull()) } func (value ValueNull) String() string { @@ -38,7 +38,7 @@ func (value ValueNull) String() string { } type ValueBool bool -func (value ValueBool) Atomise(in []Atom) []Atom { +func (value ValueBool) Atomise(in []AtomOLD) []AtomOLD { return append(in, NewAtomBool(bool(value))) } func (value ValueBool) String() string { @@ -50,7 +50,7 @@ func (value ValueBool) String() string { } type ValueNumber float64 -func (value ValueNumber) Atomise(in []Atom) []Atom { +func (value ValueNumber) Atomise(in []AtomOLD) []AtomOLD { return append(in, NewAtomNumber(float64(value))) } func (value ValueNumber) String() string { @@ -59,7 +59,7 @@ func (value ValueNumber) String() string { } type ValueString string -func (value ValueString) Atomise(in []Atom) []Atom { +func (value ValueString) Atomise(in []AtomOLD) []AtomOLD { in = append(in, NewAtomStringTerminal()) for _, char := range value { in = append(in, NewAtomStringRune(char)) @@ -71,8 +71,8 @@ func (value ValueString) String() string { return fmt.Sprintf("\"%s\"", string(value)) } -type Value interface { +type ValueOLD interface { // Append this values atoms to the input - Atomise(in []Atom) []Atom + Atomise(in []AtomOLD) []AtomOLD String() string } -- cgit v1.2.3