-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSimpleQLListener.py
200 lines (138 loc) · 5.34 KB
/
SimpleQLListener.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Generated from SimpleQL.g4 by ANTLR 4.6
from antlr4 import *
import pdb
# This class defines a complete listener for a parse tree produced by SimpleQLParser.
class SimpleQLListener(ParseTreeListener):
def __init__(self):
self.table_name = None
self.column_names = list()
self.conditions = list()
self.groupbys = list()
self.orderbys = list()
self.limit_value = None
self.offset_value = None
# Enter a parse tree produced by SimpleQLParser#parse.
def enterParse(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#parse.
def exitParse(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#error.
def enterError(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#error.
def exitError(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#simple_select_stmt.
def enterSimple_select_stmt(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#simple_select_stmt.
def exitSimple_select_stmt(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#boolean_expr.
def enterBoolean_expr(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#boolean_expr.
def exitBoolean_expr(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#ordering_terms.
def enterOrdering_terms(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#ordering_terms.
def exitOrdering_terms(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#ordering_term.
def enterOrdering_term(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#ordering_term.
def exitOrdering_term(self, ctx):
term = ctx.children[0].getText()
if len(ctx.children) == 2:
order = ctx.children[1].getText()
else:
order = 'ASC'
self.orderbys.append([term, order])
# Enter a parse tree produced by SimpleQLParser#order.
def enterOrder(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#order.
def exitOrder(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#selected_column.
def enterSelected_column(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#selected_column.
def exitSelected_column(self, ctx):
self.column_names.append(ctx.getText())
# Enter a parse tree produced by SimpleQLParser#literal_value.
def enterLiteral_value(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#literal_value.
def exitLiteral_value(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#unary_operator.
def enterUnary_operator(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#unary_operator.
def exitUnary_operator(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#limit_value.
def enterLimit_value(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#limit_value.
def exitLimit_value(self, ctx):
self.limit_value = ctx.getText()
# Enter a parse tree produced by SimpleQLParser#offset_value.
def enterOffset_value(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#offset_value.
def exitOffset_value(self, ctx):
self.offset_value = ctx.getText()
# Enter a parse tree produced by SimpleQLParser#keyword.
def enterKeyword(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#keyword.
def exitKeyword(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#function_name.
def enterFunction_name(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#function_name.
def exitFunction_name(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#table_name.
def enterTable_name(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#table_name.
def exitTable_name(self, ctx):
self.table_name = ctx.getText()
# Enter a parse tree produced by SimpleQLParser#column_name.
def enterColumn_name(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#column_name.
def exitColumn_name(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#order_by_column.
def enterOrder_by_column(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#order_by_column.
def exitOrder_by_column(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#grouping_terms.
def enterGrouping_terms(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#grouping_terms.
def exitGrouping_terms(self, ctx):
pass
# Enter a parse tree produced by SimpleQLParser#group_by_column.
def enterGroup_by_column(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#group_by_column.
def exitGroup_by_column(self, ctx):
self.groupbys.append(ctx.column_name().getText())
# Enter a parse tree produced by SimpleQLParser#any_name.
def enterAny_name(self, ctx):
pass
# Exit a parse tree produced by SimpleQLParser#any_name.
def exitAny_name(self, ctx):
pass