commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8885 - grc/trunk/src/grc_gnuradio


From: jblum
Subject: [Commit-gnuradio] r8885 - grc/trunk/src/grc_gnuradio
Date: Mon, 14 Jul 2008 19:03:05 -0600 (MDT)

Author: jblum
Date: 2008-07-14 19:03:05 -0600 (Mon, 14 Jul 2008)
New Revision: 8885

Modified:
   grc/trunk/src/grc_gnuradio/expr_utils.py
Log:
ignore string contents

Modified: grc/trunk/src/grc_gnuradio/expr_utils.py
===================================================================
--- grc/trunk/src/grc_gnuradio/expr_utils.py    2008-07-15 01:02:24 UTC (rev 
8884)
+++ grc/trunk/src/grc_gnuradio/expr_utils.py    2008-07-15 01:03:05 UTC (rev 
8885)
@@ -26,14 +26,22 @@
 def expr_split(expr):
        """!
        Split up an expression by non alphanumeric characters, including 
underscore.
+       Leave strings in-tact.
+       #TODO ignore escaped quotes, use raw strings.
        @param expr an expression string
        @return a list of string tokens that form expr
        """
        toks = list()
        tok = ''
+       quote = ''
        for char in expr:
-               if char in VAR_CHARS:
+               if quote or char in VAR_CHARS:
+                       if char == quote: quote = ''
                        tok += char
+               elif char in ("'", '"'):
+                       toks.append(tok)
+                       tok = char 
+                       quote = char
                else:
                        toks.append(tok)
                        toks.append(char)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]