-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackslash
36 lines (26 loc) · 819 Bytes
/
backslash
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
LINE="SELECT * FROM USERS; SELECT COUNT(*) from COMPANIES where notes like \"%;%\"; SELECT * FROM LOGS where msg = \"erro: \\"not \\\\"enough space\nreason:\\";\\\\\"";
count_slash=0
count_quote=0
count_semicolon=0
statementList=[]
for char in LINE:
statementList.append(char)
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 statementList
statementList=[]