[GRASS-SVN] r42484 -
grass/trunk/lib/python/ctypes/ctypesgencore/parser
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 5 01:40:40 EDT 2010
Author: glynn
Date: 2010-06-05 01:40:39 -0400 (Sat, 05 Jun 2010)
New Revision: 42484
Modified:
grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
Log:
Improve parsing of string literals
Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py 2010-06-04 20:50:08 UTC (rev 42483)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py 2010-06-05 05:40:39 UTC (rev 42484)
@@ -60,7 +60,12 @@
try:
value = value[1:-1].decode('string_escape')
except ValueError, e:
- raise ValueError("invalid \\x escape in %s" % value)
+ try:
+ value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])',
+ r'\x0\1',
+ value[1:-1]).decode('string_escape')
+ except ValueError, e:
+ raise ValueError("invalid \\x escape in %s" % value)
return str.__new__(cls, value)
# --------------------------------------------------------------------------
More information about the grass-commit
mailing list