expressions between quotes aren't parsed anymore
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@45 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
3b9291a88b
commit
56b4756145
@ -36,4 +36,5 @@
|
|||||||
- Able to create tar.gz file containing Mac OsX application and samples using "make mac"
|
- Able to create tar.gz file containing Mac OsX application and samples using "make mac"
|
||||||
|
|
||||||
0.7
|
0.7
|
||||||
- Added README
|
- Added README
|
||||||
|
- Expressions between quotes aren't parsed anymore
|
3
README
3
README
@ -3,4 +3,5 @@ To launch the application, run
|
|||||||
./relational.py
|
./relational.py
|
||||||
|
|
||||||
If it needs some dependencies, check this page:
|
If it needs some dependencies, check this page:
|
||||||
http://galileo.dmi.unict.it/wiki/relational/doku.php?id=download#install
|
http://galileo.dmi.unict.it/wiki/relational/doku.php?id=download#install
|
||||||
|
|
||||||
|
17
parser.py
17
parser.py
@ -84,7 +84,7 @@ def parse(expr):
|
|||||||
symbol=expr[i:i+2]
|
symbol=expr[i:i+2]
|
||||||
start=i+2
|
start=i+2
|
||||||
break
|
break
|
||||||
elif expr[i:i+1] ==")":
|
if expr[i:i+1] ==")":
|
||||||
break #No symbol before
|
break #No symbol before
|
||||||
|
|
||||||
parameters=expr[start:endp]
|
parameters=expr[start:endp]
|
||||||
@ -137,8 +137,19 @@ def parse_op(expr):
|
|||||||
symbols["ᐅᐊ"]=".join(%s)"
|
symbols["ᐅᐊ"]=".join(%s)"
|
||||||
|
|
||||||
|
|
||||||
for i in symbols:
|
#We want to avoid to parse expressions within quotes.
|
||||||
expr=expr.replace(i,"_____%s_____"% (i))
|
#We split the string into an array, and we parse only the ones with even index
|
||||||
|
quotes=expr.split('"');
|
||||||
|
|
||||||
|
for i in range (0,len(quotes),2):
|
||||||
|
print "Parsing: ",quotes[i]
|
||||||
|
for j in symbols:
|
||||||
|
quotes[i]=quotes[i].replace(j,"_____%s_____"% (j))
|
||||||
|
print "Becomes: ",quotes[i]
|
||||||
|
#The parts outside the quotes was parsed, put the string together again
|
||||||
|
|
||||||
|
if (len(quotes)>1):
|
||||||
|
expr= '"'.join(quotes)
|
||||||
|
|
||||||
tokens=expr.split("_____")
|
tokens=expr.split("_____")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user