summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthatch <devnull@localhost>2010-05-05 17:47:20 -0700
committerthatch <devnull@localhost>2010-05-05 17:47:20 -0700
commit3add5eeb84b8ce28e5f7af9064990c5c7977ee5a (patch)
tree16762ae72a36c0fa8075e8f52437964b84e7afd5
parentb14c9a5b9d0dfff0998a4028b0f416c659a2b43d (diff)
downloadpygments-3add5eeb84b8ce28e5f7af9064990c5c7977ee5a.tar.gz
489: support unicode and raw docstrings in Python
-rw-r--r--pygments/lexers/agile.py4
-rw-r--r--tests/examplefiles/unicodedoc.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py
index fb07cf17..7ac71b8e 100644
--- a/pygments/lexers/agile.py
+++ b/pygments/lexers/agile.py
@@ -47,8 +47,8 @@ class PythonLexer(RegexLexer):
tokens = {
'root': [
(r'\n', Text),
- (r'^(\s*)("""(?:.|\n)*?""")', bygroups(Text, String.Doc)),
- (r"^(\s*)('''(?:.|\n)*?''')", bygroups(Text, String.Doc)),
+ (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)),
+ (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)),
(r'[^\S\n]+', Text),
(r'#.*$', Comment),
(r'[]{}:(),;[]', Punctuation),
diff --git a/tests/examplefiles/unicodedoc.py b/tests/examplefiles/unicodedoc.py
new file mode 100644
index 00000000..9d3db0c8
--- /dev/null
+++ b/tests/examplefiles/unicodedoc.py
@@ -0,0 +1,11 @@
+def foo():
+ ur"""unicode-raw"""
+
+def bar():
+ u"""unicode"""
+
+def baz():
+ r'raw'
+
+def zap():
+ """docstring"""