<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk/atom.go
diff options
context:
space:
mode:
Diffstat (limited to 'walk/atom.go')
-rw-r--r--walk/atom.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/walk/atom.go b/walk/atom.go
index 299c39d..471f030 100644
--- a/walk/atom.go
+++ b/walk/atom.go
@@ -14,78 +14,78 @@ const (
AtomStringTerminal
AtomStringRune
)
-type Atom struct {
+type AtomOLD struct {
Typ AtomType
data uint64
}
-func NewAtomNull() Atom {
- return Atom {
+func NewAtomNull() AtomOLD {
+ return AtomOLD {
Typ: AtomNull,
data: 0,
}
}
-func NewAtomBool(v bool) Atom {
+func NewAtomBool(v bool) AtomOLD {
if v {
- return Atom {
+ return AtomOLD {
Typ: AtomBool,
data: 1,
}
} else {
- return Atom {
+ return AtomOLD {
Typ: AtomBool,
data: 0,
}
}
}
-func (v Atom) Bool() bool {
+func (v AtomOLD) Bool() bool {
if v.Typ != AtomBool {
panic("Tried to use non-bool as bool")
}
return v.data == 1
}
-func NewAtomNumber(v float64) Atom {
- return Atom {
+func NewAtomNumber(v float64) AtomOLD {
+ return AtomOLD {
Typ: AtomNumber,
data: math.Float64bits(v),
}
}
-func (v Atom) Number() float64 {
+func (v AtomOLD) Number() float64 {
if v.Typ != AtomNumber {
panic("Tried to use non-number as number")
}
return math.Float64frombits(v.data)
}
-func NewAtomTerminal(v ValueTerminal) Atom {
- return Atom {
+func NewAtomTerminal(v ValueTerminal) AtomOLD {
+ return AtomOLD {
Typ: AtomTerminal,
data: uint64(v),
}
}
-func (v Atom) Terminal() ValueTerminal {
+func (v AtomOLD) Terminal() ValueTerminal {
if v.Typ != AtomTerminal {
panic("Tried to use non-terminal as terminal")
}
return ValueTerminal(v.data)
}
-func NewAtomStringTerminal() Atom {
- return Atom {
+func NewAtomStringTerminal() AtomOLD {
+ return AtomOLD {
Typ: AtomStringTerminal,
data: 0,
}
}
-func NewAtomStringRune(v rune) Atom {
- return Atom {
+func NewAtomStringRune(v rune) AtomOLD {
+ return AtomOLD {
Typ: AtomStringRune,
data: uint64(v),
}
}
-func (v Atom) StringRune() rune {
+func (v AtomOLD) StringRune() rune {
if v.Typ != AtomStringRune {
panic("Tried to use non-stringrune as stringrune")
}
return rune(v.data)
}
-func (v Atom) String() string {
+func (v AtomOLD) String() string {
switch v.Typ {
case AtomNull:
return "null"