-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackslash.py
More file actions
37 lines (32 loc) · 713 Bytes
/
backslash.py
File metadata and controls
37 lines (32 loc) · 713 Bytes
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
import sys
with open('/tmp/query') as f:
LINE = f.readlines()
count_slash=0
count_quote=0
count_semicolon=0
statementList=[]
backSlashFlag=0
for char in LINE[0]:
statementList.append(char)
#print char + " " + str(count_quote)
if backSlashFlag:
backSlashFlag=0
continue
# condition for escape quote
if char == "\\":
if backSlashFlag == 0:
backSlashFlag=1
continue
else:
backSlashFlag=0
continue
if char == '"' and backSlashFlag == 0:
if count_quote == 0:
count_quote+=1
else:
count_quote=0
if char == ";" and count_quote==0:
print "---------------------------"
print ''.join(statementList)
print "---------------------------"
statementList=[]