summaryrefslogtreecommitdiff
path: root/sphinx/pycode/pgen2
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-04 20:02:24 +0100
committerGeorg Brandl <georg@python.org>2009-01-04 20:02:24 +0100
commit93c8edb25dbab5c219258662ab750aa346aeb0e9 (patch)
tree045aed7fe2c72e71a3d68225c75318e7691f2233 /sphinx/pycode/pgen2
parent686c154eea969fe7eecc4aec27d922d301be46fc (diff)
downloadsphinx-93c8edb25dbab5c219258662ab750aa346aeb0e9.tar.gz
Add support for decoding strings and comments to the analyzer.
Diffstat (limited to 'sphinx/pycode/pgen2')
-rw-r--r--sphinx/pycode/pgen2/literals.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/pycode/pgen2/literals.py b/sphinx/pycode/pgen2/literals.py
index 78667df0..31900291 100644
--- a/sphinx/pycode/pgen2/literals.py
+++ b/sphinx/pycode/pgen2/literals.py
@@ -63,9 +63,11 @@ escape_re = re.compile(r"\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3})")
uni_escape_re = re.compile(r"\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}|"
r"u[0-9a-fA-F]{0,4}|U[0-9a-fA-F]{0,8}|N\{.+?\})")
-def evalString(s):
+def evalString(s, encoding=None):
regex = escape_re
repl = escape
+ if encoding:
+ s = s.decode(encoding)
if s.startswith('u') or s.startswith('U'):
regex = uni_escape_re
s = s[1:]