All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhigang Wang <zhigang.x.wang@oracle.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH]sxp parser: show empty string
Date: Mon, 28 Jun 2010 14:13:14 +0800	[thread overview]
Message-ID: <4C283D7A.1030507@oracle.com> (raw)

[-- 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

                 reply	other threads:[~2010-06-28  6:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C283D7A.1030507@oracle.com \
    --to=zhigang.x.wang@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.