blob: aceed18c18c4bb5106361fc21f335d879bcd5290 (
plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
|
package ast
import (
"jinx/pkg/libs/source"
)
type ExprKind int
const (
ExprKindBinary ExprKind = iota
ExprKindUnary
ExprKindCall
ExprKindSubscription
ExprKindMember
ExprKindGroup
ExprKindFnLit
ExprKindArrayLit
ExprKindIdent
ExprKindIntLit
ExprKindFloatLit
ExprKindStringLit
ExprKindBoolLit
ExprKindNullLit
ExprKindThis
)
type Expr ExprT[any]
func (e Expr) IsEmpty() bool {
return e == Expr{}
}
type ExprT[T any] struct {
At source.Loc
Kind ExprKind
Value T
}
type ExprBinary struct {
Left Expr
Op BinOp
Right Expr
}
type ExprUnary struct {
Op UnOp
Value Expr
}
type ExprCall struct {
Callee Expr
Args []Expr
}
type ExprSubscription struct {
Obj Expr
Key Expr
}
type ExprMember struct {
Obj Expr
Key IdentNode
}
type ExprGroup struct {
Value Expr
}
type ExprFnLit struct {
Args []IdentNode
Body BlockNode
}
type ExprArrayLit struct {
Values []Expr
}
type ExprIdent struct {
Value IdentNode
}
type ExprIntLit struct {
Value uint64
}
type ExprFloatLit struct {
Value float64
}
type ExprStringLit struct {
Value string
}
type ExprBoolLit struct {
Value bool
}
type ExprNullLit struct{}
type ExprThis struct{}
|