This repository has been archived by the owner on Apr 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object_constructor.py
127 lines (85 loc) · 2.83 KB
/
object_constructor.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"""Object tree generation."""
import objects
class ObjectConstructor(object):
def start(self, ast): # noqa
return ast
def types(self, ast): # noqa
return ast
def pointer(self, ast): # noqa
return ast
def instance_types(self, ast): # noqa
return objects.parse_type(ast)
def typed_variable(self, ast): # noqa
return objects.TypedVariable(ast)
def declaration(self, ast): # noqa
return objects.DeclaredVariable(ast)
def function_decl(self, ast): # noqa
return objects.FunctionDecl(ast)
def scope(self, ast): # noqa
return objects.Scope(ast)
def statement(self, ast): # noqa
return ast
def expression_stmt(self, ast): # noqa
return objects.ExpressionStmt(ast)
def return_stmt(self, ast): # noqa
return objects.ReturnStmt(ast)
def if_statement(self, ast): # noqa
return objects.IfStmt(ast)
def loop_statement(self, ast): # noqa
return objects.LoopStmt(ast)
def expression(self, ast): # noqa
return ast
def assign(self, ast): # noqa
return objects.AssignExpr(ast)
def logical(self, ast): # noqa
return ast
def bitwise(self, ast): # noqa
return objects.LogicalBitwise(ast)
def boolean(self, ast): # noqa
return objects.LogicalBoolean(ast)
def comparison(self, ast): # noqa
return ast
def equality(self, ast): # noqa
return objects.EqExpr(ast)
def relation(self, ast): # noqa
return objects.RelExpr(ast)
def shift(self, ast): # noqa
return ast
def bitshift(self, ast): # noqa
return objects.ShiftExpr(ast)
def bin_expr(self, ast): # noqa
return ast
def addition(self, ast): # noqa
return objects.AddExpr(ast)
def subtraction(self, ast): # noqa
return objects.AddExpr(ast)
def term(self, ast): # noqa
return ast
def multiplication(self, ast): # noqa
return objects.MulExpr(ast)
def division(self, ast): # noqa
return objects.MulExpr(ast)
def unop(self, ast): # noqa
return objects.PreFixOp(ast)
def postop(self, ast): # noqa
if ast.type == 'f':
return objects.FuncCall(ast)
return objects.PostFixOp(ast)
def post_wrap(self, ast): # noqa
return ast
def unary(self, ast): # noqa
return ast
def factor(self, ast): # noqa
return ast
def subexpression(self, ast): # noqa
return ast
def literal(self, ast): # noqa
return objects.Literal(ast)
def integer(self, ast): # noqa
return ast
def string(self, ast): # noqa
return ast
def char(self, ast): # noqa
return ast
def identifier(self, ast): # noqa
return objects.Identifier(ast)