<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk/value.go
diff options
context:
space:
mode:
Diffstat (limited to 'walk/value.go')
-rw-r--r--walk/value.go78
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
-}