diff options
author | Georg Brandl <georg@python.org> | 2012-09-30 18:12:31 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2012-09-30 18:12:31 +0200 |
commit | 61d5c1dd07968061eb4c9ca8db4d0f566495886c (patch) | |
tree | 5c35e3fb6415470d05a55b7affcacc93bc9e2a21 | |
parent | 3aa885ff0956b8a202d72f6e5cc74a4d25f51163 (diff) | |
download | pygments-61d5c1dd07968061eb4c9ca8db4d0f566495886c.tar.gz |
Python lexer: recognize "yield from" directly as keyword and copy "raise from" fix to Python3Lexer.
-rw-r--r-- | pygments/lexers/agile.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index ae2456ff..85e157fb 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -76,7 +76,7 @@ class PythonLexer(RegexLexer): 'keywords': [ (r'(assert|break|continue|del|elif|else|except|exec|' r'finally|for|global|if|lambda|pass|print|raise|' - r'return|try|while|yield|as|with)\b', Keyword), + r'return|try|while|yield(\s+from)?|as|with)\b', Keyword), ], 'builtins': [ (r'(?<!\.)(__import__|abs|all|any|apply|basestring|bin|bool|buffer|' @@ -207,7 +207,8 @@ class Python3Lexer(RegexLexer): tokens['keywords'] = [ (r'(assert|break|continue|del|elif|else|except|' r'finally|for|global|if|lambda|pass|raise|nonlocal|' - r'return|try|while|yield|as|with|True|False|None)\b', Keyword), + r'return|try|while|yield(\s+from)?|as|with|True|False|None)\b', + Keyword), ] tokens['builtins'] = [ (r'(?<!\.)(__import__|abs|all|any|bin|bool|bytearray|bytes|' @@ -263,6 +264,7 @@ class Python3Lexer(RegexLexer): (r'(\s+)(import)\b', bygroups(Text, Keyword), '#pop'), (r'\.', Name.Namespace), (uni_name, Name.Namespace), + (r'', Text, '#pop'), ] # don't highlight "%s" substitutions tokens['strings'] = [ |