diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-07-19 12:16:39 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-07-19 12:16:39 +0100 |
commit | ac153f2b90b966baaf132a487514ae2194a64dd5 (patch) | |
tree | 39f63785de58ce4f6d8055847d5f0efa54d9499b /walk/value.go | |
parent | 7d53110f2773ba758dea2f5c00483d879d378870 (diff) | |
download | stred-go-ac153f2b90b966baaf132a487514ae2194a64dd5.tar |
Removes lots of old atom based code from walk
Diffstat (limited to 'walk/value.go')
-rw-r--r-- | walk/value.go | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/walk/value.go b/walk/value.go deleted file mode 100644 index 4459d89..0000000 --- a/walk/value.go +++ /dev/null @@ -1,78 +0,0 @@ -package walk - -import ( - "fmt" -) - -type ValueTerminal int -const ( - ArrayBegin ValueTerminal = iota - ArrayEnd - MapBegin - MapEnd -) -func (value ValueTerminal) Atomise(in []AtomOLD) []AtomOLD { - return append(in, NewAtomTerminal(value)) -} -func (value ValueTerminal) String() string { - switch value { - case ArrayBegin: - return "[" - case ArrayEnd: - return "]" - case MapBegin: - return "{" - case MapEnd: - return "}" - default: - panic("Unknown TerminalValue") - } -} - -type ValueNull struct {} -func (value ValueNull) Atomise(in []AtomOLD) []AtomOLD { - return append(in, NewAtomNull()) -} -func (value ValueNull) String() string { - return "null" -} - -type ValueBool bool -func (value ValueBool) Atomise(in []AtomOLD) []AtomOLD { - return append(in, NewAtomBool(bool(value))) -} -func (value ValueBool) String() string { - if value { - return "true" - } else { - return "false" - } -} - -type ValueNumber float64 -func (value ValueNumber) Atomise(in []AtomOLD) []AtomOLD { - return append(in, NewAtomNumber(float64(value))) -} -func (value ValueNumber) String() string { - v := float64(value) - return fmt.Sprintf("%f", v) -} - -type ValueString string -func (value ValueString) Atomise(in []AtomOLD) []AtomOLD { - in = append(in, NewAtomStringTerminal()) - for _, char := range value { - in = append(in, NewAtomStringRune(char)) - } - in = append(in, NewAtomStringTerminal()) - return in -} -func (value ValueString) String() string { - return fmt.Sprintf("\"%s\"", string(value)) -} - -type ValueOLD interface { - // Append this values atoms to the input - Atomise(in []AtomOLD) []AtomOLD - String() string -} |