From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhigang Wang Subject: [PATCH]sxp parser: show empty string Date: Mon, 28 Jun 2010 14:13:14 +0800 Message-ID: <4C283D7A.1030507@oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020001020008020301060800" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020001020008020301060800 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 Thanks, Zhigang --------------020001020008020301060800 Content-Type: text/plain; name="xen-unstable-sxp-parser-show-empty-string.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-unstable-sxp-parser-show-empty-string.patch" 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: --------------020001020008020301060800 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020001020008020301060800--