-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.go
66 lines (52 loc) · 1.01 KB
/
type.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
// Generated file, do not modify
// Invocation: gen_ast -spec ./cmd/gen_ast/type.spec -dest type.go
package lox
type Type interface {
Accept(v typeVisitor)
}
type typeVisitor interface {
VisitNilType(t NilType)
VisitBoolType(t BoolType)
VisitNumberType(t NumberType)
VisitStringType(t StringType)
VisitFunctionType(t FunctionType)
VisitRefType(t *RefType)
}
type NilType struct {
Token Token
}
type BoolType struct {
Token Token
}
type NumberType struct {
Token Token
}
type StringType struct {
Token Token
}
type FunctionType struct {
Params []Type
Return Type
}
type RefType struct {
Value Type
ID int
}
func (t NilType) Accept(v typeVisitor) {
v.VisitNilType(t)
}
func (t BoolType) Accept(v typeVisitor) {
v.VisitBoolType(t)
}
func (t NumberType) Accept(v typeVisitor) {
v.VisitNumberType(t)
}
func (t StringType) Accept(v typeVisitor) {
v.VisitStringType(t)
}
func (t FunctionType) Accept(v typeVisitor) {
v.VisitFunctionType(t)
}
func (t *RefType) Accept(v typeVisitor) {
v.VisitRefType(t)
}