summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2022-12-04 16:20:15 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2022-12-04 16:20:15 +0100
commitcdfa8e0ad46c1f5c3d05276ba7130aeb1bfcde35 (patch)
treeb41f5154c16f332d353f0bc7e7c0a21ea278aa41 /pygments
parent3f9eb7ac4423eeb7d102c08189381d24d119aea7 (diff)
downloadpygments-git-cdfa8e0ad46c1f5c3d05276ba7130aeb1bfcde35.tar.gz
Improve whitespace handling in PythonTracebackLexer.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/python.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py
index b959525a..64f260d1 100644
--- a/pygments/lexers/python.py
+++ b/pygments/lexers/python.py
@@ -15,7 +15,7 @@ from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
default, words, combined, do_insertions, this, line_re
from pygments.util import get_bool_opt, shebang_matches
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation, Generic, Other, Error
+ Number, Punctuation, Generic, Other, Error, Whitespace
from pygments import unistring as uni
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer',
@@ -753,24 +753,24 @@ class PythonTracebackLexer(RegexLexer):
],
'intb': [
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
- bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)),
+ bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)),
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
- bygroups(Text, Name.Builtin, Text, Number, Text)),
+ bygroups(Text, Name.Builtin, Text, Number, Whitespace)),
(r'^( )(.+)(\n)',
- bygroups(Text, using(PythonLexer), Text), 'markers'),
+ bygroups(Whitespace, using(PythonLexer), Whitespace), 'markers'),
(r'^([ \t]*)(\.\.\.)(\n)',
- bygroups(Text, Comment, Text)), # for doctests...
+ bygroups(Whitespace, Comment, Whitespace)), # for doctests...
(r'^([^:]+)(: )(.+)(\n)',
- bygroups(Generic.Error, Text, Name, Text), '#pop'),
+ bygroups(Generic.Error, Text, Name, Whitespace), '#pop'),
(r'^([a-zA-Z_][\w.]*)(:?\n)',
- bygroups(Generic.Error, Text), '#pop')
+ bygroups(Generic.Error, Whitespace), '#pop')
],
'markers': [
# Either `PEP 657 <https://www.python.org/dev/peps/pep-0657/>`
# error locations in Python 3.11+, or single-caret markers
# for syntax errors before that.
(r'^( {4,})([~^]+)(\n)',
- bygroups(Text, Punctuation.Marker, Text),
+ bygroups(Whitespace, Punctuation.Marker, Whitespace),
'#pop'),
default('#pop'),
],