From: Ian Jackson Date: Mon, 28 Jun 2010 15:49:45 +0000 (+0100) Subject: tools/python: sxp parser: show empty string X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11873 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f3fdbe735910281bb939ca8d650b02bcd160f15e;p=xen.git 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 --- diff --git a/tools/python/xen/xend/sxp.py b/tools/python/xen/xend/sxp.py index c31f8e4d21..c87270f070 100644 --- a/tools/python/xen/xend/sxp.py +++ b/tools/python/xen/xend/sxp.py @@ -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: