1. Georg Brandl
  2. pygments-main

Commits

thatch  committed 7713c50

489: support unicode and raw docstrings in Python

  • Participants
  • Parent commits d902331
  • Branches trunk

Comments (0)

Files changed (2)

File pygments/lexers/agile.py

View file
     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),

File tests/examplefiles/unicodedoc.py

View file
+def foo():
+    ur"""unicode-raw"""
+
+def bar():
+    u"""unicode"""
+
+def baz():
+    r'raw'
+
+def zap():
+    """docstring"""