Skip to contentSkip to conversation

sxp parser: show empty string

PATCH New Zhigang Wang 1 participant 1 message Jun 28, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sxp parser: show empty string

Hi,

This patch makes the sxp parser show empty string.

Test case:

import sxp

sxp.show(sxp.from_string('(a "")'))
sxp.show(sxp.from_string("(a '')"))

Without this patch:

(a )(a )

With this patch:

(a '')(a '')

Thanks,

Zhigang

tools/python/xen/xend/sxp.py +2 -0
diff -r b622e411eef8 tools/python/xen/xend/sxp.py
@@ -365,6 +365,8 @@
 def atomp(sxpr):
     """Check if an sxpr is an atom.
     """
+    if sxpr == '':
+        return 0
     if sxpr.isalnum() or sxpr == '@':
         return 1
     for c in sxpr:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel