From 88de1fde2ead7a8a664f403cf8c6a29cc3f718eb Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Fri, 22 May 2026 23:54:15 +0300 Subject: Intermediate changes commit_hash:a0d2bdedf870db96a3096f257f9ad580475d6d26 --- .../python/Pygments/py3/pygments/lexers/python.py | 67 +++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) (limited to 'contrib/python/Pygments/py3/pygments/lexers/python.py') diff --git a/contrib/python/Pygments/py3/pygments/lexers/python.py b/contrib/python/Pygments/py3/pygments/lexers/python.py index 805f6ff2ac7..b296c8dbe4e 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/python.py +++ b/contrib/python/Pygments/py3/pygments/lexers/python.py @@ -4,7 +4,7 @@ Lexers for Python and related languages. - :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -55,6 +55,8 @@ class PythonLexer(RegexLexer): 'WORKSPACE', # Twisted Application infrastructure '*.tac', + # Execubot level format + '*.pye', ] mimetypes = ['text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3'] @@ -118,27 +120,27 @@ class PythonLexer(RegexLexer): include('expr'), ], 'expr': [ - # raw f-strings - ('(?i)(rf|fr)(""")', + # raw f-strings and t-strings + ('(?i)(r[ft]|[ft]r)(""")', bygroups(String.Affix, String.Double), combined('rfstringescape', 'tdqf')), - ("(?i)(rf|fr)(''')", + ("(?i)(r[ft]|[ft]r)(''')", bygroups(String.Affix, String.Single), combined('rfstringescape', 'tsqf')), - ('(?i)(rf|fr)(")', + ('(?i)(r[ft]|[ft]r)(")', bygroups(String.Affix, String.Double), combined('rfstringescape', 'dqf')), - ("(?i)(rf|fr)(')", + ("(?i)(r[ft]|[ft]r)(')", bygroups(String.Affix, String.Single), combined('rfstringescape', 'sqf')), - # non-raw f-strings - ('([fF])(""")', bygroups(String.Affix, String.Double), + # non-raw f-strings and t-strings + ('([fFtT])(""")', bygroups(String.Affix, String.Double), combined('fstringescape', 'tdqf')), - ("([fF])(''')", bygroups(String.Affix, String.Single), + ("([fFtT])(''')", bygroups(String.Affix, String.Single), combined('fstringescape', 'tsqf')), - ('([fF])(")', bygroups(String.Affix, String.Double), + ('([fFtT])(")', bygroups(String.Affix, String.Double), combined('fstringescape', 'dqf')), - ("([fF])(')", bygroups(String.Affix, String.Single), + ("([fFtT])(')", bygroups(String.Affix, String.Single), combined('fstringescape', 'sqf')), # raw bytes and strings ('(?i)(rb|br|r)(""")', @@ -861,7 +863,7 @@ class CythonLexer(RegexLexer): (r'(cp?def)(\s+)', bygroups(Keyword, Whitespace), 'cdef'), # (should actually start a block with only cdefs) (r'(cdef)(:)', bygroups(Keyword, Punctuation)), - (r'(class|struct)(\s+)', bygroups(Keyword, Whitespace), 'classname'), + (r'(class|cppclass|struct)(\s+)', bygroups(Keyword, Whitespace), 'classname'), (r'(from)(\s+)', bygroups(Keyword, Whitespace), 'fromimport'), (r'(c?import)(\s+)', bygroups(Keyword, Whitespace), 'import'), include('builtins'), @@ -879,37 +881,38 @@ class CythonLexer(RegexLexer): ], 'keywords': [ (words(( - 'assert', 'async', 'await', 'break', 'by', 'continue', 'ctypedef', 'del', 'elif', - 'else', 'except', 'except?', 'exec', 'finally', 'for', 'fused', 'gil', - 'global', 'if', 'include', 'lambda', 'nogil', 'pass', 'print', - 'raise', 'return', 'try', 'while', 'yield', 'as', 'with'), suffix=r'\b'), + 'assert', 'async', 'await', 'break', 'by', 'continue', 'ctypedef', 'del', + 'elif', 'else', 'except', 'except?', 'exec', 'finally', 'for', 'fused', 'gil', + 'global', 'if', 'include', 'lambda', 'namespace', 'new', 'noexcept','nogil', + 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'as', 'with'), + suffix=r'\b'), Keyword), + (words(('True', 'False', 'None', 'NULL'), suffix=r'\b'), Keyword.Constant), (r'(DEF|IF|ELIF|ELSE)\b', Comment.Preproc), ], 'builtins': [ (words(( '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bint', - 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', + 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'char', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr', - 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', + 'dict', 'dir', 'divmod', 'double', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max', - 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'Py_ssize_t', - 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', - 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', - 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned', - 'vars', 'xrange', 'zip'), prefix=r'(?