xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]sxp parser: show empty string
@ 2010-06-28  6:13 Zhigang Wang
  0 siblings, 0 replies; only message in thread
From: Zhigang Wang @ 2010-06-28  6:13 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

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 '')

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>

Thanks,

Zhigang

[-- Attachment #2: xen-unstable-sxp-parser-show-empty-string.patch --]
[-- Type: text/plain, Size: 381 bytes --]

diff -r b622e411eef8 tools/python/xen/xend/sxp.py
--- a/tools/python/xen/xend/sxp.py	Thu Jun 24 21:56:03 2010 +0100
+++ b/tools/python/xen/xend/sxp.py	Mon Jun 28 14:09:33 2010 +0800
@@ -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:

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-28  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28  6:13 [PATCH]sxp parser: show empty string Zhigang Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).