blob: 4f24cc51b5214cfdef1c823752c9c94621de49d2 (
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
|
package ast
import "jinx/pkg/lang/scanner/token"
type StmtKind int
const (
StmtKindEmpty StmtKind = iota
StmtKindUse
StmtKindFnDecl
StmtKindObjectDecl
StmtKindVarDecl
StmtKindIf
StmtKindTry
StmtKindReturn
StmtKindContinue
StmtKindBreak
StmtKindThrow
StmtKindExpr
)
type Stmt StmtT[any]
type StmtT[T any] struct {
At token.Loc
Kind StmtKind
Value T
}
type StmtUse struct {
Globals []IdentNode
Modules []IdentNode
Author IdentNode
}
type StmtFnDecl struct {
Name IdentNode
Args []IdentNode
Body BlockNode
}
type StmtObjectDecl struct{}
type StmtVarDecl struct {
Name IdentNode
Value Expr
}
type StmtIf struct {
Cond Expr
Then BlockNode
Elifs []CondNode
Else BlockNode
}
type StmtTry struct {
Try BlockNode
CatchedName IdentNode
Catch BlockNode
Finally BlockNode
}
type StmtReturn struct {
Value Expr
}
type StmtContinue struct{}
type StmtBreak struct{}
type StmtThrow struct {
Value Expr
}
type StmtExpr struct {
Value Expr
}
type StmtEmpty struct{}
|