]> xenbits.xensource.com Git - xen.git/commitdiff
tools/python: sxp parser: show empty string
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 28 Jun 2010 15:49:45 +0000 (16:49 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 28 Jun 2010 15:49:45 +0000 (16:49 +0100)
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 '')

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
tools/python/xen/xend/sxp.py

index c31f8e4d21c1517a666db1f5a6df6350a72faea4..c87270f0706934de01a3339bfb28eaa7323ff812 100644 (file)
@@ -365,6 +365,8 @@ class Parser:
 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: