-
Notifications
You must be signed in to change notification settings - Fork 66
/
value.go
89 lines (79 loc) · 1.79 KB
/
value.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package zed
type Value interface {
valueNode()
}
type ImpliedValue struct {
Kind string `json:"kind" unpack:""`
Of Any `json:"of"`
}
type DefValue struct {
Kind string `json:"kind" unpack:""`
Of Any `json:"of"`
TypeName string `json:"type_name"`
}
type CastValue struct {
Kind string `json:"kind" unpack:""`
Of Value `json:"of"`
Type Type `json:"type"`
}
func (*ImpliedValue) valueNode() {}
func (*DefValue) valueNode() {}
func (*CastValue) valueNode() {}
type Any interface {
anyNode()
}
type (
Primitive struct {
Kind string `json:"kind" unpack:""`
Type string `json:"type"`
Text string `json:"text"`
}
Record struct {
Kind string `json:"Kind" unpack:""`
Fields []Field `json:"fields"`
}
Field struct {
Name string `json:"name"`
Value Value `json:"value"`
}
Array struct {
Kind string `json:"kind" unpack:""`
Elements []Value `json:"elements"`
}
Set struct {
Kind string `json:"kind" unpack:""`
Elements []Value `json:"elements"`
}
Enum struct {
Kind string `json:"kind" unpack:""`
Name string `json:"name"`
}
Map struct {
Kind string `json:"kind" unpack:""`
Entries []Entry `json:"entries"`
}
Entry struct {
Key Value `json:"key"`
Value Value `json:"value"`
}
TypeValue struct {
Kind string `json:"kind" unpack:""`
Value Type `json:"value"`
}
Error struct {
Kind string `json:"kind" unpack:""`
Value Value `json:"value"`
}
)
func (*Primitive) anyNode() {}
func (*Record) anyNode() {}
func (*Array) anyNode() {}
func (*Set) anyNode() {}
func (*Enum) anyNode() {}
func (*Map) anyNode() {}
func (*TypeValue) anyNode() {}
func (*Error) anyNode() {}
func (*Primitive) ExprAST() {}
func (*TypeValue) ExprAST() {}
func (*Primitive) ExprDAG() {}
func (*TypeValue) ExprDAG() {}