-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtester.py
More file actions
20 lines (18 loc) · 769 Bytes
/
tester.py
File metadata and controls
20 lines (18 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from antlr4 import *
from SimpleQLLexer import SimpleQLLexer
from SimpleQLListener import SimpleQLListener
from SimpleQLParser import SimpleQLParser
def main():
lexer = SimpleQLLexer(InputStream("select name, age from employees "
"where employees.bio like 'hello' "
"group by employees.country, employees.city "
"order by employees.id desc, employees.joining_date "
"limit 5, 100"))
stream = CommonTokenStream(lexer)
parser = SimpleQLParser(stream)
tree = parser.parse()
printer = SimpleQLListener()
walker = ParseTreeWalker()
walker.walk(printer, tree)
print printer.__dict__
main()