blob: e924f8c7ef0c79e6001ce9dfbfce37c5481004ff (
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
|
package ast
import "jinx/pkg/lang/scanner/token"
type StmtKind int
const (
StmtKindUse StmtKind = iota
StmtKindFnDecl
StmtKindObjectDecl
StmtKindVarDecl
StmtKindIf
StmtKindTry
StmtKindReturn
StmtKindContinue
StmtKindBreak
StmtKindThrow
StmtKindExpr
)
type Stmt[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[any]
}
type StmtIf struct {
Cond Expr[any]
Then BlockNode
Elifs []CondNode
Else BlockNode
}
type StmtTry struct {
Try BlockNode
CatchedName IdentNode
Catch BlockNode
Finally BlockNode
}
type StmtReturn struct {
Value Expr[any]
}
type StmtContinue struct{}
type StmtBreak struct{}
type StmtThrow struct {
Value Expr[any]
}
type StmtExpr struct {
Value Expr[any]
}
|