diff options
author | Georg Brandl <georg@python.org> | 2012-08-27 07:57:38 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2012-08-27 07:57:38 +0200 |
commit | bff97c8b026c9dad45751be77a2191d82f4862fc (patch) | |
tree | 733c5905d82399406d277fc49f0a927603ab3f83 | |
parent | d0dbc3fbca48d291c64ab5f59623bfb90dfbb1ae (diff) | |
download | pygments-bff97c8b026c9dad45751be77a2191d82f4862fc.tar.gz |
Be more lax about "from" due to new syntax "raise x from y".
-rw-r--r-- | pygments/lexers/agile.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 61b05f93..b820ed16 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -135,7 +135,14 @@ class PythonLexer(RegexLexer): 'fromimport': [ (r'(?:[ \t]|\\\n)+', Text), (r'import\b', Keyword.Namespace, '#pop'), + # if None occurs here, it's "raise x from None", since None can + # never be a module name + (r'None\b', Name.Builtin.Pseudo, '#pop'), + # sadly, in "raise x from y" y will be highlighted as namespace too (r'[a-zA-Z_.][a-zA-Z0-9_.]*', Name.Namespace), + # anything else here also means "raise x from y" and is therefore + # not an error + (r'', Text, '#pop'), ], 'stringescape': [ (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|' |