-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmarker.go
More file actions
40 lines (31 loc) · 913 Bytes
/
marker.go
File metadata and controls
40 lines (31 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2022, Peter Ohler, All rights reserved.
package slip
type marker byte
// NewMarker only exists for coverage testing.
func NewMarker(b byte) marker {
return marker(b)
}
// String representation of the Object.
func (obj marker) String() string {
return string([]byte{byte(obj)})
}
// Append a buffer with a representation of the Object.
func (obj marker) Append(b []byte) []byte {
return append(b, byte(obj))
}
// Simplify the Object into true.
func (obj marker) Simplify() any {
return string([]byte{byte(obj)})
}
// Equal returns true if this Object and the other are equal in value.
func (obj marker) Equal(other Object) bool {
return obj == other
}
// Hierarchy returns the class hierarchy as symbols for the instance.
func (obj marker) Hierarchy() []Symbol {
return []Symbol{TrueSymbol}
}
// Eval returns self.
func (obj marker) Eval(s *Scope, depth int) Object {
return obj
}