diff options
author | Rafael H. Schloming <rhs@apache.org> | 2009-11-13 15:59:54 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2009-11-13 15:59:54 +0000 |
commit | 53d1cf10d13f65c3ae8b953fa6de5e8cc377042c (patch) | |
tree | 79b2ebd34de2bc6df2a6417064804cddfb2c3614 /python/qpid/address.py | |
parent | 4e476344c551c4c25e27047316690ee5b80dcefb (diff) | |
download | qpid-python-53d1cf10d13f65c3ae8b953fa6de5e8cc377042c.tar.gz |
fixed unicode and hex escapes to allow a-fA-F, and added tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@835893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/address.py')
-rw-r--r-- | python/qpid/address.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/python/qpid/address.py b/python/qpid/address.py index 6ad6f23255..93336763f4 100644 --- a/python/qpid/address.py +++ b/python/qpid/address.py @@ -40,7 +40,7 @@ COMMA = Type("COMMA", r",") NUMBER = Type("NUMBER", r'[+-]?[0-9]*\.?[0-9]+') ID = Type("ID", r'[a-zA-Z_][a-zA-Z0-9_]*') STRING = Type("STRING", r""""(?:[^\\"]|\\.)*"|'(?:[^\\']|\\.)*'""") -ESC = Type("ESC", r"\\[^ux]|\\x[0-9][0-9]|\\u[0-9][0-9][0-9][0-0]") +ESC = Type("ESC", r"\\[^ux]|\\x[0-9a-fA-F][0-9a-fA-F]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]") SYM = Type("SYM", r"[.#*%@$^!+-]") WSPACE = Type("WSPACE", r"[ \n\r\t]+") EOF = Type("EOF") @@ -106,8 +106,10 @@ def tok2str(tok): if tok.type is STRING: return eval(tok.value) elif tok.type is ESC: - if tok.value[1] in ("x", "u"): + if tok.value[1] == "x": return eval('"%s"' % tok.value) + elif tok.value[1] == "u": + return eval('u"%s"' % tok.value) else: return tok.value[1] else: |