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

[Xen-changelog] [xen-unstable] tools/python: sxp parser: show empty string



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1277740185 -3600
# Node ID a37de3ca134140b23797bbda6967ab0db670225a
# Parent  bf64e1081333696c68c9430cbc32c8bd6ee18796
tools/python: sxp parser: show empty string

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@xxxxxxxxxx>
---
 tools/python/xen/xend/sxp.py |    2 ++
 1 files changed, 2 insertions(+)

diff -r bf64e1081333 -r a37de3ca1341 tools/python/xen/xend/sxp.py
--- a/tools/python/xen/xend/sxp.py      Fri Jun 25 16:05:20 2010 +0100
+++ b/tools/python/xen/xend/sxp.py      Mon Jun 28 16:49:45 2010 +0100
@@ -365,6 +365,8 @@ def atomp(sxpr):
 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.