-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stmt.py
70 lines (52 loc) · 1.88 KB
/
Stmt.py
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
from typing import List
from Token import Token
from Expr import Expr
class Stmt:
pass
class Block(Stmt):
def __init__(self, statements: List[Stmt]) -> None:
self.statements = statements
def accept(self, visitor):
return visitor.visit_block_stmt(self)
class Expression(Stmt):
def __init__(self, expression: Expr) -> None:
self.expression = expression
def accept(self, visitor):
return visitor.visit_expression_stmt(self)
class BetterCall(Stmt):
def __init__(self, name: Token, params: List[Token], body: List[Stmt]) -> None:
self.name = name
self.params = params
self.body = body
def accept(self, visitor):
return visitor.visit_bettercall_stmt(self)
class JesseIf(Stmt):
def __init__(self, condition: Expr, then_branch: Stmt, else_branch: Stmt) -> None:
self.condition = condition
self.then_branch = then_branch
self.else_branch = else_branch
def accept(self, visitor):
return visitor.visit_jesseif_stmt(self)
class SayMyName(Stmt):
def __init__(self, expression: Expr) -> None:
self.expression = expression
def accept(self, visitor):
return visitor.visit_saymyname_stmt(self)
class Return(Stmt):
def __init__(self, keyword: Token, value: Expr) -> None:
self.keyword = keyword
self.value = value
def accept(self, visitor):
return visitor.visit_return_stmt(self)
class Cook(Stmt):
def __init__(self, name: Token, initializer: Expr) -> None:
self.name = name
self.initializer = initializer
def accept(self, visitor):
return visitor.visit_cook_stmt(self)
class TheOneWhoKnocks(Stmt):
def __init__(self, condition: Expr, body: Stmt) -> None:
self.condition = condition
self.body = body
def accept(self, visitor):
return visitor.visit_theonewhoknocks_stmt(self)