From 56b47561452e5d334d9ec422b0b50a9c027f552e Mon Sep 17 00:00:00 2001 From: LtWorf Date: Sat, 4 Oct 2008 17:37:58 +0000 Subject: [PATCH] expressions between quotes aren't parsed anymore git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@45 014f5005-505e-4b48-8d0a-63407b615a7c --- CHANGELOG | 3 ++- README | 3 ++- parser.py | 17 ++++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 852cd52..d9893d0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,4 +36,5 @@ - Able to create tar.gz file containing Mac OsX application and samples using "make mac" 0.7 -- Added README \ No newline at end of file +- Added README +- Expressions between quotes aren't parsed anymore \ No newline at end of file diff --git a/README b/README index e1038b6..7982bbc 100644 --- a/README +++ b/README @@ -3,4 +3,5 @@ To launch the application, run ./relational.py If it needs some dependencies, check this page: -http://galileo.dmi.unict.it/wiki/relational/doku.php?id=download#install \ No newline at end of file +http://galileo.dmi.unict.it/wiki/relational/doku.php?id=download#install + diff --git a/parser.py b/parser.py index ef8b1e9..4074557 100644 --- a/parser.py +++ b/parser.py @@ -84,7 +84,7 @@ def parse(expr): symbol=expr[i:i+2] start=i+2 break - elif expr[i:i+1] ==")": + if expr[i:i+1] ==")": break #No symbol before parameters=expr[start:endp] @@ -137,8 +137,19 @@ def parse_op(expr): symbols["ᐅᐊ"]=".join(%s)" - for i in symbols: - expr=expr.replace(i,"_____%s_____"% (i)) + #We want to avoid to parse expressions within quotes. + #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("_____")