<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk/value.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-07-19 11:57:59 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-07-19 11:57:59 +0100
commit8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b (patch)
tree7a16883c17c2bdcc49b2f9d4f333dfc76c66248f /walk/value.go
parent3c34366bdd5d817a184d6b1c901d03a16b6faa4b (diff)
downloadstred-go-8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b.tar
Huge refactor to a more value based system, doing away with terminals. Also introduces unit testing
Diffstat (limited to 'walk/value.go')
-rw-r--r--walk/value.go14
1 files changed, 7 insertions, 7 deletions
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
}