Commits

Georg Brandl  committed 4961124

Python lexer: recognize "yield from" directly as keyword and copy "raise from" fix to Python3Lexer.

  • Participants
  • Parent commits 8802243

Comments (0)

Files changed (1)

File pygments/lexers/agile.py

         '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|'
     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|'
         (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'] = [