diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-12-09 00:19:25 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-12-09 00:50:41 +0300 |
commit | 83b8a2f9228353759e59a093cb3c1270ea2c9d5b (patch) | |
tree | a90f4f91780c0613bea19f33ff8af8e93a335e8b | |
parent | 460528e80f26d04487dc242b7333d45bbeb43a4d (diff) | |
download | ydb-83b8a2f9228353759e59a093cb3c1270ea2c9d5b.tar.gz |
Update contrib/python/Pygments/py3 to 2.17.2
85 files changed, 1805 insertions, 492 deletions
diff --git a/contrib/python/Pygments/py3/.dist-info/METADATA b/contrib/python/Pygments/py3/.dist-info/METADATA index 45897ce456..4318a7b72f 100644 --- a/contrib/python/Pygments/py3/.dist-info/METADATA +++ b/contrib/python/Pygments/py3/.dist-info/METADATA @@ -1,16 +1,18 @@ Metadata-Version: 2.1 Name: Pygments -Version: 2.16.1 +Version: 2.17.2 Summary: Pygments is a syntax highlighting package written in Python. -Author-email: Georg Brandl <georg@python.org> -Maintainer: Matthäus G. Chajdas -Maintainer-email: Georg Brandl <georg@python.org>, Jean Abou Samra <jean@abou-samra.fr> -License: BSD-2-Clause Project-URL: Homepage, https://pygments.org Project-URL: Documentation, https://pygments.org/docs Project-URL: Source, https://github.com/pygments/pygments Project-URL: Bug Tracker, https://github.com/pygments/pygments/issues Project-URL: Changelog, https://github.com/pygments/pygments/blob/master/CHANGES +Author-email: Georg Brandl <georg@python.org> +Maintainer: Matthäus G. Chajdas +Maintainer-email: Georg Brandl <georg@python.org>, Jean Abou Samra <jean@abou-samra.fr> +License: BSD-2-Clause +License-File: AUTHORS +License-File: LICENSE Keywords: syntax highlighting Classifier: Development Status :: 6 - Mature Classifier: Intended Audience :: Developers @@ -25,16 +27,17 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Text Processing :: Filters Classifier: Topic :: Utilities Requires-Python: >=3.7 -Description-Content-Type: text/x-rst -License-File: LICENSE -License-File: AUTHORS Provides-Extra: plugins -Requires-Dist: importlib-metadata ; (python_version < "3.8") and extra == 'plugins' +Requires-Dist: importlib-metadata; python_version < '3.8' and extra == 'plugins' +Provides-Extra: windows-terminal +Requires-Dist: colorama>=0.4.6; extra == 'windows-terminal' +Description-Content-Type: text/x-rst Pygments ~~~~~~~~ diff --git a/contrib/python/Pygments/py3/AUTHORS b/contrib/python/Pygments/py3/AUTHORS index d0a766ad51..0e9f512718 100644 --- a/contrib/python/Pygments/py3/AUTHORS +++ b/contrib/python/Pygments/py3/AUTHORS @@ -140,6 +140,7 @@ Other contributors, listed alphabetically, are: * Sylvestre Ledru -- Scilab lexer * Chee Sing Lee -- Flatline lexer * Mark Lee -- Vala lexer +* Thomas Linder Puls -- Visual Prolog lexer * Pete Lomax -- Phix lexer * Valentin Lorentz -- C++ lexer improvements * Ben Mabey -- Gherkin lexer @@ -270,6 +271,7 @@ Other contributors, listed alphabetically, are: * Marc Auberer -- Spice lexer * Amr Hesham -- Carbon lexer * diskdance -- Wikitext lexer +* vanillajonathan -- PRQL lexer * Nikolay Antipov -- OpenSCAD lexer * Markus Meyer, Nextron Systems -- YARA lexer diff --git a/contrib/python/Pygments/py3/pygments/__init__.py b/contrib/python/Pygments/py3/pygments/__init__.py index 2c1363684f..6b77c465c3 100644 --- a/contrib/python/Pygments/py3/pygments/__init__.py +++ b/contrib/python/Pygments/py3/pygments/__init__.py @@ -26,7 +26,7 @@ """ from io import StringIO, BytesIO -__version__ = '2.16.1' +__version__ = '2.17.2' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/contrib/python/Pygments/py3/pygments/formatters/__init__.py b/contrib/python/Pygments/py3/pygments/formatters/__init__.py index 67caccf16b..6e482a1b73 100644 --- a/contrib/python/Pygments/py3/pygments/formatters/__init__.py +++ b/contrib/python/Pygments/py3/pygments/formatters/__init__.py @@ -131,7 +131,7 @@ def get_formatter_for_filename(fn, **options): if name not in _formatter_cache: _load_formatters(modname) return _formatter_cache[name](**options) - for cls in find_plugin_formatters(): + for _name, cls in find_plugin_formatters(): for filename in cls.filenames: if _fn_matches(fn, filename): return cls(**options) diff --git a/contrib/python/Pygments/py3/pygments/formatters/html.py b/contrib/python/Pygments/py3/pygments/formatters/html.py index 4596dcdd1e..df2469e2a5 100644 --- a/contrib/python/Pygments/py3/pygments/formatters/html.py +++ b/contrib/python/Pygments/py3/pygments/formatters/html.py @@ -323,6 +323,7 @@ class HtmlFormatter(Formatter): If set to the path of a ctags file, wrap names in anchor tags that link to their definitions. `lineanchors` should be used, and the tags file should specify line numbers (see the `-n` option to ctags). + The tags file is assumed to be encoded in UTF-8. .. versionadded:: 1.6 @@ -908,7 +909,7 @@ class HtmlFormatter(Formatter): def _lookup_ctag(self, token): entry = ctags.TagEntry() if self._ctags.find(entry, token.encode(), 0): - return entry['file'], entry['lineNumber'] + return entry['file'].decode(), entry['lineNumber'] else: return None, None diff --git a/contrib/python/Pygments/py3/pygments/lexer.py b/contrib/python/Pygments/py3/pygments/lexer.py index 93d90bfbe6..eb5403e798 100644 --- a/contrib/python/Pygments/py3/pygments/lexer.py +++ b/contrib/python/Pygments/py3/pygments/lexer.py @@ -199,20 +199,9 @@ class Lexer(metaclass=LexerMeta): it's the same as if the return values was ``0.0``. """ - def get_tokens(self, text, unfiltered=False): - """ - This method is the basic interface of a lexer. It is called by - the `highlight()` function. It must process the text and return an - iterable of ``(tokentype, value)`` pairs from `text`. + def _preprocess_lexer_input(self, text): + """Apply preprocessing such as decoding the input, removing BOM and normalizing newlines.""" - Normally, you don't need to override this method. The default - implementation processes the options recognized by all lexers - (`stripnl`, `stripall` and so on), and then yields all tokens - from `get_tokens_unprocessed()`, with the ``index`` dropped. - - If `unfiltered` is set to `True`, the filtering mechanism is - bypassed even if filters are defined. - """ if not isinstance(text, str): if self.encoding == 'guess': text, _ = guess_decode(text) @@ -255,6 +244,24 @@ class Lexer(metaclass=LexerMeta): if self.ensurenl and not text.endswith('\n'): text += '\n' + return text + + def get_tokens(self, text, unfiltered=False): + """ + This method is the basic interface of a lexer. It is called by + the `highlight()` function. It must process the text and return an + iterable of ``(tokentype, value)`` pairs from `text`. + + Normally, you don't need to override this method. The default + implementation processes the options recognized by all lexers + (`stripnl`, `stripall` and so on), and then yields all tokens + from `get_tokens_unprocessed()`, with the ``index`` dropped. + + If `unfiltered` is set to `True`, the filtering mechanism is + bypassed even if filters are defined. + """ + text = self._preprocess_lexer_input(text) + def streamer(): for _, t, v in self.get_tokens_unprocessed(text): yield t, v diff --git a/contrib/python/Pygments/py3/pygments/lexers/__init__.py b/contrib/python/Pygments/py3/pygments/lexers/__init__.py index efe99a0c66..5701be7b6c 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/__init__.py +++ b/contrib/python/Pygments/py3/pygments/lexers/__init__.py @@ -22,6 +22,7 @@ from pygments.util import ClassNotFound, guess_decode COMPAT = { 'Python3Lexer': 'PythonLexer', 'Python3TracebackLexer': 'PythonTracebackLexer', + 'LeanLexer': 'Lean3Lexer', } __all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class', diff --git a/contrib/python/Pygments/py3/pygments/lexers/_mapping.py b/contrib/python/Pygments/py3/pygments/lexers/_mapping.py index 800fff193e..aaec80232a 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/_mapping.py +++ b/contrib/python/Pygments/py3/pygments/lexers/_mapping.py @@ -247,9 +247,10 @@ LEXERS = { 'JsgfLexer': ('pygments.lexers.grammar_notation', 'JSGF', ('jsgf',), ('*.jsgf',), ('application/jsgf', 'application/x-jsgf', 'text/jsgf')), 'JsonBareObjectLexer': ('pygments.lexers.data', 'JSONBareObject', (), (), ()), 'JsonLdLexer': ('pygments.lexers.data', 'JSON-LD', ('jsonld', 'json-ld'), ('*.jsonld',), ('application/ld+json',)), - 'JsonLexer': ('pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', 'Pipfile.lock'), ('application/json', 'application/json-object')), + 'JsonLexer': ('pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', '*.jsonl', '*.ndjson', 'Pipfile.lock'), ('application/json', 'application/json-object', 'application/x-ndjson', 'application/jsonl', 'application/json-seq')), 'JsonnetLexer': ('pygments.lexers.jsonnet', 'Jsonnet', ('jsonnet',), ('*.jsonnet', '*.libsonnet'), ()), 'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)), + 'JsxLexer': ('pygments.lexers.jsx', 'JSX', ('jsx', 'react'), ('*.jsx', '*.react'), ('text/jsx', 'text/typescript-jsx')), 'JuliaConsoleLexer': ('pygments.lexers.julia', 'Julia console', ('jlcon', 'julia-repl'), (), ()), 'JuliaLexer': ('pygments.lexers.julia', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')), 'JuttleLexer': ('pygments.lexers.javascript', 'Juttle', ('juttle',), ('*.juttle',), ('application/juttle', 'application/x-juttle', 'text/x-juttle', 'text/juttle')), @@ -260,13 +261,16 @@ LEXERS = { 'KokaLexer': ('pygments.lexers.haskell', 'Koka', ('koka',), ('*.kk', '*.kki'), ('text/x-koka',)), 'KotlinLexer': ('pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt', '*.kts'), ('text/x-kotlin',)), 'KuinLexer': ('pygments.lexers.kuin', 'Kuin', ('kuin',), ('*.kn',), ()), + 'KustoLexer': ('pygments.lexers.kusto', 'Kusto', ('kql', 'kusto'), ('*.kql', '*.kusto', '.csl'), ()), 'LSLLexer': ('pygments.lexers.scripting', 'LSL', ('lsl',), ('*.lsl',), ('text/x-lsl',)), 'LassoCssLexer': ('pygments.lexers.templates', 'CSS+Lasso', ('css+lasso',), (), ('text/css+lasso',)), 'LassoHtmlLexer': ('pygments.lexers.templates', 'HTML+Lasso', ('html+lasso',), (), ('text/html+lasso', 'application/x-httpd-lasso', 'application/x-httpd-lasso[89]')), 'LassoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Lasso', ('javascript+lasso', 'js+lasso'), (), ('application/x-javascript+lasso', 'text/x-javascript+lasso', 'text/javascript+lasso')), 'LassoLexer': ('pygments.lexers.javascript', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)), 'LassoXmlLexer': ('pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)), - 'LeanLexer': ('pygments.lexers.theorem', 'Lean', ('lean',), ('*.lean',), ('text/x-lean',)), + 'LdaprcLexer': ('pygments.lexers.ldap', 'LDAP configuration file', ('ldapconf', 'ldaprc'), ('.ldaprc', 'ldaprc', 'ldap.conf'), ('text/x-ldapconf',)), + 'LdifLexer': ('pygments.lexers.ldap', 'LDIF', ('ldif',), ('*.ldif',), ('text/x-ldif',)), + 'Lean3Lexer': ('pygments.lexers.lean', 'Lean', ('lean', 'lean3'), ('*.lean',), ('text/x-lean', 'text/x-lean3')), 'LessCssLexer': ('pygments.lexers.css', 'LessCss', ('less',), ('*.less',), ('text/x-less-css',)), 'LighttpdConfLexer': ('pygments.lexers.configs', 'Lighttpd configuration file', ('lighttpd', 'lighty'), ('lighttpd.conf',), ('text/x-lighttpd-conf',)), 'LilyPondLexer': ('pygments.lexers.lilypond', 'LilyPond', ('lilypond',), ('*.ly',), ()), @@ -388,6 +392,7 @@ LEXERS = { 'PromQLLexer': ('pygments.lexers.promql', 'PromQL', ('promql',), ('*.promql',), ()), 'PropertiesLexer': ('pygments.lexers.configs', 'Properties', ('properties', 'jproperties'), ('*.properties',), ('text/x-java-properties',)), 'ProtoBufLexer': ('pygments.lexers.dsls', 'Protocol Buffer', ('protobuf', 'proto'), ('*.proto',), ()), + 'PrqlLexer': ('pygments.lexers.prql', 'PRQL', ('prql',), ('*.prql',), ('application/prql', 'application/x-prql')), 'PsyshConsoleLexer': ('pygments.lexers.php', 'PsySH console session for PHP', ('psysh',), (), ()), 'PtxLexer': ('pygments.lexers.ptx', 'PTX', ('ptx',), ('*.ptx',), ('text/x-ptx',)), 'PugLexer': ('pygments.lexers.html', 'Pug', ('pug', 'jade'), ('*.pug', '*.jade'), ('text/x-pug', 'text/x-jade')), @@ -396,7 +401,7 @@ LEXERS = { 'Python2Lexer': ('pygments.lexers.python', 'Python 2.x', ('python2', 'py2'), (), ('text/x-python2', 'application/x-python2')), 'Python2TracebackLexer': ('pygments.lexers.python', 'Python 2.x Traceback', ('py2tb',), ('*.py2tb',), ('text/x-python2-traceback',)), 'PythonConsoleLexer': ('pygments.lexers.python', 'Python console session', ('pycon',), (), ('text/x-python-doctest',)), - 'PythonLexer': ('pygments.lexers.python', 'Python', ('python', 'py', 'sage', 'python3', 'py3'), ('*.py', '*.pyw', '*.pyi', '*.jy', '*.sage', '*.sc', 'SConstruct', 'SConscript', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', '*.tac'), ('text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3')), + 'PythonLexer': ('pygments.lexers.python', 'Python', ('python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark'), ('*.py', '*.pyw', '*.pyi', '*.jy', '*.sage', '*.sc', 'SConstruct', 'SConscript', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', '*.tac'), ('text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3')), 'PythonTracebackLexer': ('pygments.lexers.python', 'Python Traceback', ('pytb', 'py3tb'), ('*.pytb', '*.py3tb'), ('text/x-python-traceback', 'text/x-python3-traceback')), 'PythonUL4Lexer': ('pygments.lexers.ul4', 'Python+UL4', ('py+ul4',), ('*.pyul4',), ()), 'QBasicLexer': ('pygments.lexers.basic', 'QBasic', ('qbasic', 'basic'), ('*.BAS', '*.bas'), ('text/basic',)), @@ -488,7 +493,7 @@ LEXERS = { 'SystemdLexer': ('pygments.lexers.configs', 'Systemd', ('systemd',), ('*.service', '*.socket', '*.device', '*.mount', '*.automount', '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope'), ()), 'TAPLexer': ('pygments.lexers.testing', 'TAP', ('tap',), ('*.tap',), ()), 'TNTLexer': ('pygments.lexers.tnt', 'Typographic Number Theory', ('tnt',), ('*.tnt',), ()), - 'TOMLLexer': ('pygments.lexers.configs', 'TOML', ('toml',), ('*.toml', 'Pipfile', 'poetry.lock'), ()), + 'TOMLLexer': ('pygments.lexers.configs', 'TOML', ('toml',), ('*.toml', 'Pipfile', 'poetry.lock'), ('application/toml',)), 'Tads3Lexer': ('pygments.lexers.int_fiction', 'TADS 3', ('tads3',), ('*.t',), ()), 'TalLexer': ('pygments.lexers.tal', 'Tal', ('tal', 'uxntal'), ('*.tal',), ('text/x-uxntal',)), 'TasmLexer': ('pygments.lexers.asm', 'TASM', ('tasm',), ('*.asm', '*.ASM', '*.tasm'), ('text/x-tasm',)), @@ -540,6 +545,9 @@ LEXERS = { 'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)), 'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)), 'VimLexer': ('pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)), + 'VisualPrologGrammarLexer': ('pygments.lexers.vip', 'Visual Prolog Grammar', ('visualprologgrammar',), ('*.vipgrm',), ()), + 'VisualPrologLexer': ('pygments.lexers.vip', 'Visual Prolog', ('visualprolog',), ('*.pro', '*.cl', '*.i', '*.pack', '*.ph'), ()), + 'VyperLexer': ('pygments.lexers.vyper', 'Vyper', ('vyper',), ('*.vy',), ()), 'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()), 'WatLexer': ('pygments.lexers.webassembly', 'WebAssembly', ('wast', 'wat'), ('*.wat', '*.wast'), ()), 'WebIDLLexer': ('pygments.lexers.webidl', 'Web IDL', ('webidl',), ('*.webidl',), ()), diff --git a/contrib/python/Pygments/py3/pygments/lexers/algebra.py b/contrib/python/Pygments/py3/pygments/lexers/algebra.py index dc4aedd2cd..95f17540ef 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/algebra.py +++ b/contrib/python/Pygments/py3/pygments/lexers/algebra.py @@ -25,7 +25,7 @@ class GAPLexer(RegexLexer): .. versionadded:: 2.0 """ name = 'GAP' - url = 'http://www.gap-system.org' + url = 'https://www.gap-system.org' aliases = ['gap'] filenames = ['*.g', '*.gd', '*.gi', '*.gap'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/configs.py b/contrib/python/Pygments/py3/pygments/lexers/configs.py index 5936dd1971..6c5e5425a5 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/configs.py +++ b/contrib/python/Pygments/py3/pygments/lexers/configs.py @@ -542,15 +542,14 @@ class SquidConfLexer(RegexLexer): "dst", "time", "dstdomain", "ident", "snmp_community", ) - ip_re = ( - r'(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|' - r'0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|' - r'0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|' - r':(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}' - r'(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|' - r'(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-4]|2[0-4]\d|1\d\d|' - r'[1-9]?\d)){3}))' - ) + ipv4_group = r'(\d+|0x[0-9a-f]+)' + ipv4 = rf'({ipv4_group}(\.{ipv4_group}){{3}})' + ipv6_group = r'([0-9a-f]{0,4})' + ipv6 = rf'({ipv6_group}(:{ipv6_group}){{1,7}})' + bare_ip = rf'({ipv4}|{ipv6})' + # XXX: /integer is a subnet mark, but what is /IP ? + # There is no test where it is used. + ip = rf'{bare_ip}(/({bare_ip}|\d+))?' tokens = { 'root': [ @@ -563,7 +562,7 @@ class SquidConfLexer(RegexLexer): (words(actions_stats, prefix=r'stats/', suffix=r'\b'), String), (words(actions_log, prefix=r'log/', suffix=r'='), String), (words(acls, prefix=r'\b', suffix=r'\b'), Keyword), - (ip_re + r'(?:/(?:' + ip_re + r'|\b\d+\b))?', Number.Float), + (ip, Number.Float), (r'(?:\b\d+\b(?:-\b\d+|%)?)', Number), (r'\S+', Text), ], @@ -1114,54 +1113,171 @@ class AugeasLexer(RegexLexer): class TOMLLexer(RegexLexer): """ - Lexer for TOML, a simple language - for config files. + Lexer for TOML, a simple language for config files. .. versionadded:: 2.4 """ name = 'TOML' - url = 'https://github.com/toml-lang/toml' aliases = ['toml'] filenames = ['*.toml', 'Pipfile', 'poetry.lock'] + mimetypes = ['application/toml'] + url = 'https://toml.io' + + # Based on the TOML spec: https://toml.io/en/v1.0.0 + + # The following is adapted from CPython's tomllib: + _time = r"\d\d:\d\d:\d\d(\.\d+)?" + _datetime = rf"""(?x) + \d\d\d\d-\d\d-\d\d # date, e.g., 1988-10-27 + ( + [Tt ] {_time} # optional time + ( + [Zz]|[+-]\d\d:\d\d # optional time offset + )? + )? + """ tokens = { 'root': [ - # Table - (r'^(\s*)(\[.*?\])$', bygroups(Whitespace, Keyword)), + # Note that we make an effort in order to distinguish + # moments at which we're parsing a key and moments at + # which we're parsing a value. In the TOML code + # + # 1234 = 1234 + # + # the first "1234" should be Name, the second Integer. + + # Whitespace + (r'\s+', Whitespace), - # Basics, comments, strings - (r'[ \t]+', Whitespace), - (r'\n', Whitespace), - (r'#.*?$', Comment.Single), - # Basic string - (r'"(\\\\|\\[^\\]|[^"\\])*"', String), - # Literal string - (r'\'\'\'(.*)\'\'\'', String), - (r'\'[^\']*\'', String), - (r'(true|false)$', Keyword.Constant), - (r'[a-zA-Z_][\w\-]*', Name), - - # Datetime - # TODO this needs to be expanded, as TOML is rather flexible: - # https://github.com/toml-lang/toml#offset-date-time - (r'\d{4}-\d{2}-\d{2}(?:T| )\d{2}:\d{2}:\d{2}(?:Z|[-+]\d{2}:\d{2})', Number.Integer), - - # Numbers - (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float), - (r'\d+[eE][+-]?[0-9]+j?', Number.Float), - # Handle +-inf, +-infinity, +-nan - (r'[+-]?(?:(inf(?:inity)?)|nan)', Number.Float), - (r'[+-]?\d+', Number.Integer), - - # Punctuation - (r'[]{}:(),;[]', Punctuation), + # Comment + (r'#.*', Comment.Single), + + # Assignment keys + include('key'), + + # After "=", find a value + (r'(=)(\s*)', bygroups(Operator, Whitespace), 'value'), + + # Table header + (r'\[\[?', Keyword, 'table-key'), + ], + 'key': [ + # Start of bare key (only ASCII is allowed here). + (r'[A-Za-z0-9_-]+', Name), + # Quoted key + (r'"', String.Double, 'basic-string'), + (r"'", String.Single, 'literal-string'), + # Dots act as separators in keys (r'\.', Punctuation), + ], + 'table-key': [ + # This is like 'key', but highlights the name components + # and separating dots as Keyword because it looks better + # when the whole table header is Keyword. We do highlight + # strings as strings though. + # Start of bare key (only ASCII is allowed here). + (r'[A-Za-z0-9_-]+', Keyword), + (r'"', String.Double, 'basic-string'), + (r"'", String.Single, 'literal-string'), + (r'\.', Keyword), + (r'\]\]?', Keyword, '#pop'), + + # Inline whitespace allowed + (r'[ \t]+', Whitespace), + ], + 'value': [ + # Datetime, baretime + (_datetime, Literal.Date, '#pop'), + (_time, Literal.Date, '#pop'), - # Operators - (r'=', Operator) + # Recognize as float if there is a fractional part + # and/or an exponent. + (r'[+-]?\d[0-9_]*[eE][+-]?\d[0-9_]*', Number.Float, '#pop'), + (r'[+-]?\d[0-9_]*\.\d[0-9_]*([eE][+-]?\d[0-9_]*)?', + Number.Float, '#pop'), - ] + # Infinities and NaN + (r'[+-]?(inf|nan)', Number.Float, '#pop'), + + # Integers + (r'-?0b[01_]+', Number.Bin, '#pop'), + (r'-?0o[0-7_]+', Number.Oct, '#pop'), + (r'-?0x[0-9a-fA-F_]+', Number.Hex, '#pop'), + (r'[+-]?[0-9_]+', Number.Integer, '#pop'), + + # Strings + (r'"""', String.Double, ('#pop', 'multiline-basic-string')), + (r'"', String.Double, ('#pop', 'basic-string')), + (r"'''", String.Single, ('#pop', 'multiline-literal-string')), + (r"'", String.Single, ('#pop', 'literal-string')), + + # Booleans + (r'true|false', Keyword.Constant, '#pop'), + + # Start of array + (r'\[', Punctuation, ('#pop', 'array')), + + # Start of inline table + (r'\{', Punctuation, ('#pop', 'inline-table')), + ], + 'array': [ + # Whitespace, including newlines, is ignored inside arrays, + # and comments are allowed. + (r'\s+', Whitespace), + (r'#.*', Comment.Single), + + # Delimiters + (r',', Punctuation), + + # End of array + (r'\]', Punctuation, '#pop'), + + # Parse a value and come back + default('value'), + ], + 'inline-table': [ + # Note that unlike inline arrays, inline tables do not + # allow newlines or comments. + (r'[ \t]+', Whitespace), + + # Keys + include('key'), + + # Values + (r'(=)(\s*)', bygroups(Punctuation, Whitespace), 'value'), + + # Delimiters + (r',', Punctuation), + + # End of inline table + (r'\}', Punctuation, '#pop'), + ], + 'basic-string': [ + (r'"', String.Double, '#pop'), + include('escapes'), + (r'[^"\\]+', String.Double), + ], + 'literal-string': [ + (r".*?'", String.Single, '#pop'), + ], + 'multiline-basic-string': [ + (r'"""', String.Double, '#pop'), + (r'(\\)(\n)', bygroups(String.Escape, Whitespace)), + include('escapes'), + (r'[^"\\]+', String.Double), + (r'"', String.Double), + ], + 'multiline-literal-string': [ + (r"'''", String.Single, '#pop'), + (r"[^']+", String.Single), + (r"'", String.Single), + ], + 'escapes': [ + (r'\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}', String.Escape), + (r'\\.', String.Escape), + ], } class NestedTextLexer(RegexLexer): diff --git a/contrib/python/Pygments/py3/pygments/lexers/crystal.py b/contrib/python/Pygments/py3/pygments/lexers/crystal.py index 6ebf2f61e9..e4df8b1dd7 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/crystal.py +++ b/contrib/python/Pygments/py3/pygments/lexers/crystal.py @@ -32,7 +32,7 @@ class CrystalLexer(ExtendedRegexLexer): """ name = 'Crystal' - url = 'http://crystal-lang.org' + url = 'https://crystal-lang.org' aliases = ['cr', 'crystal'] filenames = ['*.cr'] mimetypes = ['text/x-crystal'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/data.py b/contrib/python/Pygments/py3/pygments/lexers/data.py index f97e146efc..afb5f7e59c 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/data.py +++ b/contrib/python/Pygments/py3/pygments/lexers/data.py @@ -450,8 +450,8 @@ class JsonLexer(Lexer): name = 'JSON' url = 'https://www.json.org' aliases = ['json', 'json-object'] - filenames = ['*.json', 'Pipfile.lock'] - mimetypes = ['application/json', 'application/json-object'] + filenames = ['*.json', '*.jsonl', '*.ndjson', 'Pipfile.lock'] + mimetypes = ['application/json', 'application/json-object', 'application/x-ndjson', 'application/jsonl', 'application/json-seq'] # No validation of integers, floats, or constants is done. # As long as the characters are members of the following diff --git a/contrib/python/Pygments/py3/pygments/lexers/dsls.py b/contrib/python/Pygments/py3/pygments/lexers/dsls.py index f607515140..37a5ff6c33 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/dsls.py +++ b/contrib/python/Pygments/py3/pygments/lexers/dsls.py @@ -879,7 +879,7 @@ class SnowballLexer(ExtendedRegexLexer): """ name = 'Snowball' - url = 'http://snowballstem.org/' + url = 'https://snowballstem.org/' aliases = ['snowball'] filenames = ['*.sbl'] @@ -929,7 +929,8 @@ class SnowballLexer(ExtendedRegexLexer): tokens = { 'root': [ - (words(('len', 'lenof'), suffix=r'\b'), Operator.Word), + (r'len\b', Name.Builtin), + (r'lenof\b', Operator.Word), include('root1'), ], 'root1': [ diff --git a/contrib/python/Pygments/py3/pygments/lexers/eiffel.py b/contrib/python/Pygments/py3/pygments/lexers/eiffel.py index 83bfe1ffd1..8a5a559501 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/eiffel.py +++ b/contrib/python/Pygments/py3/pygments/lexers/eiffel.py @@ -22,7 +22,7 @@ class EiffelLexer(RegexLexer): .. versionadded:: 2.0 """ name = 'Eiffel' - url = 'http://www.eiffel.com' + url = 'https://www.eiffel.com' aliases = ['eiffel'] filenames = ['*.e'] mimetypes = ['text/x-eiffel'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/elm.py b/contrib/python/Pygments/py3/pygments/lexers/elm.py index 4bc12d303d..0e7ac3fabc 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/elm.py +++ b/contrib/python/Pygments/py3/pygments/lexers/elm.py @@ -23,7 +23,7 @@ class ElmLexer(RegexLexer): """ name = 'Elm' - url = 'http://elm-lang.org/' + url = 'https://elm-lang.org/' aliases = ['elm'] filenames = ['*.elm'] mimetypes = ['text/x-elm'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/fortran.py b/contrib/python/Pygments/py3/pygments/lexers/fortran.py index d191099c30..cee254f748 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/fortran.py +++ b/contrib/python/Pygments/py3/pygments/lexers/fortran.py @@ -59,8 +59,8 @@ class FortranLexer(RegexLexer): 'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE', 'CODIMENSION', 'COMMON', 'CONTIGUOUS', 'CONTAINS', 'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE', - 'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END', - 'ENDASSOCIATE', 'ENDBLOCK', 'ENDDO', 'ENDENUM', 'ENDFORALL', + 'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ELSEIF', 'ENCODE', + 'END', 'ENDASSOCIATE', 'ENDBLOCK', 'ENDDO', 'ENDENUM', 'ENDFORALL', 'ENDFUNCTION', 'ENDIF', 'ENDINTERFACE', 'ENDMODULE', 'ENDPROGRAM', 'ENDSELECT', 'ENDSUBMODULE', 'ENDSUBROUTINE', 'ENDTYPE', 'ENDWHERE', 'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'ERROR STOP', 'EXIT', diff --git a/contrib/python/Pygments/py3/pygments/lexers/graph.py b/contrib/python/Pygments/py3/pygments/lexers/graph.py index 4b043c3ddb..753df361c8 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/graph.py +++ b/contrib/python/Pygments/py3/pygments/lexers/graph.py @@ -35,16 +35,13 @@ class CypherLexer(RegexLexer): tokens = { 'root': [ - include('comment'), include('clauses'), include('keywords'), include('relations'), include('strings'), include('whitespace'), include('barewords'), - ], - 'comment': [ - (r'^.*//.*$', Comment.Single), + include('comment'), ], 'keywords': [ (r'(create|order|match|limit|set|skip|start|return|with|where|' @@ -76,12 +73,16 @@ class CypherLexer(RegexLexer): bygroups(Keyword, Whitespace, Keyword)), (r'(using)(\s+)(periodic)(\s+)(commit)\b', bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)), + (r'(using)(\s+)(index)\b', + bygroups(Keyword, Whitespace, Keyword)), + (r'(using)(\s+)(range|text|point)(\s+)(index)\b', + bygroups(Keyword, Whitespace, Name, Whitespace, Keyword)), (words(( 'all', 'any', 'as', 'asc', 'ascending', 'assert', 'call', 'case', 'create', 'delete', 'desc', 'descending', 'distinct', 'end', 'fieldterminator', 'foreach', 'in', 'limit', 'match', 'merge', 'none', 'not', 'null', 'remove', 'return', 'set', 'skip', 'single', 'start', 'then', 'union', - 'unwind', 'yield', 'where', 'when', 'with'), suffix=r'\b'), Keyword), + 'unwind', 'yield', 'where', 'when', 'with', 'collect'), suffix=r'\b'), Keyword), ], 'relations': [ (r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)), @@ -92,7 +93,7 @@ class CypherLexer(RegexLexer): (r'[.*{}]', Punctuation), ], 'strings': [ - (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String), + (r'([\'"])(?:\\[tbnrf\'"\\]|[^\\])*?\1', String), (r'`(?:``|[^`])+`', Name.Variable), ], 'whitespace': [ @@ -102,4 +103,7 @@ class CypherLexer(RegexLexer): (r'[a-z]\w*', Name), (r'\d+', Number), ], + 'comment': [ + (r'//.*$', Comment.Single), + ], } diff --git a/contrib/python/Pygments/py3/pygments/lexers/jsx.py b/contrib/python/Pygments/py3/pygments/lexers/jsx.py new file mode 100644 index 0000000000..90cecc0277 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/jsx.py @@ -0,0 +1,76 @@ +""" + pygments.lexers.jsx + ~~~~~~~~~~~~~~~~~~~ + + Lexers for JSX (React). + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import bygroups, default, include, inherit +from pygments.lexers.javascript import JavascriptLexer +from pygments.token import Name, Operator, Punctuation, String, Text, \ + Whitespace + +__all__ = ['JsxLexer'] + + +class JsxLexer(JavascriptLexer): + """For JavaScript Syntax Extension (JSX). + + .. versionadded:: 2.17 + """ + + name = "JSX" + aliases = ["jsx", "react"] + filenames = ["*.jsx", "*.react"] + mimetypes = ["text/jsx", "text/typescript-jsx"] + url = "https://facebook.github.io/jsx/" + + flags = re.MULTILINE | re.DOTALL + + # Use same tokens as `JavascriptLexer`, but with tags and attributes support + tokens = { + "root": [ + include("jsx"), + inherit, + ], + "jsx": [ + (r"</?>", Punctuation), # JSXFragment <>|</> + (r"(<)(\w+)(\.?)", bygroups(Punctuation, Name.Tag, Punctuation), "tag"), + ( + r"(</)(\w+)(>)", + bygroups(Punctuation, Name.Tag, Punctuation), + ), + ( + r"(</)(\w+)", + bygroups(Punctuation, Name.Tag), + "fragment", + ), # Same for React.Context + ], + "tag": [ + (r"\s+", Whitespace), + (r"([\w-]+)(\s*)(=)(\s*)", bygroups(Name.Attribute, Whitespace, Operator, Whitespace), "attr"), + (r"[{}]+", Punctuation), + (r"[\w\.]+", Name.Attribute), + (r"(/?)(\s*)(>)", bygroups(Punctuation, Text, Punctuation), "#pop"), + ], + "fragment": [ + (r"(.)(\w+)", bygroups(Punctuation, Name.Attribute)), + (r"(>)", bygroups(Punctuation), "#pop"), + ], + "attr": [ + (r"\{", Punctuation, "expression"), + (r'".*?"', String, "#pop"), + (r"'.*?'", String, "#pop"), + default("#pop"), + ], + "expression": [ + (r"\{", Punctuation, "#push"), + (r"\}", Punctuation, "#pop"), + include("root"), + ], + } diff --git a/contrib/python/Pygments/py3/pygments/lexers/kusto.py b/contrib/python/Pygments/py3/pygments/lexers/kusto.py new file mode 100644 index 0000000000..9f30fd6751 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/kusto.py @@ -0,0 +1,94 @@ +""" + pygments.lexers.kusto + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Kusto Query Language (KQL). + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words +from pygments.token import (Comment, Keyword, Name, Number, Punctuation, + String, Whitespace) + +__all__ = ["KustoLexer"] + +# Although these all seem to be keywords +# https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Syntax/SyntaxFacts.cs +# it appears that only the ones with tags here +# https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Parser/QueryGrammar.cs +# are highlighted in the Azure portal log query editor. +KUSTO_KEYWORDS = [ + 'and', 'as', 'between', 'by', 'consume', 'contains', 'containscs', 'count', + 'distinct', 'evaluate', 'extend', 'facet', 'filter', 'find', 'fork', + 'getschema', 'has', 'invoke', 'join', 'limit', 'lookup', 'make-series', + 'matches regex', 'mv-apply', 'mv-expand', 'notcontains', 'notcontainscs', + '!contains', '!has', '!startswith', 'on', 'or', 'order', 'parse', 'parse-where', + 'parse-kv', 'partition', 'print', 'project', 'project-away', 'project-keep', + 'project-rename', 'project-reorder', 'range', 'reduce', 'regex', 'render', + 'sample', 'sample-distinct', 'scan', 'search', 'serialize', 'sort', 'startswith', + 'summarize', 'take', 'top', 'top-hitters', 'top-nested', 'typeof', 'union', + 'where', 'bool', 'date', 'datetime', 'int', 'long', 'real', 'string', 'time' +] + +# From +# https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Syntax/SyntaxFacts.cs +KUSTO_PUNCTUATION = [ + "(", ")", "[", "]", "{", "}", "|", "<|", "+", "-", "*", "/", + "%", ".." "!", "<", "<=", ">", ">=", "=", "==", "!=", "<>", + ":", ";", ",", "=~", "!~", "?", "=>", +] + + +class KustoLexer(RegexLexer): + """For Kusto Query Language source code. + + .. versionadded:: 2.17 + """ + + name = "Kusto" + aliases = ["kql", "kusto"] + filenames = ["*.kql", "*.kusto", ".csl"] + url = "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query" + + tokens = { + "root": [ + (r"\s+", Whitespace), + (words(KUSTO_KEYWORDS, suffix=r"\b"), Keyword), + (r"//.*", Comment), + (words(KUSTO_PUNCTUATION), Punctuation), + (r"[^\W\d]\w*", Name), + # Numbers can take the form 1, .1, 1., 1.1, 1.1111, etc. + (r"\d+[.]\d*|[.]\d+", Number.Float), + (r"\d+", Number.Integer), + (r"'", String, "single_string"), + (r'"', String, "double_string"), + (r"@'", String, "single_verbatim"), + (r'@"', String, "double_verbatim"), + (r"```", String, "multi_string"), + ], + "single_string": [ + (r"'", String, "#pop"), + (r"\\.", String.Escape), + (r"[^'\\]+", String), + ], + "double_string": [ + (r'"', String, "#pop"), + (r"\\.", String.Escape), + (r'[^"\\]+', String), + ], + "single_verbatim": [ + (r"'", String, "#pop"), + (r"[^']+", String), + ], + "double_verbatim": [ + (r'"', String, "#pop"), + (r'[^"]+', String), + ], + "multi_string": [ + (r"[^`]+", String), + (r"```", String, "#pop"), + (r"`", String), + ], + } diff --git a/contrib/python/Pygments/py3/pygments/lexers/ldap.py b/contrib/python/Pygments/py3/pygments/lexers/ldap.py new file mode 100644 index 0000000000..a669f79004 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/ldap.py @@ -0,0 +1,157 @@ +""" + pygments.lexers.ldap + ~~~~~~~~~~~~~~~~~~~~ + + Pygments lexers for LDAP. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + + +from pygments.lexer import RegexLexer, bygroups, default +from pygments.token import Operator, Comment, Keyword, Literal, Name, String, \ + Number, Punctuation, Whitespace, Escape + +__all__ = ['LdifLexer', 'LdaprcLexer'] + + +class LdifLexer(RegexLexer): + + """ + Lexer for LDIF + + .. versionadded:: 2.17 + """ + + name = 'LDIF' + aliases = ['ldif'] + filenames = ['*.ldif'] + mimetypes = ["text/x-ldif"] + url = "https://datatracker.ietf.org/doc/html/rfc2849" + + tokens = { + 'root': [ + (r'\s*\n', Whitespace), + (r'(-)(\n)', bygroups(Punctuation, Whitespace)), + (r'(#.*)(\n)', bygroups(Comment.Single, Whitespace)), + (r'(version)(:)([ \t]*)(.*)([ \t]*\n)', bygroups(Keyword, + Punctuation, Whitespace, Number.Integer, Whitespace)), + (r'(control)(:)([ \t]*)([\.0-9]+)([ \t]+)((?:true|false)?)([ \t]*)', + bygroups(Keyword, Punctuation, Whitespace, Name.Other, Whitespace, Keyword, Whitespace), "after-control"), + (r'(deleteoldrdn)(:)([ \n]*)([0-1]+)([ \t]*\n)', + bygroups(Keyword, Punctuation, Whitespace, Number, Whitespace)), + (r'(add|delete|replace)(::?)(\s*)(.*)([ \t]*\n)', bygroups( + Keyword, Punctuation, Whitespace, Name.Attribute, Whitespace)), + (r'(changetype)(:)([ \t]*)([a-z]*)([ \t]*\n)', + bygroups(Keyword, Punctuation, Whitespace, Keyword, Whitespace)), + (r'(dn|newrdn)(::)', bygroups(Keyword, Punctuation), "base64-dn"), + (r'(dn|newrdn)(:)', bygroups(Keyword, Punctuation), "dn"), + (r'(objectclass)(:)([ \t]*)([^ \t\n]*)([ \t]*\n)', bygroups( + Keyword, Punctuation, Whitespace, Name.Class, Whitespace)), + (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(;)', + bygroups(Name.Attribute, Punctuation), "property"), + (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(:<)', + bygroups(Name.Attribute, Punctuation), "url"), + (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(::?)', + bygroups(Name.Attribute, Punctuation), "value"), + ], + "after-control": [ + (r":<", Punctuation, ("#pop", "url")), + (r"::?", Punctuation, ("#pop", "value")), + default("#pop"), + ], + 'property': [ + (r'([-a-zA-Z0-9]*)(;)', bygroups(Name.Property, Punctuation)), + (r'([-a-zA-Z0-9]*)(:<)', + bygroups(Name.Property, Punctuation), ("#pop", "url")), + (r'([-a-zA-Z0-9]*)(::?)', + bygroups(Name.Property, Punctuation), ("#pop", "value")), + ], + 'value': [ + (r'(\s*)([^\n]+\S)(\n )', + bygroups(Whitespace, String, Whitespace)), + (r'(\s*)([^\n]+\S)(\n)', + bygroups(Whitespace, String, Whitespace), "#pop"), + ], + 'url': [ + (r'([ \t]*)(\S*)([ \t]*\n )', + bygroups(Whitespace, Comment.PreprocFile, Whitespace)), + (r'([ \t]*)(\S*)([ \t]*\n)', bygroups(Whitespace, + Comment.PreprocFile, Whitespace), "#pop"), + ], + "dn": [ + (r'([ \t]*)([-a-zA-Z0-9\.]+)(=)', bygroups(Whitespace, + Name.Attribute, Operator), ("#pop", "dn-value")), + ], + "dn-value": [ + (r'\\[^\n]', Escape), + (r',', Punctuation, ("#pop", "dn")), + (r'\+', Operator, ("#pop", "dn")), + (r'[^,\+\n]+', String), + (r'\n ', Whitespace), + (r'\n', Whitespace, "#pop"), + ], + "base64-dn": [ + (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n )', + bygroups(Whitespace, Name, Whitespace)), + (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n)', + bygroups(Whitespace, Name, Whitespace), "#pop"), + ] + } + + +class LdaprcLexer(RegexLexer): + """ + Lexer for OpenLDAP configuration files. + + .. versionadded:: 2.17 + """ + + name = 'LDAP configuration file' + aliases = ['ldapconf', 'ldaprc'] + filenames = ['.ldaprc', 'ldaprc', 'ldap.conf'] + mimetypes = ["text/x-ldapconf"] + url = 'https://www.openldap.org/software//man.cgi?query=ldap.conf&sektion=5&apropos=0&manpath=OpenLDAP+2.4-Release' + + _sasl_keywords = r'SASL_(?:MECH|REALM|AUTHCID|AUTHZID|CBINDING)' + _tls_keywords = r'TLS_(?:CACERT|CACERTDIR|CERT|ECNAME|KEY|CIPHER_SUITE|PROTOCOL_MIN|RANDFILE|CRLFILE)' + _literal_keywords = rf'(?:URI|SOCKET_BIND_ADDRESSES|{_sasl_keywords}|{_tls_keywords})' + _boolean_keywords = r'GSSAPI_(?:ALLOW_REMOTE_PRINCIPAL|ENCRYPT|SIGN)|REFERRALS|SASL_NOCANON' + _integer_keywords = r'KEEPALIVE_(?:IDLE|PROBES|INTERVAL)|NETWORK_TIMEOUT|PORT|SIZELIMIT|TIMELIMIT|TIMEOUT' + _secprops = r'none|noanonymous|noplain|noactive|nodict|forwardsec|passcred|(?:minssf|maxssf|maxbufsize)=\d+' + + flags = re.IGNORECASE | re.MULTILINE + + tokens = { + 'root': [ + (r'#.*', Comment.Single), + (r'\s+', Whitespace), + (rf'({_boolean_keywords})(\s+)(on|true|yes|off|false|no)$', + bygroups(Keyword, Whitespace, Keyword.Constant)), + (rf'({_integer_keywords})(\s+)(\d+)', + bygroups(Keyword, Whitespace, Number.Integer)), + (r'(VERSION)(\s+)(2|3)', bygroups(Keyword, Whitespace, Number.Integer)), + # Constants + (r'(DEREF)(\s+)(never|searching|finding|always)', + bygroups(Keyword, Whitespace, Keyword.Constant)), + (rf'(SASL_SECPROPS)(\s+)((?:{_secprops})(?:,{_secprops})*)', + bygroups(Keyword, Whitespace, Keyword.Constant)), + (r'(SASL_CBINDING)(\s+)(none|tls-unique|tls-endpoint)', + bygroups(Keyword, Whitespace, Keyword.Constant)), + (r'(TLS_REQ(?:CERT|SAN))(\s+)(allow|demand|hard|never|try)', + bygroups(Keyword, Whitespace, Keyword.Constant)), + (r'(TLS_CRLCHECK)(\s+)(none|peer|all)', + bygroups(Keyword, Whitespace, Keyword.Constant)), + # Literals + (r'(BASE|BINDDN)(\s+)(\S+)$', + bygroups(Keyword, Whitespace, Literal)), + # Accepts hostname with or without port. + (r'(HOST)(\s+)([a-z0-9]+)((?::(\d+))?)', + bygroups(Keyword, Whitespace, Literal, Number.Integer)), + (rf'({_literal_keywords})(\s+)(\S+)$', + bygroups(Keyword, Whitespace, Literal)), + ], + } diff --git a/contrib/python/Pygments/py3/pygments/lexers/lean.py b/contrib/python/Pygments/py3/pygments/lexers/lean.py new file mode 100644 index 0000000000..d16cd73c57 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/lean.py @@ -0,0 +1,122 @@ +""" + pygments.lexers.lean + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Lean theorem prover. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" +import re + +from pygments.lexer import RegexLexer, default, words, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Whitespace + +__all__ = ['Lean3Lexer'] + +class Lean3Lexer(RegexLexer): + """ + For the Lean 3 theorem prover. + + .. versionadded:: 2.0 + """ + name = 'Lean' + url = 'https://leanprover-community.github.io/lean3' + aliases = ['lean', 'lean3'] + filenames = ['*.lean'] + mimetypes = ['text/x-lean', 'text/x-lean3'] + + tokens = { + 'expression': [ + (r'\s+', Text), + (r'/--', String.Doc, 'docstring'), + (r'/-', Comment, 'comment'), + (r'--.*?$', Comment.Single), + (words(( + 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices', + 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match', + 'do' + ), prefix=r'\b', suffix=r'\b'), Keyword), + (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error), + (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type), + (words(( + '(', ')', ':', '{', '}', '[', ']', '⟨', '⟩', '‹', '›', '⦃', '⦄', ':=', ',', + )), Operator), + (r'[A-Za-z_\u03b1-\u03ba\u03bc-\u03fb\u1f00-\u1ffe\u2100-\u214f]' + r'[.A-Za-z_\'\u03b1-\u03ba\u03bc-\u03fb\u1f00-\u1ffe\u2070-\u2079' + r'\u207f-\u2089\u2090-\u209c\u2100-\u214f0-9]*', Name), + (r'0x[A-Za-z0-9]+', Number.Integer), + (r'0b[01]+', Number.Integer), + (r'\d+', Number.Integer), + (r'"', String.Double, 'string'), + (r"'(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})|.)'", String.Char), + (r'[~?][a-z][\w\']*:', Name.Variable), + (r'\S', Name.Builtin.Pseudo), + ], + 'root': [ + (words(( + 'import', 'renaming', 'hiding', + 'namespace', + 'local', + 'private', 'protected', 'section', + 'include', 'omit', 'section', + 'protected', 'export', + 'open', + 'attribute', + ), prefix=r'\b', suffix=r'\b'), Keyword.Namespace), + (words(( + 'lemma', 'theorem', 'def', 'definition', 'example', + 'axiom', 'axioms', 'constant', 'constants', + 'universe', 'universes', + 'inductive', 'coinductive', 'structure', 'extends', + 'class', 'instance', + 'abbreviation', + + 'noncomputable theory', + + 'noncomputable', 'mutual', 'meta', + + 'attribute', + + 'parameter', 'parameters', + 'variable', 'variables', + + 'reserve', 'precedence', + 'postfix', 'prefix', 'notation', 'infix', 'infixl', 'infixr', + + 'begin', 'by', 'end', + + 'set_option', + 'run_cmd', + ), prefix=r'\b', suffix=r'\b'), Keyword.Declaration), + (r'@\[', Keyword.Declaration, 'attribute'), + (words(( + '#eval', '#check', '#reduce', '#exit', + '#print', '#help', + ), suffix=r'\b'), Keyword), + include('expression') + ], + 'attribute': [ + (r'\]', Keyword.Declaration, '#pop'), + include('expression'), + ], + 'comment': [ + (r'[^/-]', Comment.Multiline), + (r'/-', Comment.Multiline, '#push'), + (r'-/', Comment.Multiline, '#pop'), + (r'[/-]', Comment.Multiline) + ], + 'docstring': [ + (r'[^/-]', String.Doc), + (r'-/', String.Doc, '#pop'), + (r'[/-]', String.Doc) + ], + 'string': [ + (r'[^\\"]+', String.Double), + (r"(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4}))", String.Escape), + ('"', String.Double, '#pop'), + ], + } + +LeanLexer = Lean3Lexer diff --git a/contrib/python/Pygments/py3/pygments/lexers/lisp.py b/contrib/python/Pygments/py3/pygments/lexers/lisp.py index 5a97a1677a..966b6063ab 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/lisp.py +++ b/contrib/python/Pygments/py3/pygments/lexers/lisp.py @@ -471,6 +471,16 @@ class CommonLispLexer(RegexLexer): ], } + def analyse_text(text): + """Competes with Visual Prolog on *.cl""" + # This is a *really* good indicator (and not conflicting with Visual Prolog) + # '(defun ' first on a line + # section keyword alone on line e.g. 'clauses' + if re.search(r'^\s*\(defun\s', text): + return 0.8 + else: + return 0 + class HyLexer(RegexLexer): """ diff --git a/contrib/python/Pygments/py3/pygments/lexers/macaulay2.py b/contrib/python/Pygments/py3/pygments/lexers/macaulay2.py index bc59d48ab8..a624890d85 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/macaulay2.py +++ b/contrib/python/Pygments/py3/pygments/lexers/macaulay2.py @@ -1719,7 +1719,7 @@ class Macaulay2Lexer(RegexLexer): """Lexer for Macaulay2, a software system for research in algebraic geometry.""" name = 'Macaulay2' - url = 'https://faculty.math.illinois.edu/Macaulay2/' + url = 'https://macaulay2.com/' aliases = ['macaulay2'] filenames = ['*.m2'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/make.py b/contrib/python/Pygments/py3/pygments/lexers/make.py index bf1976146d..0f54ab6937 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/make.py +++ b/contrib/python/Pygments/py3/pygments/lexers/make.py @@ -179,6 +179,7 @@ class CMakeLexer(RegexLexer): (r'(\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator)), (r'(?s)".*?"', String.Double), (r'\\\S+', String), + (r'\[(?P<level>=*)\[[\w\W]*?\](?P=level)\]', String.Multiline), (r'[^)$"# \t\n]+', String), (r'\n', Whitespace), # explicitly legal include('keywords'), diff --git a/contrib/python/Pygments/py3/pygments/lexers/markup.py b/contrib/python/Pygments/py3/pygments/lexers/markup.py index 8794037097..bb4c7cecfd 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/markup.py +++ b/contrib/python/Pygments/py3/pygments/lexers/markup.py @@ -930,7 +930,9 @@ class WikitextLexer(RegexLexer): variant_langs = { # ZhConverter.php 'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw', - # UnConverter.php + # WuuConverter.php + 'wuu', 'wuu-hans', 'wuu-hant', + # UzConverter.php 'uz', 'uz-latn', 'uz-cyrl', # TlyConverter.php 'tly', 'tly-cyrl', @@ -1076,7 +1078,7 @@ class WikitextLexer(RegexLexer): (?: (\#) ([%s]*?) )? (\]\]) """ % ('|'.join(protocols), title_char.replace('/', ''), - title_char, f'{title_char}#'), + title_char, f'{title_char}#'), bygroups(Punctuation, Name.Namespace, Punctuation, using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation) ), @@ -1088,7 +1090,7 @@ class WikitextLexer(RegexLexer): (?: (\#) ([%s]*?) )? (\|) """ % ('|'.join(protocols), title_char.replace('/', ''), - title_char, f'{title_char}#'), + title_char, f'{title_char}#'), bygroups(Punctuation, Name.Namespace, Punctuation, using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation), 'wikilink-inner' @@ -1188,16 +1190,38 @@ class WikitextLexer(RegexLexer): # LanguageConverter markups ( r"""(?xi) - (-\{{) # Escape format() - (?: ([^|]) (\|))? - (?: (\s* (?:{variants}) \s*) (=>))? - (\s* (?:{variants}) \s*) (:) + (-\{{) # Use {{ to escape format() + ([^|]) (\|) + (?: + (?: ([^;]*?) (=>))? + (\s* (?:{variants}) \s*) (:) + )? """.format(variants='|'.join(variant_langs)), bygroups(Punctuation, Keyword, Punctuation, - Name.Label, Operator, Name.Label, Punctuation), + using(this, state=['root', 'lc-raw']), + Operator, Name.Label, Punctuation), + 'lc-inner' + ), + # LanguageConverter markups: composite conversion grammar + ( + r"""(?xi) + (-\{) + ([a-z\s;-]*?) (\|) + """, + bygroups(Punctuation, + using(this, state=['root', 'lc-flag']), + Punctuation), + 'lc-raw' + ), + # LanguageConverter markups: fallbacks + ( + r"""(?xi) + (-\{{) (?!\{{) # Use {{ to escape format() + (?: (\s* (?:{variants}) \s*) (:))? + """.format(variants='|'.join(variant_langs)), + bygroups(Punctuation, Name.Label, Punctuation), 'lc-inner' ), - (r'-\{(?!\{)', Punctuation, 'lc-raw'), ], 'wikilink-name': [ include('replaceable'), @@ -1260,14 +1284,19 @@ class WikitextLexer(RegexLexer): include('inline'), include('text-bold-italic'), ], + 'lc-flag': [ + (r'\s+', Whitespace), + (r';', Punctuation), + *text_rules(Keyword), + ], 'lc-inner': [ ( r"""(?xi) (;) - (?: (\s* (?:{variants}) \s*) (=>))? + (?: ([^;]*?) (=>))? (\s* (?:{variants}) \s*) (:) """.format(variants='|'.join(variant_langs)), - bygroups(Punctuation, Name.Label, + bygroups(Punctuation, using(this, state=['root', 'lc-raw']), Operator, Name.Label, Punctuation) ), (r';?\s*?\}-', Punctuation, '#pop'), diff --git a/contrib/python/Pygments/py3/pygments/lexers/minecraft.py b/contrib/python/Pygments/py3/pygments/lexers/minecraft.py index 1da0a1ba7f..11faa00096 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/minecraft.py +++ b/contrib/python/Pygments/py3/pygments/lexers/minecraft.py @@ -5,11 +5,11 @@ Lexers for Minecraft related languages. SNBT. A data communication format used in Minecraft. - wiki: https://minecraft.fandom.com/wiki/NBT_format + wiki: https://minecraft.wiki/w/NBT_format MCFunction. The Function file for Minecraft Data packs and Add-ons. official: https://learn.microsoft.com/en-us/minecraft/creator/documents/functionsintroduction - wiki: https://minecraft.fandom.com/wiki/Function + wiki: https://minecraft.wiki/w/Function MCSchema. A kind of data Schema for Minecraft Add-on Development. official: https://learn.microsoft.com/en-us/minecraft/creator/reference/content/schemasreference/ @@ -33,7 +33,7 @@ class SNBTLexer(RegexLexer): """ name = "SNBT" - url = "https://minecraft.fandom.com/wiki/NBT_format" + url = "https://minecraft.wiki/w/NBT_format" aliases = ["snbt"] filenames = ["*.snbt"] mimetypes = ["text/snbt"] @@ -107,7 +107,7 @@ class MCFunctionLexer(RegexLexer): """ name = "MCFunction" - url = "https://minecraft.fandom.com/wiki/Commands" + url = "https://minecraft.wiki/w/Commands" aliases = ["mcfunction", "mcf"] filenames = ["*.mcfunction"] mimetypes = ["text/mcfunction"] diff --git a/contrib/python/Pygments/py3/pygments/lexers/ml.py b/contrib/python/Pygments/py3/pygments/lexers/ml.py index 9b9351f25c..3dfa6d9345 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/ml.py +++ b/contrib/python/Pygments/py3/pygments/lexers/ml.py @@ -366,13 +366,13 @@ class OcamlLexer(RegexLexer): mimetypes = ['text/x-ocaml'] keywords = ( - 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done', + 'and', 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done', 'downto', 'else', 'end', 'exception', 'external', 'false', 'for', 'fun', 'function', 'functor', 'if', 'in', 'include', 'inherit', 'initializer', 'lazy', 'let', 'match', 'method', 'module', 'mutable', 'new', 'object', 'of', 'open', 'private', 'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try', - 'type', 'value', 'val', 'virtual', 'when', 'while', 'with', + 'type', 'val', 'virtual', 'when', 'while', 'with', ) keyopts = ( '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-', @@ -382,7 +382,7 @@ class OcamlLexer(RegexLexer): ) operators = r'[!$%&*+\./:<=>?@^|~-]' - word_operators = ('and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or') + word_operators = ('asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or') prefix_syms = r'[!?~]' infix_syms = r'[=<>@^|&+\*/$%-]' primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array') diff --git a/contrib/python/Pygments/py3/pygments/lexers/nix.py b/contrib/python/Pygments/py3/pygments/lexers/nix.py index 5d3aad4695..7ab59bb8c9 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/nix.py +++ b/contrib/python/Pygments/py3/pygments/lexers/nix.py @@ -34,8 +34,8 @@ class NixLexer(RegexLexer): 'else', 'then', '...'] builtins = ['import', 'abort', 'baseNameOf', 'dirOf', 'isNull', 'builtins', 'map', 'removeAttrs', 'throw', 'toString', 'derivation'] - operators = ['++', '+', '?', '.', '!', '//', '==', - '!=', '&&', '||', '->', '='] + operators = ['++', '+', '?', '.', '!', '//', '==', '/', + '!=', '&&', '||', '->', '=', '<', '>', '*', '-'] punctuations = ["(", ")", "[", "]", ";", "{", "}", ":", ",", "@"] @@ -59,6 +59,17 @@ class NixLexer(RegexLexer): (r'\b(true|false|null)\b', Name.Constant), + # floats + (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?', Number.Float), + + # integers + (r'-?[0-9]+', Number.Integer), + + # paths + (r'[\w.+-]*(\/[\w.+-]+)+', Literal), + (r'~(\/[\w.+-]+)+', Literal), + (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal), + # operators ('(%s)' % '|'.join(re.escape(entry) for entry in operators), Operator), @@ -66,27 +77,23 @@ class NixLexer(RegexLexer): # word operators (r'\b(or|and)\b', Operator.Word), + (r'\{', Punctuation, 'block'), + # punctuations ('(%s)' % '|'.join(re.escape(entry) for entry in punctuations), Punctuation), - # integers - (r'[0-9]+', Number.Integer), - # strings (r'"', String.Double, 'doublequote'), - (r"''", String.Single, 'singlequote'), - - # paths - (r'[\w.+-]*(\/[\w.+-]+)+', Literal), - (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal), + (r"''", String.Multiline, 'multiline'), # urls (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal), # names of variables - (r'[\w-]+\s*=', String.Symbol), + (r'[\w-]+(?=\s*=)', String.Symbol), (r'[a-zA-Z_][\w\'-]*', Text), + (r"\$\{", String.Interpol, 'antiquote'), ], 'comment': [ (r'[^/*]+', Comment.Multiline), @@ -94,24 +101,23 @@ class NixLexer(RegexLexer): (r'\*/', Comment.Multiline, '#pop'), (r'[*/]', Comment.Multiline), ], - 'singlequote': [ - (r"'''", String.Escape), - (r"''\$\{", String.Escape), - (r"''\n", String.Escape), - (r"''\r", String.Escape), - (r"''\t", String.Escape), - (r"''", String.Single, '#pop'), + 'multiline': [ + (r"''(\$|'|\\n|\\r|\\t|\\)", String.Escape), + (r"''", String.Multiline, '#pop'), (r'\$\{', String.Interpol, 'antiquote'), - (r"['$]", String.Single), - (r"[^'$]+", String.Single), + (r"[^'\$]+", String.Multiline), + (r"\$[^\{']", String.Multiline), + (r"'[^']", String.Multiline), + (r"\$(?=')", String.Multiline), ], 'doublequote': [ - (r'\\', String.Escape), - (r'\\"', String.Escape), - (r'\\$\{', String.Escape), + (r'\\(\\|"|\$|n)', String.Escape), (r'"', String.Double, '#pop'), (r'\$\{', String.Interpol, 'antiquote'), - (r'[^"]', String.Double), + (r'[^"\\\$]+', String.Double), + (r'\$[^\{"]', String.Double), + (r'\$(?=")', String.Double), + (r'\\', String.Double), ], 'antiquote': [ (r"\}", String.Interpol, '#pop'), @@ -119,6 +125,10 @@ class NixLexer(RegexLexer): (r"\$\{", String.Interpol, '#push'), include('root'), ], + 'block': [ + (r"\}", Punctuation, '#pop'), + include('root'), + ], } def analyse_text(text): diff --git a/contrib/python/Pygments/py3/pygments/lexers/prolog.py b/contrib/python/Pygments/py3/pygments/lexers/prolog.py index 33c71d8391..37c1e9c7ed 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/prolog.py +++ b/contrib/python/Pygments/py3/pygments/lexers/prolog.py @@ -78,7 +78,12 @@ class PrologLexer(RegexLexer): } def analyse_text(text): - return ':-' in text + """Competes with IDL and Visual Prolog on *.pro""" + if ':-' in text: + # Visual Prolog also uses :- + return 0.5 + else: + return 0 class LogtalkLexer(RegexLexer): diff --git a/contrib/python/Pygments/py3/pygments/lexers/prql.py b/contrib/python/Pygments/py3/pygments/lexers/prql.py new file mode 100644 index 0000000000..4c2f12ef3c --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/prql.py @@ -0,0 +1,252 @@ +""" + pygments.lexers.prql + ~~~~~~~~~~~~~~~~~~~~ + + Lexer for the PRQL query language. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, combined, words, include, bygroups +from pygments.token import Comment, Literal, Keyword, Name, Number, Operator, \ + Punctuation, String, Text, Whitespace + +__all__ = ['PrqlLexer'] + + +class PrqlLexer(RegexLexer): + """ + For PRQL source code. + + .. versionadded:: 2.17 + + grammar: https://github.com/PRQL/prql/tree/main/grammars + """ + + name = 'PRQL' + url = 'https://prql-lang.org/' + aliases = ['prql'] + filenames = ['*.prql'] + mimetypes = ['application/prql', 'application/x-prql'] + + builtinTypes = words(( + "bool", + "int", + "int8", "int16", "int32", "int64", "int128", + "float", + "text", + "set"), suffix=r'\b') + + def innerstring_rules(ttype): + return [ + # the new style '{}'.format(...) string formatting + (r'\{' + r'((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name + r'(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?' + r'\}', String.Interpol), + + (r'[^\\\'"%{\n]+', ttype), + (r'[\'"\\]', ttype), + (r'%|(\{{1,2})', ttype) + ] + + def fstring_rules(ttype): + return [ + (r'\}', String.Interpol), + (r'\{', String.Interpol, 'expr-inside-fstring'), + (r'[^\\\'"{}\n]+', ttype), + (r'[\'"\\]', ttype), + ] + + tokens = { + 'root': [ + + # Comments + (r'#!.*', String.Doc), + (r'#.*', Comment.Single), + + # Whitespace + (r'\s+', Whitespace), + + # Modules + (r'^(\s*)(module)(\s*)', + bygroups(Whitespace, Keyword.Namespace, Whitespace), + 'imports'), + + (builtinTypes, Keyword.Type), + + # Main + (r'^prql ', Keyword.Reserved), + + ('let', Keyword.Declaration), + + include('keywords'), + include('expr'), + + # Transforms + (r'^[A-Za-z_][a-zA-Z0-9_]*', Keyword), + ], + 'expr': [ + # non-raw f-strings + ('(f)(""")', bygroups(String.Affix, String.Double), + combined('fstringescape', 'tdqf')), + ("(f)(''')", bygroups(String.Affix, String.Single), + combined('fstringescape', 'tsqf')), + ('(f)(")', bygroups(String.Affix, String.Double), + combined('fstringescape', 'dqf')), + ("(f)(')", bygroups(String.Affix, String.Single), + combined('fstringescape', 'sqf')), + + # non-raw s-strings + ('(s)(""")', bygroups(String.Affix, String.Double), + combined('stringescape', 'tdqf')), + ("(s)(''')", bygroups(String.Affix, String.Single), + combined('stringescape', 'tsqf')), + ('(s)(")', bygroups(String.Affix, String.Double), + combined('stringescape', 'dqf')), + ("(s)(')", bygroups(String.Affix, String.Single), + combined('stringescape', 'sqf')), + + # raw strings + ('(?i)(r)(""")', + bygroups(String.Affix, String.Double), 'tdqs'), + ("(?i)(r)(''')", + bygroups(String.Affix, String.Single), 'tsqs'), + ('(?i)(r)(")', + bygroups(String.Affix, String.Double), 'dqs'), + ("(?i)(r)(')", + bygroups(String.Affix, String.Single), 'sqs'), + + # non-raw strings + ('"""', String.Double, combined('stringescape', 'tdqs')), + ("'''", String.Single, combined('stringescape', 'tsqs')), + ('"', String.Double, combined('stringescape', 'dqs')), + ("'", String.Single, combined('stringescape', 'sqs')), + + # Time and dates + (r'@\d{4}-\d{2}-\d{2}T\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?', Literal.Date), + (r'@\d{4}-\d{2}-\d{2}', Literal.Date), + (r'@\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?', Literal.Date), + + (r'[^\S\n]+', Text), + include('numbers'), + (r'->|=>|==|!=|>=|<=|~=|&&|\|\||\?\?|\/\/', Operator), + (r'[-~+/*%=<>&^|.@]', Operator), + (r'[]{}:(),;[]', Punctuation), + include('functions'), + + # Variable Names + (r'[A-Za-z_][a-zA-Z0-9_]*', Name.Variable), + ], + 'numbers': [ + (r'(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)' + r'([eE][+-]?\d(?:_?\d)*)?', Number.Float), + (r'\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?', Number.Float), + (r'0[oO](?:_?[0-7])+', Number.Oct), + (r'0[bB](?:_?[01])+', Number.Bin), + (r'0[xX](?:_?[a-fA-F0-9])+', Number.Hex), + (r'\d(?:_?\d)*', Number.Integer), + ], + 'fstringescape': [ + include('stringescape'), + ], + 'bytesescape': [ + (r'\\([\\bfnrt"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape) + ], + 'stringescape': [ + (r'\\(N\{.*?\}|u\{[a-fA-F0-9]{1,6}\})', String.Escape), + include('bytesescape') + ], + 'fstrings-single': fstring_rules(String.Single), + 'fstrings-double': fstring_rules(String.Double), + 'strings-single': innerstring_rules(String.Single), + 'strings-double': innerstring_rules(String.Double), + 'dqf': [ + (r'"', String.Double, '#pop'), + (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings + include('fstrings-double') + ], + 'sqf': [ + (r"'", String.Single, '#pop'), + (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings + include('fstrings-single') + ], + 'dqs': [ + (r'"', String.Double, '#pop'), + (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings + include('strings-double') + ], + 'sqs': [ + (r"'", String.Single, '#pop'), + (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings + include('strings-single') + ], + 'tdqf': [ + (r'"""', String.Double, '#pop'), + include('fstrings-double'), + (r'\n', String.Double) + ], + 'tsqf': [ + (r"'''", String.Single, '#pop'), + include('fstrings-single'), + (r'\n', String.Single) + ], + 'tdqs': [ + (r'"""', String.Double, '#pop'), + include('strings-double'), + (r'\n', String.Double) + ], + 'tsqs': [ + (r"'''", String.Single, '#pop'), + include('strings-single'), + (r'\n', String.Single) + ], + + 'expr-inside-fstring': [ + (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), + # without format specifier + (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) + r'\}', String.Interpol, '#pop'), + # with format specifier + # we'll catch the remaining '}' in the outer scope + (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) + r':', String.Interpol, '#pop'), + (r'\s+', Whitespace), # allow new lines + include('expr'), + ], + 'expr-inside-fstring-inner': [ + (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), + (r'[])}]', Punctuation, '#pop'), + (r'\s+', Whitespace), # allow new lines + include('expr'), + ], + 'keywords': [ + (words(( + 'into', 'case', 'type', 'module', 'internal', + ), suffix=r'\b'), + Keyword), + (words(('true', 'false', 'null'), suffix=r'\b'), Keyword.Constant), + ], + 'functions': [ + (words(( + "min", "max", "sum", "average", "stddev", "every", "any", + "concat_array", "count", "lag", "lead", "first", "last", + "rank", "rank_dense", "row_number", "round", "as", "in", + "tuple_every", "tuple_map", "tuple_zip", "_eq", "_is_null", + "from_text", "lower", "upper", "read_parquet", "read_csv"), + suffix=r'\b'), + Name.Function), + ], + + 'comment': [ + (r'-(?!\})', Comment.Multiline), + (r'\{-', Comment.Multiline, 'comment'), + (r'[^-}]', Comment.Multiline), + (r'-\}', Comment.Multiline, '#pop'), + ], + + 'imports': [ + (r'\w+(\.\w+)*', Name.Class, '#pop'), + ], + } diff --git a/contrib/python/Pygments/py3/pygments/lexers/python.py b/contrib/python/Pygments/py3/pygments/lexers/python.py index 6537d4d9d3..cdb88ab43a 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/python.py +++ b/contrib/python/Pygments/py3/pygments/lexers/python.py @@ -35,8 +35,8 @@ class PythonLexer(RegexLexer): """ name = 'Python' - url = 'http://www.python.org' - aliases = ['python', 'py', 'sage', 'python3', 'py3'] + url = 'https://www.python.org' + aliases = ['python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark'] filenames = [ '*.py', '*.pyw', @@ -425,7 +425,7 @@ class Python2Lexer(RegexLexer): """ name = 'Python 2.x' - url = 'http://www.python.org' + url = 'https://www.python.org' aliases = ['python2', 'py2'] filenames = [] # now taken over by PythonLexer (3.x) mimetypes = ['text/x-python2', 'application/x-python2'] @@ -830,7 +830,7 @@ class CythonLexer(RegexLexer): """ name = 'Cython' - url = 'http://cython.org' + url = 'https://cython.org' aliases = ['cython', 'pyx', 'pyrex'] filenames = ['*.pyx', '*.pxd', '*.pxi'] mimetypes = ['text/x-cython', 'application/x-cython'] diff --git a/contrib/python/Pygments/py3/pygments/lexers/rdf.py b/contrib/python/Pygments/py3/pygments/lexers/rdf.py index 5931c70d59..c4fb998c4d 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/rdf.py +++ b/contrib/python/Pygments/py3/pygments/lexers/rdf.py @@ -260,6 +260,10 @@ class TurtleLexer(RegexLexer): (r'(' + PN_PREFIX + r')?(\:)(' + PN_LOCAL + r')?', bygroups(Name.Namespace, Punctuation, Name.Tag)), + # BlankNodeLabel + (r'(_)(:)([' + PN_CHARS_U_GRP + r'0-9]([' + PN_CHARS_GRP + r'.]*' + PN_CHARS + ')?)', + bygroups(Name.Namespace, Punctuation, Name.Tag)), + # Comment (r'#[^\n]+', Comment), diff --git a/contrib/python/Pygments/py3/pygments/lexers/spice.py b/contrib/python/Pygments/py3/pygments/lexers/spice.py index 6d6cb9e1da..5c2d8f2961 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/spice.py +++ b/contrib/python/Pygments/py3/pygments/lexers/spice.py @@ -48,7 +48,7 @@ class SpiceLexer(RegexLexer): (r'(true|false|nil)\b', Keyword.Constant), (words(('double', 'int', 'short', 'long', 'byte', 'char', 'string', 'bool', 'dyn'), suffix=r'\b'), Keyword.Type), - (words(('printf', 'sizeof', 'alignof', 'len'), suffix=r'\b(\()'), + (words(('printf', 'sizeof', 'alignof', 'len', 'panic'), suffix=r'\b(\()'), bygroups(Name.Builtin, Punctuation)), # numeric literals (r'[-]?[0-9]*[.][0-9]+([eE][+-]?[0-9]+)?', Number.Double), @@ -62,7 +62,7 @@ class SpiceLexer(RegexLexer): (r'\'(\\\\|\\[^\\]|[^\'\\])\'', String.Char), # tokens (r'<<=|>>=|<<|>>|<=|>=|\+=|-=|\*=|/=|\%=|\|=|&=|\^=|&&|\|\||&|\||' - r'\+\+|--|\%|\^|\~|==|!=|::|[.]{3}|#!|#|[+\-*/&]', Operator), + r'\+\+|--|\%|\^|\~|==|!=|->|::|[.]{3}|#!|#|[+\-*/&]', Operator), (r'[|<>=!()\[\]{}.,;:\?]', Punctuation), # identifiers (r'[^\W\d]\w*', Name.Other), diff --git a/contrib/python/Pygments/py3/pygments/lexers/theorem.py b/contrib/python/Pygments/py3/pygments/lexers/theorem.py index 529451adc6..abf09ae171 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/theorem.py +++ b/contrib/python/Pygments/py3/pygments/lexers/theorem.py @@ -4,6 +4,8 @@ Lexers for theorem-proving languages. + See also :mod:`pygments.lexers.lean` + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -13,8 +15,9 @@ import re from pygments.lexer import RegexLexer, default, words, include from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Generic, Whitespace +from pygments.lexers.lean import LeanLexer -__all__ = ['CoqLexer', 'IsabelleLexer', 'LeanLexer'] +__all__ = ['CoqLexer', 'IsabelleLexer'] class CoqLexer(RegexLexer): @@ -386,108 +389,3 @@ class IsabelleLexer(RegexLexer): (r'`', String.Other, '#pop'), ], } - - -class LeanLexer(RegexLexer): - """ - For the Lean theorem prover. - - .. versionadded:: 2.0 - """ - name = 'Lean' - url = 'https://github.com/leanprover/lean' - aliases = ['lean'] - filenames = ['*.lean'] - mimetypes = ['text/x-lean'] - - tokens = { - 'expression': [ - (r'\s+', Text), - (r'/--', String.Doc, 'docstring'), - (r'/-', Comment, 'comment'), - (r'--.*?$', Comment.Single), - (words(( - 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices', - 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match', - 'do' - ), prefix=r'\b', suffix=r'\b'), Keyword), - (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error), - (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type), - (words(( - '(', ')', ':', '{', '}', '[', ']', '⟨', '⟩', '‹', '›', '⦃', '⦄', ':=', ',', - )), Operator), - (r'[A-Za-z_\u03b1-\u03ba\u03bc-\u03fb\u1f00-\u1ffe\u2100-\u214f]' - r'[.A-Za-z_\'\u03b1-\u03ba\u03bc-\u03fb\u1f00-\u1ffe\u2070-\u2079' - r'\u207f-\u2089\u2090-\u209c\u2100-\u214f0-9]*', Name), - (r'0x[A-Za-z0-9]+', Number.Integer), - (r'0b[01]+', Number.Integer), - (r'\d+', Number.Integer), - (r'"', String.Double, 'string'), - (r"'(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})|.)'", String.Char), - (r'[~?][a-z][\w\']*:', Name.Variable), - (r'\S', Name.Builtin.Pseudo), - ], - 'root': [ - (words(( - 'import', 'renaming', 'hiding', - 'namespace', - 'local', - 'private', 'protected', 'section', - 'include', 'omit', 'section', - 'protected', 'export', - 'open', - 'attribute', - ), prefix=r'\b', suffix=r'\b'), Keyword.Namespace), - (words(( - 'lemma', 'theorem', 'def', 'definition', 'example', - 'axiom', 'axioms', 'constant', 'constants', - 'universe', 'universes', - 'inductive', 'coinductive', 'structure', 'extends', - 'class', 'instance', - 'abbreviation', - - 'noncomputable theory', - - 'noncomputable', 'mutual', 'meta', - - 'attribute', - - 'parameter', 'parameters', - 'variable', 'variables', - - 'reserve', 'precedence', - 'postfix', 'prefix', 'notation', 'infix', 'infixl', 'infixr', - - 'begin', 'by', 'end', - - 'set_option', - 'run_cmd', - ), prefix=r'\b', suffix=r'\b'), Keyword.Declaration), - (r'@\[', Keyword.Declaration, 'attribute'), - (words(( - '#eval', '#check', '#reduce', '#exit', - '#print', '#help', - ), suffix=r'\b'), Keyword), - include('expression') - ], - 'attribute': [ - (r'\]', Keyword.Declaration, '#pop'), - include('expression'), - ], - 'comment': [ - (r'[^/-]', Comment.Multiline), - (r'/-', Comment.Multiline, '#push'), - (r'-/', Comment.Multiline, '#pop'), - (r'[/-]', Comment.Multiline) - ], - 'docstring': [ - (r'[^/-]', String.Doc), - (r'-/', String.Doc, '#pop'), - (r'[/-]', String.Doc) - ], - 'string': [ - (r'[^\\"]+', String.Double), - (r"(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4}))", String.Escape), - ('"', String.Double, '#pop'), - ], - } diff --git a/contrib/python/Pygments/py3/pygments/lexers/vip.py b/contrib/python/Pygments/py3/pygments/lexers/vip.py new file mode 100644 index 0000000000..1b25d5cab6 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/vip.py @@ -0,0 +1,152 @@ +""" + pygments.lexers.vip + ~~~~~~~~~~~~~~~~~~~ + + Lexers for Visual Prolog & Grammar files. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, inherit, words, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Whitespace + +__all__ = ['VisualPrologLexer', 'VisualPrologGrammarLexer'] + + +class VisualPrologBaseLexer(RegexLexer): + minorendkw = ('try', 'foreach', 'if') + minorkwexp = ('and', 'catch', 'do', 'else', 'elseif', 'erroneous', 'externally', 'failure', 'finally', 'foreach', 'if', 'or', 'orelse', 'otherwise', 'then', + 'try', 'div', 'mod', 'rem', 'quot') + dockw = ('short', 'detail', 'end', 'withdomain') + tokens = { + 'root': [ + (r'\s+', Whitespace), + (words(minorendkw, prefix=r'\bend\s+', suffix=r'\b'), Keyword.Minor), + (r'end', Keyword), + (words(minorkwexp, suffix=r'\b'), Keyword.Minor), + (r'0[xo][\da-fA-F_]+', Number), + (r'((\d[\d_]*)?\.)?\d[\d_]*([eE][\-+]?\d+)?', Number), + (r'_\w*', Name.Variable.Anonymous), + (r'[A-Z]\w*', Name.Variable), + (r'@\w+', Name.Variable), + (r'[a-z]\w*', Name), + (r'/\*', Comment, 'comment'), + (r'\%', Comment, 'commentline'), + (r'"', String.Symbol, 'string'), + (r'\'', String.Symbol, 'stringsingle'), + (r'@"', String.Symbol, 'atstring'), + (r'[\-+*^/!?<>=~:]+', Operator), + (r'[$,.[\]|(){}\\]+', Punctuation), + (r'.', Text), + ], + 'commentdoc': [ + (words(dockw, prefix=r'@', suffix=r'\b'), Comment.Preproc), + (r'@', Comment), + ], + 'commentline': [ + include('commentdoc'), + (r'[^@\n]+', Comment), + (r'$', Comment, '#pop'), + ], + 'comment': [ + include('commentdoc'), + (r'[^@*/]+', Comment), + (r'/\*', Comment, '#push'), + (r'\*/', Comment, '#pop'), + (r'[*/]', Comment), + ], + 'stringescape': [ + (r'\\u[0-9a-fA-F]{4}', String.Escape), + (r'\\[\'"ntr\\]', String.Escape), + ], + 'stringsingle': [ + include('stringescape'), + (r'\'', String.Symbol, '#pop'), + (r'[^\'\\\n]+', String), + (r'\n', String.Escape.Error, '#pop'), + ], + 'string': [ + include('stringescape'), + (r'"', String.Symbol, '#pop'), + (r'[^"\\\n]+', String), + (r'\n', String.Escape.Error, '#pop'), + ], + 'atstring': [ + (r'""', String.Escape), + (r'"', String.Symbol, '#pop'), + (r'[^"]+', String), + ] + } + + +class VisualPrologLexer(VisualPrologBaseLexer): + """Lexer for VisualProlog + + .. versionadded:: 2.17 + """ + name = 'Visual Prolog' + url = 'https://www.visual-prolog.com/' + aliases = ['visualprolog'] + filenames = ['*.pro', '*.cl', '*.i', '*.pack', '*.ph'] + + majorkw = ('goal', 'namespace', 'interface', 'class', 'implement', 'where', 'open', 'inherits', 'supports', 'resolve', + 'delegate', 'monitor', 'constants', 'domains', 'predicates', 'constructors', 'properties', 'clauses', 'facts') + minorkw = ('align', 'anyflow', 'as', 'bitsize', 'determ', 'digits', 'erroneous', 'externally', 'failure', 'from', + 'guard', 'multi', 'nondeterm', 'or', 'orelse', 'otherwise', 'procedure', 'resolve', 'single', 'suspending') + directivekw = ('bininclude', 'else', 'elseif', 'endif', 'error', 'export', 'externally', 'from', 'grammargenerate', + 'grammarinclude', 'if', 'include', 'message', 'options', 'orrequires', 'requires', 'stringinclude', 'then') + tokens = { + 'root': [ + (words(minorkw, suffix=r'\b'), Keyword.Minor), + (words(majorkw, suffix=r'\b'), Keyword), + (words(directivekw, prefix='#', suffix=r'\b'), Keyword.Directive), + inherit + ] + } + + def analyse_text(text): + """Competes with IDL and Prolog on *.pro; div. lisps on*.cl and SwigLexer on *.i""" + # These are *really* good indicators (and not conflicting with the other languages) + # end-scope first on line e.g. 'end implement' + # section keyword alone on line e.g. 'clauses' + if re.search(r'^\s*(end\s+(interface|class|implement)|(clauses|predicates|domains|facts|constants|properties)\s*$)', text): + return 0.98 + else: + return 0 + + +class VisualPrologGrammarLexer(VisualPrologBaseLexer): + """Lexer for VisualProlog grammar + + .. versionadded:: 2.17 + """ + + name = 'Visual Prolog Grammar' + url = 'https://www.visual-prolog.com/' + aliases = ['visualprologgrammar'] + filenames = ['*.vipgrm'] + + majorkw = ('open', 'namespace', 'grammar', 'nonterminals', + 'startsymbols', 'terminals', 'rules', 'precedence') + directivekw = ('bininclude', 'stringinclude') + tokens = { + 'root': [ + (words(majorkw, suffix=r'\b'), Keyword), + (words(directivekw, prefix='#', suffix=r'\b'), Keyword.Directive), + inherit + ] + } + + def analyse_text(text): + """No competditors (currently)""" + # These are *really* good indicators + # end-scope first on line e.g. 'end grammar' + # section keyword alone on line e.g. 'rules' + if re.search(r'^\s*(end\s+grammar|(nonterminals|startsymbols|terminals|rules|precedence)\s*$)', text): + return 0.98 + else: + return 0 diff --git a/contrib/python/Pygments/py3/pygments/lexers/vyper.py b/contrib/python/Pygments/py3/pygments/lexers/vyper.py new file mode 100644 index 0000000000..ff9d0b0440 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/lexers/vyper.py @@ -0,0 +1,141 @@ +""" + pygments.lexers.vyper + ~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Vyper Smart Contract language. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import (Comment, String, Name, Keyword, Number, + Operator, Punctuation, Text, Whitespace) + +__all__ = ['VyperLexer'] + + +class VyperLexer(RegexLexer): + """For the Vyper smart contract language. + + .. versionadded:: 2.17 + """ + name = 'Vyper' + aliases = ['vyper'] + filenames = ['*.vy'] + url = "https://vyper.readthedocs.io" + + tokens = { + 'root': [ + # Whitespace + (r'\s+', Whitespace), + + # Line continuations + (r'(\\)(\n|\r\n|\r)', bygroups(Text, Whitespace)), + + # Comments - inline and multiline + (r'#.*$', Comment.Single), + (r'\"\"\"', Comment.Multiline, 'multiline-comment'), + + # Strings - single and double + (r"'", String.Single, 'single-string'), + (r'"', String.Double, 'double-string'), + + # Functions (working) + (r'(def)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)', + bygroups(Keyword, Whitespace, Name.Function)), + + # Event and Struct + (r'(event|struct|interface|log)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)', + bygroups(Keyword, Whitespace, Name.Class)), + + # Imports + (r'(from)(\s+)(vyper\.\w+)(\s+)(import)(\s+)(\w+)', + bygroups(Keyword, Whitespace, Name.Namespace, Whitespace, + Keyword, Whitespace, Name.Class)), + + # Numeric Literals + (r'\b0x[0-9a-fA-F]+\b', Number.Hex), + (r'\b(\d{1,3}(?:_\d{3})*|\d+)\b', Number.Integer), + (r'\b\d+\.\d*\b', Number.Float), + + # Keywords + (words(('def', 'event', 'pass', 'return', 'for', 'while', 'if', 'elif', + 'else', 'assert', 'raise', 'import', 'in', 'struct', 'implements', + 'interface', 'from', 'indexed', 'log'), + prefix=r'\b', suffix=r'\b'), Keyword), + + # Visibility and State Mutability + (words(('public', 'private', 'view', 'pure', 'constant', + 'immutable', 'nonpayable'), prefix=r'\b', suffix=r'\b'), + Keyword.Declaration), + + # Built-in Functions + (words(('bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'shift', + 'create_minimal_proxy_to', 'create_copy_of', 'create_from_blueprint', + 'ecadd', 'ecmul', 'ecrecover', 'keccak256', 'sha256', 'concat', 'convert', + 'uint2str', 'extract32', 'slice', 'abs', 'ceil', 'floor', 'max', 'max_value', + 'min', 'min_value', 'pow_mod256', 'sqrt', 'isqrt', 'uint256_addmod', + 'uint256_mulmod', 'unsafe_add', 'unsafe_sub', 'unsafe_mul', 'unsafe_div', + 'as_wei_value', 'blockhash', 'empty', 'len', 'method_id', '_abi_encode', + '_abi_decode', 'print', 'range'), prefix=r'\b', suffix=r'\b'), + Name.Builtin), + + # Built-in Variables and Attributes + (words(('msg.sender', 'msg.value', 'block.timestamp', 'block.number', 'msg.gas'), + prefix=r'\b', suffix=r'\b'), + Name.Builtin.Pseudo), + + (words(('uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256', + 'int', 'int8', 'int16', 'int32', 'int64', 'int128', 'int256', 'bool', + 'decimal', 'bytes', 'bytes1', 'bytes2', 'bytes3', 'bytes4', 'bytes5', + 'bytes6', 'bytes7', 'bytes8', 'bytes9', 'bytes10', 'bytes11', + 'bytes12', 'bytes13', 'bytes14', 'bytes15', 'bytes16', 'bytes17', + 'bytes18', 'bytes19', 'bytes20', 'bytes21', 'bytes22', 'bytes23', + 'bytes24', 'bytes25', 'bytes26', 'bytes27', 'bytes28', 'bytes29', + 'bytes30', 'bytes31', 'bytes32', 'string', 'String', 'address', + 'enum', 'struct'), prefix=r'\b', suffix=r'\b'), + Keyword.Type), + + # indexed keywords + (r'\b(indexed)\b(\s*)(\()(\s*)(\w+)(\s*)(\))', + bygroups(Keyword, Whitespace, Punctuation, Whitespace, + Keyword.Type, Punctuation)), + + # Operators and Punctuation + (r'(\+|\-|\*|\/|<=?|>=?|==|!=|=|\||&|%)', Operator), + (r'[.,:;()\[\]{}]', Punctuation), + + # Other variable names and types + (r'@[\w.]+', Name.Decorator), + (r'__\w+__', Name.Magic), # Matches double underscores followed by word characters + (r'EMPTY_BYTES32', Name.Constant), + (r'\bERC20\b', Name.Class), + (r'\bself\b', Name.Attribute), + + (r'Bytes\[\d+\]', Keyword.Type), + + # Generic names and variables + (r'\b[a-zA-Z_]\w*\b:', Name.Variable), + (r'\b[a-zA-Z_]\w*\b', Name), + + ], + + 'multiline-comment': [ + (r'\"\"\"', Comment.Multiline, '#pop'), + (r'[^"]+', Comment.Multiline), + (r'\"', Comment.Multiline) + ], + + 'single-string': [ + (r"[^\\']+", String.Single), + (r"'", String.Single, '#pop'), + (r'\\.', String.Escape), + ], + + 'double-string': [ + (r'[^\\"]+', String.Double), + (r'"', String.Double, '#pop'), + (r'\\.', String.Escape), + ] + } diff --git a/contrib/python/Pygments/py3/pygments/style.py b/contrib/python/Pygments/py3/pygments/style.py index 07e8f951ef..96eb92c2bf 100644 --- a/contrib/python/Pygments/py3/pygments/style.py +++ b/contrib/python/Pygments/py3/pygments/style.py @@ -190,6 +190,12 @@ class Style(metaclass=StyleMeta): #: Style definitions for individual token types. styles = {} + #: user-friendly style name (used when selecting the style, so this + # should be all-lowercase, no spaces, hyphens) + name = 'unnamed' + + aliases = [] + # Attribute for lexers defined within Pygments. If set # to True, the style is not shown in the style gallery # on the website. This is intended for language-specific diff --git a/contrib/python/Pygments/py3/pygments/styles/__init__.py b/contrib/python/Pygments/py3/pygments/styles/__init__.py index b5b9de7979..75ac30bb98 100644 --- a/contrib/python/Pygments/py3/pygments/styles/__init__.py +++ b/contrib/python/Pygments/py3/pygments/styles/__init__.py @@ -10,60 +10,15 @@ from pygments.plugin import find_plugin_styles from pygments.util import ClassNotFound +from pygments.styles._mapping import STYLES #: A dictionary of built-in styles, mapping style names to #: ``'submodule::classname'`` strings. -STYLE_MAP = { - 'abap': 'abap::AbapStyle', - 'algol_nu': 'algol_nu::Algol_NuStyle', - 'algol': 'algol::AlgolStyle', - 'arduino': 'arduino::ArduinoStyle', - 'autumn': 'autumn::AutumnStyle', - 'borland': 'borland::BorlandStyle', - 'bw': 'bw::BlackWhiteStyle', - 'colorful': 'colorful::ColorfulStyle', - 'default': 'default::DefaultStyle', - 'dracula': 'dracula::DraculaStyle', - 'emacs': 'emacs::EmacsStyle', - 'friendly_grayscale': 'friendly_grayscale::FriendlyGrayscaleStyle', - 'friendly': 'friendly::FriendlyStyle', - 'fruity': 'fruity::FruityStyle', - 'github-dark': 'gh_dark::GhDarkStyle', - 'gruvbox-dark': 'gruvbox::GruvboxDarkStyle', - 'gruvbox-light': 'gruvbox::GruvboxLightStyle', - 'igor': 'igor::IgorStyle', - 'inkpot': 'inkpot::InkPotStyle', - 'lightbulb': 'lightbulb::LightbulbStyle', - 'lilypond': 'lilypond::LilyPondStyle', - 'lovelace': 'lovelace::LovelaceStyle', - 'manni': 'manni::ManniStyle', - 'material': 'material::MaterialStyle', - 'monokai': 'monokai::MonokaiStyle', - 'murphy': 'murphy::MurphyStyle', - 'native': 'native::NativeStyle', - 'nord-darker': 'nord::NordDarkerStyle', - 'nord': 'nord::NordStyle', - 'one-dark': 'onedark::OneDarkStyle', - 'paraiso-dark': 'paraiso_dark::ParaisoDarkStyle', - 'paraiso-light': 'paraiso_light::ParaisoLightStyle', - 'pastie': 'pastie::PastieStyle', - 'perldoc': 'perldoc::PerldocStyle', - 'rainbow_dash': 'rainbow_dash::RainbowDashStyle', - 'rrt': 'rrt::RrtStyle', - 'sas': 'sas::SasStyle', - 'solarized-dark': 'solarized::SolarizedDarkStyle', - 'solarized-light': 'solarized::SolarizedLightStyle', - 'staroffice': 'staroffice::StarofficeStyle', - 'stata-dark': 'stata_dark::StataDarkStyle', - 'stata-light': 'stata_light::StataLightStyle', - 'stata': 'stata_light::StataLightStyle', - 'tango': 'tango::TangoStyle', - 'trac': 'trac::TracStyle', - 'vim': 'vim::VimStyle', - 'vs': 'vs::VisualStudioStyle', - 'xcode': 'xcode::XcodeStyle', - 'zenburn': 'zenburn::ZenburnStyle' -} +#: This list is deprecated. Use `pygments.styles.STYLES` instead +STYLE_MAP = {v[1]: v[0].split('.')[-1] + '::' + k for k, v in STYLES.items()} + +#: Internal reverse mapping to make `get_style_by_name` more efficient +_STYLE_NAME_TO_MODULE_MAP = {v[1]: (v[0], k) for k, v in STYLES.items()} def get_style_by_name(name): @@ -74,8 +29,8 @@ def get_style_by_name(name): Will raise :exc:`pygments.util.ClassNotFound` if no style of that name is found. """ - if name in STYLE_MAP: - mod, cls = STYLE_MAP[name].split('::') + if name in _STYLE_NAME_TO_MODULE_MAP: + mod, cls = _STYLE_NAME_TO_MODULE_MAP[name] builtin = "yes" else: for found_name, style in find_plugin_styles(): @@ -83,14 +38,15 @@ def get_style_by_name(name): return style # perhaps it got dropped into our styles package builtin = "" - mod = name + mod = 'pygments.styles.' + name cls = name.title() + "Style" try: - mod = __import__('pygments.styles.' + mod, None, None, [cls]) + mod = __import__(mod, None, None, [cls]) except ImportError: raise ClassNotFound("Could not find style module %r" % mod + - (builtin and ", though it should be builtin") + ".") + (builtin and ", though it should be builtin") + + ".") try: return getattr(mod, cls) except AttributeError: @@ -99,6 +55,7 @@ def get_style_by_name(name): def get_all_styles(): """Return a generator for all styles by name, both builtin and plugin.""" - yield from STYLE_MAP + for v in STYLES.values(): + yield v[1] for name, _ in find_plugin_styles(): yield name diff --git a/contrib/python/Pygments/py3/pygments/styles/_mapping.py b/contrib/python/Pygments/py3/pygments/styles/_mapping.py new file mode 100644 index 0000000000..04c7ddfbb0 --- /dev/null +++ b/contrib/python/Pygments/py3/pygments/styles/_mapping.py @@ -0,0 +1,53 @@ +# Automatically generated by scripts/gen_mapfiles.py. +# DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. + +STYLES = { + 'AbapStyle': ('pygments.styles.abap', 'abap', ()), + 'AlgolStyle': ('pygments.styles.algol', 'algol', ()), + 'Algol_NuStyle': ('pygments.styles.algol_nu', 'algol_nu', ()), + 'ArduinoStyle': ('pygments.styles.arduino', 'arduino', ()), + 'AutumnStyle': ('pygments.styles.autumn', 'autumn', ()), + 'BlackWhiteStyle': ('pygments.styles.bw', 'bw', ()), + 'BorlandStyle': ('pygments.styles.borland', 'borland', ()), + 'ColorfulStyle': ('pygments.styles.colorful', 'colorful', ()), + 'DefaultStyle': ('pygments.styles.default', 'default', ()), + 'DraculaStyle': ('pygments.styles.dracula', 'dracula', ()), + 'EmacsStyle': ('pygments.styles.emacs', 'emacs', ()), + 'FriendlyGrayscaleStyle': ('pygments.styles.friendly_grayscale', 'friendly_grayscale', ()), + 'FriendlyStyle': ('pygments.styles.friendly', 'friendly', ()), + 'FruityStyle': ('pygments.styles.fruity', 'fruity', ()), + 'GhDarkStyle': ('pygments.styles.gh_dark', 'github-dark', ()), + 'GruvboxDarkStyle': ('pygments.styles.gruvbox', 'gruvbox-dark', ()), + 'GruvboxLightStyle': ('pygments.styles.gruvbox', 'gruvbox-light', ()), + 'IgorStyle': ('pygments.styles.igor', 'igor', ()), + 'InkPotStyle': ('pygments.styles.inkpot', 'inkpot', ()), + 'LightbulbStyle': ('pygments.styles.lightbulb', 'lightbulb', ()), + 'LilyPondStyle': ('pygments.styles.lilypond', 'lilypond', ()), + 'LovelaceStyle': ('pygments.styles.lovelace', 'lovelace', ()), + 'ManniStyle': ('pygments.styles.manni', 'manni', ()), + 'MaterialStyle': ('pygments.styles.material', 'material', ()), + 'MonokaiStyle': ('pygments.styles.monokai', 'monokai', ()), + 'MurphyStyle': ('pygments.styles.murphy', 'murphy', ()), + 'NativeStyle': ('pygments.styles.native', 'native', ()), + 'NordDarkerStyle': ('pygments.styles.nord', 'nord-darker', ()), + 'NordStyle': ('pygments.styles.nord', 'nord', ()), + 'OneDarkStyle': ('pygments.styles.onedark', 'one-dark', ()), + 'ParaisoDarkStyle': ('pygments.styles.paraiso_dark', 'paraiso-dark', ()), + 'ParaisoLightStyle': ('pygments.styles.paraiso_light', 'paraiso-light', ()), + 'PastieStyle': ('pygments.styles.pastie', 'pastie', ()), + 'PerldocStyle': ('pygments.styles.perldoc', 'perldoc', ()), + 'RainbowDashStyle': ('pygments.styles.rainbow_dash', 'rainbow_dash', ()), + 'RrtStyle': ('pygments.styles.rrt', 'rrt', ()), + 'SasStyle': ('pygments.styles.sas', 'sas', ()), + 'SolarizedDarkStyle': ('pygments.styles.solarized', 'solarized-dark', ()), + 'SolarizedLightStyle': ('pygments.styles.solarized', 'solarized-light', ()), + 'StarofficeStyle': ('pygments.styles.staroffice', 'staroffice', ()), + 'StataDarkStyle': ('pygments.styles.stata_dark', 'stata-dark', ()), + 'StataLightStyle': ('pygments.styles.stata_light', 'stata-light', ()), + 'TangoStyle': ('pygments.styles.tango', 'tango', ()), + 'TracStyle': ('pygments.styles.trac', 'trac', ()), + 'VimStyle': ('pygments.styles.vim', 'vim', ()), + 'VisualStudioStyle': ('pygments.styles.vs', 'vs', ()), + 'XcodeStyle': ('pygments.styles.xcode', 'xcode', ()), + 'ZenburnStyle': ('pygments.styles.zenburn', 'zenburn', ()), +} diff --git a/contrib/python/Pygments/py3/pygments/styles/abap.py b/contrib/python/Pygments/py3/pygments/styles/abap.py index cdb8e9e75d..ab322df9cf 100644 --- a/contrib/python/Pygments/py3/pygments/styles/abap.py +++ b/contrib/python/Pygments/py3/pygments/styles/abap.py @@ -13,7 +13,11 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator +__all__ = ['AbapStyle'] + + class AbapStyle(Style): + name = 'abap' styles = { Comment: 'italic #888', diff --git a/contrib/python/Pygments/py3/pygments/styles/algol.py b/contrib/python/Pygments/py3/pygments/styles/algol.py index 7b586f8cc8..83319e0ab7 100644 --- a/contrib/python/Pygments/py3/pygments/styles/algol.py +++ b/contrib/python/Pygments/py3/pygments/styles/algol.py @@ -33,7 +33,11 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, Operator +__all__ = ['AlgolStyle'] + + class AlgolStyle(Style): + name = 'algol' background_color = "#ffffff" diff --git a/contrib/python/Pygments/py3/pygments/styles/algol_nu.py b/contrib/python/Pygments/py3/pygments/styles/algol_nu.py index 5d0d8202d1..de1434dc84 100644 --- a/contrib/python/Pygments/py3/pygments/styles/algol_nu.py +++ b/contrib/python/Pygments/py3/pygments/styles/algol_nu.py @@ -33,7 +33,11 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, Operator +__all__ = ['Algol_NuStyle'] + + class Algol_NuStyle(Style): + name = 'algol_nu' background_color = "#ffffff" diff --git a/contrib/python/Pygments/py3/pygments/styles/arduino.py b/contrib/python/Pygments/py3/pygments/styles/arduino.py index 9c58f25c06..8655b03712 100644 --- a/contrib/python/Pygments/py3/pygments/styles/arduino.py +++ b/contrib/python/Pygments/py3/pygments/styles/arduino.py @@ -13,84 +13,88 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['ArduinoStyle'] + + class ArduinoStyle(Style): """ The Arduino® language style. This style is designed to highlight the Arduino source code, so expect the best results with it. """ + name = 'arduino' background_color = "#ffffff" styles = { - Whitespace: "", # class: 'w' - Error: "#a61717", # class: 'err' - - Comment: "#95a5a6", # class: 'c' - Comment.Multiline: "", # class: 'cm' - Comment.Preproc: "#728E00", # class: 'cp' - Comment.Single: "", # class: 'c1' - Comment.Special: "", # class: 'cs' - - Keyword: "#728E00", # class: 'k' - Keyword.Constant: "#00979D", # class: 'kc' - Keyword.Declaration: "", # class: 'kd' - Keyword.Namespace: "", # class: 'kn' - Keyword.Pseudo: "#00979D", # class: 'kp' - Keyword.Reserved: "#00979D", # class: 'kr' - Keyword.Type: "#00979D", # class: 'kt' - - Operator: "#728E00", # class: 'o' - Operator.Word: "", # class: 'ow' - - Name: "#434f54", # class: 'n' - Name.Attribute: "", # class: 'na' - Name.Builtin: "#728E00", # class: 'nb' - Name.Builtin.Pseudo: "", # class: 'bp' - Name.Class: "", # class: 'nc' - Name.Constant: "", # class: 'no' - Name.Decorator: "", # class: 'nd' - Name.Entity: "", # class: 'ni' - Name.Exception: "", # class: 'ne' - Name.Function: "#D35400", # class: 'nf' - Name.Property: "", # class: 'py' - Name.Label: "", # class: 'nl' - Name.Namespace: "", # class: 'nn' - Name.Other: "#728E00", # class: 'nx' - Name.Tag: "", # class: 'nt' - Name.Variable: "", # class: 'nv' - Name.Variable.Class: "", # class: 'vc' - Name.Variable.Global: "", # class: 'vg' - Name.Variable.Instance: "", # class: 'vi' - - Number: "#8A7B52", # class: 'm' - Number.Float: "", # class: 'mf' - Number.Hex: "", # class: 'mh' - Number.Integer: "", # class: 'mi' - Number.Integer.Long: "", # class: 'il' - Number.Oct: "", # class: 'mo' - - String: "#7F8C8D", # class: 's' - String.Backtick: "", # class: 'sb' - String.Char: "", # class: 'sc' - String.Doc: "", # class: 'sd' - String.Double: "", # class: 's2' - String.Escape: "", # class: 'se' - String.Heredoc: "", # class: 'sh' - String.Interpol: "", # class: 'si' - String.Other: "", # class: 'sx' - String.Regex: "", # class: 'sr' - String.Single: "", # class: 's1' - String.Symbol: "", # class: 'ss' - - Generic: "", # class: 'g' - Generic.Deleted: "", # class: 'gd', - Generic.Emph: "", # class: 'ge' - Generic.Error: "", # class: 'gr' - Generic.Heading: "", # class: 'gh' - Generic.Inserted: "", # class: 'gi' - Generic.Output: "", # class: 'go' - Generic.Prompt: "", # class: 'gp' - Generic.Strong: "", # class: 'gs' - Generic.Subheading: "", # class: 'gu' - Generic.Traceback: "", # class: 'gt' + Whitespace: "", # class: 'w' + Error: "#a61717", # class: 'err' + + Comment: "#95a5a6", # class: 'c' + Comment.Multiline: "", # class: 'cm' + Comment.Preproc: "#728E00", # class: 'cp' + Comment.Single: "", # class: 'c1' + Comment.Special: "", # class: 'cs' + + Keyword: "#728E00", # class: 'k' + Keyword.Constant: "#00979D", # class: 'kc' + Keyword.Declaration: "", # class: 'kd' + Keyword.Namespace: "", # class: 'kn' + Keyword.Pseudo: "#00979D", # class: 'kp' + Keyword.Reserved: "#00979D", # class: 'kr' + Keyword.Type: "#00979D", # class: 'kt' + + Operator: "#728E00", # class: 'o' + Operator.Word: "", # class: 'ow' + + Name: "#434f54", # class: 'n' + Name.Attribute: "", # class: 'na' + Name.Builtin: "#728E00", # class: 'nb' + Name.Builtin.Pseudo: "", # class: 'bp' + Name.Class: "", # class: 'nc' + Name.Constant: "", # class: 'no' + Name.Decorator: "", # class: 'nd' + Name.Entity: "", # class: 'ni' + Name.Exception: "", # class: 'ne' + Name.Function: "#D35400", # class: 'nf' + Name.Property: "", # class: 'py' + Name.Label: "", # class: 'nl' + Name.Namespace: "", # class: 'nn' + Name.Other: "#728E00", # class: 'nx' + Name.Tag: "", # class: 'nt' + Name.Variable: "", # class: 'nv' + Name.Variable.Class: "", # class: 'vc' + Name.Variable.Global: "", # class: 'vg' + Name.Variable.Instance: "", # class: 'vi' + + Number: "#8A7B52", # class: 'm' + Number.Float: "", # class: 'mf' + Number.Hex: "", # class: 'mh' + Number.Integer: "", # class: 'mi' + Number.Integer.Long: "", # class: 'il' + Number.Oct: "", # class: 'mo' + + String: "#7F8C8D", # class: 's' + String.Backtick: "", # class: 'sb' + String.Char: "", # class: 'sc' + String.Doc: "", # class: 'sd' + String.Double: "", # class: 's2' + String.Escape: "", # class: 'se' + String.Heredoc: "", # class: 'sh' + String.Interpol: "", # class: 'si' + String.Other: "", # class: 'sx' + String.Regex: "", # class: 'sr' + String.Single: "", # class: 's1' + String.Symbol: "", # class: 'ss' + + Generic: "", # class: 'g' + Generic.Deleted: "", # class: 'gd', + Generic.Emph: "", # class: 'ge' + Generic.Error: "", # class: 'gr' + Generic.Heading: "", # class: 'gh' + Generic.Inserted: "", # class: 'gi' + Generic.Output: "", # class: 'go' + Generic.Prompt: "", # class: 'gp' + Generic.Strong: "", # class: 'gs' + Generic.Subheading: "", # class: 'gu' + Generic.Traceback: "", # class: 'gt' } diff --git a/contrib/python/Pygments/py3/pygments/styles/autumn.py b/contrib/python/Pygments/py3/pygments/styles/autumn.py index ac1949c5c3..ccbb5fe774 100644 --- a/contrib/python/Pygments/py3/pygments/styles/autumn.py +++ b/contrib/python/Pygments/py3/pygments/styles/autumn.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['AutumnStyle'] + + class AutumnStyle(Style): """ A colorful style, inspired by the terminal highlighting style. """ + name = 'autumn' styles = { Whitespace: '#bbbbbb', diff --git a/contrib/python/Pygments/py3/pygments/styles/borland.py b/contrib/python/Pygments/py3/pygments/styles/borland.py index cf1529fbee..82c00ae138 100644 --- a/contrib/python/Pygments/py3/pygments/styles/borland.py +++ b/contrib/python/Pygments/py3/pygments/styles/borland.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['BorlandStyle'] + + class BorlandStyle(Style): """ Style similar to the style used in the borland IDEs. """ + name = 'borland' styles = { Whitespace: '#bbbbbb', diff --git a/contrib/python/Pygments/py3/pygments/styles/bw.py b/contrib/python/Pygments/py3/pygments/styles/bw.py index e4caced1e9..3ba00925fb 100644 --- a/contrib/python/Pygments/py3/pygments/styles/bw.py +++ b/contrib/python/Pygments/py3/pygments/styles/bw.py @@ -13,7 +13,11 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Operator, Generic +__all__ = ['BlackWhiteStyle'] + + class BlackWhiteStyle(Style): + name = 'bw' background_color = "#ffffff" diff --git a/contrib/python/Pygments/py3/pygments/styles/colorful.py b/contrib/python/Pygments/py3/pygments/styles/colorful.py index 440fd640b4..661a9e446d 100644 --- a/contrib/python/Pygments/py3/pygments/styles/colorful.py +++ b/contrib/python/Pygments/py3/pygments/styles/colorful.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['ColorfulStyle'] + + class ColorfulStyle(Style): """ A colorful style, inspired by CodeRay. """ + name = 'colorful' styles = { Whitespace: "#bbbbbb", diff --git a/contrib/python/Pygments/py3/pygments/styles/default.py b/contrib/python/Pygments/py3/pygments/styles/default.py index d87f32b8df..f4e5b7b26d 100644 --- a/contrib/python/Pygments/py3/pygments/styles/default.py +++ b/contrib/python/Pygments/py3/pygments/styles/default.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['DefaultStyle'] + + class DefaultStyle(Style): """ The default style (inspired by Emacs 22). """ + name = 'default' background_color = "#f8f8f8" diff --git a/contrib/python/Pygments/py3/pygments/styles/dracula.py b/contrib/python/Pygments/py3/pygments/styles/dracula.py index c43875217b..d7043c0076 100644 --- a/contrib/python/Pygments/py3/pygments/styles/dracula.py +++ b/contrib/python/Pygments/py3/pygments/styles/dracula.py @@ -16,88 +16,75 @@ from pygments.token import Keyword, Name, Comment, String, Error, Literal, \ Number, Operator, Other, Punctuation, Text, Generic, Whitespace +__all__ = ['DraculaStyle'] + +background = "#282a36" +foreground = "#f8f8f2" +selection = "#44475a" +comment = "#6272a4" +cyan = "#8be9fd" +green = "#50fa7b" +orange = "#ffb86c" +pink = "#ff79c6" +purple = "#bd93f9" +red = "#ff5555" +yellow = "#f1fa8c" + +deletion = "#8b080b" + class DraculaStyle(Style): + name = 'dracula' - background_color = "#282a36" - highlight_color = "#44475a" - line_number_color = "#f1fa8c" - line_number_background_color = "#44475a" - line_number_special_color = "#50fa7b" - line_number_special_background_color = "#6272a4" + background_color = background + highlight_color = selection + line_number_color = yellow + line_number_background_color = selection + line_number_special_color = green + line_number_special_background_color = comment styles = { - Whitespace: "#f8f8f2", - - Comment: "#6272a4", - Comment.Hashbang: "#6272a4", - Comment.Multiline: "#6272a4", - Comment.Preproc: "#ff79c6", - Comment.Single: "#6272a4", - Comment.Special: "#6272a4", - - Generic: "#f8f8f2", - Generic.Deleted: "#8b080b", - Generic.Emph: "#f8f8f2 underline", - Generic.Error: "#f8f8f2", - Generic.Heading: "#f8f8f2 bold", - Generic.Inserted: "#f8f8f2 bold", - Generic.Output: "#44475a", - Generic.Prompt: "#f8f8f2", - Generic.Strong: "#f8f8f2", - Generic.EmphStrong: "#f8f8f2 underline", - Generic.Subheading: "#f8f8f2 bold", - Generic.Traceback: "#f8f8f2", - - Error: "#f8f8f2", - Keyword: "#ff79c6", - Keyword.Constant: "#ff79c6", - Keyword.Declaration: "#8be9fd italic", - Keyword.Namespace: "#ff79c6", - Keyword.Pseudo: "#ff79c6", - Keyword.Reserved: "#ff79c6", - Keyword.Type: "#8be9fd", - Literal: "#f8f8f2", - Literal.Date: "#f8f8f2", - Name: "#f8f8f2", - Name.Attribute: "#50fa7b", - Name.Builtin: "#8be9fd italic", - Name.Builtin.Pseudo: "#f8f8f2", - Name.Class: "#50fa7b", - Name.Constant: "#f8f8f2", - Name.Decorator: "#f8f8f2", - Name.Entity: "#f8f8f2", - Name.Exception: "#f8f8f2", - Name.Function: "#50fa7b", - Name.Label: "#8be9fd italic", - Name.Namespace: "#f8f8f2", - Name.Other: "#f8f8f2", - Name.Tag: "#ff79c6", - Name.Variable: "#8be9fd italic", - Name.Variable.Class: "#8be9fd italic", - Name.Variable.Global: "#8be9fd italic", - Name.Variable.Instance: "#8be9fd italic", - Number: "#ffb86c", - Number.Bin: "#ffb86c", - Number.Float: "#ffb86c", - Number.Hex: "#ffb86c", - Number.Integer: "#ffb86c", - Number.Integer.Long: "#ffb86c", - Number.Oct: "#ffb86c", - Operator: "#ff79c6", - Operator.Word: "#ff79c6", - Other: "#f8f8f2", - Punctuation: "#f8f8f2", - String: "#bd93f9", - String.Backtick: "#bd93f9", - String.Char: "#bd93f9", - String.Doc: "#bd93f9", - String.Double: "#bd93f9", - String.Escape: "#bd93f9", - String.Heredoc: "#bd93f9", - String.Interpol: "#bd93f9", - String.Other: "#bd93f9", - String.Regex: "#bd93f9", - String.Single: "#bd93f9", - String.Symbol: "#bd93f9", - Text: "#f8f8f2", + Whitespace: foreground, + + Comment: comment, + Comment.Preproc: pink, + + Generic: foreground, + Generic.Deleted: deletion, + Generic.Emph: "underline", + Generic.Heading: "bold", + Generic.Inserted: "bold", + Generic.Output: selection, + Generic.EmphStrong: "underline", + Generic.Subheading: "bold", + + Error: foreground, + + Keyword: pink, + Keyword.Constant: pink, + Keyword.Declaration: cyan + " italic", + Keyword.Type: cyan, + + Literal: foreground, + + Name: foreground, + Name.Attribute: green, + Name.Builtin: cyan + " italic", + Name.Builtin.Pseudo: foreground, + Name.Class: green, + Name.Function: green, + Name.Label: cyan + " italic", + Name.Tag: pink, + Name.Variable: cyan + " italic", + + Number: orange, + + Operator: pink, + + Other: foreground, + + Punctuation: foreground, + + String: purple, + + Text: foreground, } diff --git a/contrib/python/Pygments/py3/pygments/styles/emacs.py b/contrib/python/Pygments/py3/pygments/styles/emacs.py index 635a06f380..fad91a1348 100644 --- a/contrib/python/Pygments/py3/pygments/styles/emacs.py +++ b/contrib/python/Pygments/py3/pygments/styles/emacs.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['EmacsStyle'] + + class EmacsStyle(Style): """ The default style (inspired by Emacs 22). """ + name = 'emacs' background_color = "#f8f8f8" diff --git a/contrib/python/Pygments/py3/pygments/styles/friendly.py b/contrib/python/Pygments/py3/pygments/styles/friendly.py index 00346c20cd..8de4fcc1e4 100644 --- a/contrib/python/Pygments/py3/pygments/styles/friendly.py +++ b/contrib/python/Pygments/py3/pygments/styles/friendly.py @@ -13,10 +13,14 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['FriendlyStyle'] + + class FriendlyStyle(Style): """ A modern style based on the VIM pyte theme. """ + name = 'friendly' background_color = "#f0f0f0" line_number_color = "#666666" diff --git a/contrib/python/Pygments/py3/pygments/styles/friendly_grayscale.py b/contrib/python/Pygments/py3/pygments/styles/friendly_grayscale.py index c0d343ef52..e7d3ed47ec 100644 --- a/contrib/python/Pygments/py3/pygments/styles/friendly_grayscale.py +++ b/contrib/python/Pygments/py3/pygments/styles/friendly_grayscale.py @@ -16,12 +16,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['FriendlyGrayscaleStyle'] + + class FriendlyGrayscaleStyle(Style): """ A modern grayscale style based on the friendly style. .. versionadded:: 2.11 """ + name = 'friendly_grayscale' background_color = "#f0f0f0" diff --git a/contrib/python/Pygments/py3/pygments/styles/fruity.py b/contrib/python/Pygments/py3/pygments/styles/fruity.py index 1ce396099d..b23257d19a 100644 --- a/contrib/python/Pygments/py3/pygments/styles/fruity.py +++ b/contrib/python/Pygments/py3/pygments/styles/fruity.py @@ -12,11 +12,17 @@ from pygments.style import Style from pygments.token import Token, Comment, Name, Keyword, \ Generic, Number, String, Whitespace + +__all__ = ['FruityStyle'] + + class FruityStyle(Style): """ Pygments version of the "native" vim theme. """ + name = 'fruity' + background_color = '#111111' highlight_color = '#333333' diff --git a/contrib/python/Pygments/py3/pygments/styles/gh_dark.py b/contrib/python/Pygments/py3/pygments/styles/gh_dark.py index 045a2f1559..95f8e803d1 100644 --- a/contrib/python/Pygments/py3/pygments/styles/gh_dark.py +++ b/contrib/python/Pygments/py3/pygments/styles/gh_dark.py @@ -14,6 +14,9 @@ from pygments.token import Keyword, Name, Comment, Error, Number, Operator, \ Generic, Text, Literal, String, Token +__all__ = ['GhDarkStyle'] + + # vars are defined to match the defs in # - [GitHub's VS Code theme](https://github.com/primer/github-vscode-theme) and # - [Primer styles](https://github.com/primer/primitives) @@ -40,6 +43,8 @@ class GhDarkStyle(Style): """ Github's Dark-Colorscheme based theme for Pygments """ + + name = 'github-dark' background_color = BG_DEFAULT diff --git a/contrib/python/Pygments/py3/pygments/styles/gruvbox.py b/contrib/python/Pygments/py3/pygments/styles/gruvbox.py index 2a0b3523dd..c05f3140b3 100644 --- a/contrib/python/Pygments/py3/pygments/styles/gruvbox.py +++ b/contrib/python/Pygments/py3/pygments/styles/gruvbox.py @@ -14,10 +14,15 @@ from pygments.token import Token, Keyword, Name, Comment, String, Error, \ Number, Operator, Generic +__all__ = ['GruvboxDarkStyle', 'GruvboxLightStyle'] + + class GruvboxDarkStyle(Style): """ Pygments version of the "gruvbox" dark vim theme. """ + + name = 'gruvbox-dark' background_color = '#282828' highlight_color = '#ebdbb2' @@ -63,11 +68,14 @@ class GruvboxDarkStyle(Style): Error: 'bg:#fb4934 #282828' } + class GruvboxLightStyle(Style): """ Pygments version of the "gruvbox" Light vim theme. """ + name = 'gruvbox-light' + background_color = '#fbf1c7' highlight_color = '#3c3836' diff --git a/contrib/python/Pygments/py3/pygments/styles/igor.py b/contrib/python/Pygments/py3/pygments/styles/igor.py index 542d168d28..797e3675c4 100644 --- a/contrib/python/Pygments/py3/pygments/styles/igor.py +++ b/contrib/python/Pygments/py3/pygments/styles/igor.py @@ -12,11 +12,16 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String +__all__ = ['IgorStyle'] + + class IgorStyle(Style): """ Pygments version of the official colors for Igor Pro procedures. """ + name = 'igor' + styles = { Comment: 'italic #FF0000', Keyword: '#0000FF', diff --git a/contrib/python/Pygments/py3/pygments/styles/inkpot.py b/contrib/python/Pygments/py3/pygments/styles/inkpot.py index f1057af519..817d97f09f 100644 --- a/contrib/python/Pygments/py3/pygments/styles/inkpot.py +++ b/contrib/python/Pygments/py3/pygments/styles/inkpot.py @@ -13,8 +13,12 @@ from pygments.token import Text, Other, Keyword, Name, Comment, String, \ Error, Number, Operator, Generic, Whitespace, Punctuation -class InkPotStyle(Style): +__all__ = ['InkPotStyle'] + +class InkPotStyle(Style): + name = 'inkpot' + background_color = "#1e1e27" styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/lightbulb.py b/contrib/python/Pygments/py3/pygments/styles/lightbulb.py index 24ea443016..25c4b15598 100644 --- a/contrib/python/Pygments/py3/pygments/styles/lightbulb.py +++ b/contrib/python/Pygments/py3/pygments/styles/lightbulb.py @@ -24,6 +24,9 @@ from pygments.token import ( ) +__all__ = ['LightbulbStyle'] + + COLORS = { "bg": "#1d2331", "blue_1": "#73D0FF", @@ -47,6 +50,9 @@ class LightbulbStyle(Style): """ A minimal dark theme based on the Lightbulb theme for VSCode. """ + + name = 'lightbulb' + background_color = COLORS['bg'] highlight_color = COLORS['gray_3'] diff --git a/contrib/python/Pygments/py3/pygments/styles/lilypond.py b/contrib/python/Pygments/py3/pygments/styles/lilypond.py index a90b697846..1218ec9d32 100644 --- a/contrib/python/Pygments/py3/pygments/styles/lilypond.py +++ b/contrib/python/Pygments/py3/pygments/styles/lilypond.py @@ -11,13 +11,19 @@ from pygments.style import Style from pygments.token import Token + +__all__ = ['LilyPondStyle'] + + class LilyPondStyle(Style): """ Style for the LilyPond language. - + .. versionadded:: 2.11 """ + name = 'lilypond' + # Don't show it in the gallery, it's intended for LilyPond # input only and doesn't show good output on Python code. web_style_gallery_exclude = True diff --git a/contrib/python/Pygments/py3/pygments/styles/lovelace.py b/contrib/python/Pygments/py3/pygments/styles/lovelace.py index b4c4f333e4..279ff0793e 100644 --- a/contrib/python/Pygments/py3/pygments/styles/lovelace.py +++ b/contrib/python/Pygments/py3/pygments/styles/lovelace.py @@ -17,20 +17,25 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Punctuation, Generic, Whitespace +__all__ = ['LovelaceStyle'] + + class LovelaceStyle(Style): """ The style used in Lovelace interactive learning environment. Tries to avoid the "angry fruit salad" effect with desaturated and dim colours. """ - _KW_BLUE = '#2838b0' - _NAME_GREEN = '#388038' - _DOC_ORANGE = '#b85820' - _OW_PURPLE = '#a848a8' - _FUN_BROWN = '#785840' - _STR_RED = '#b83838' - _CLS_CYAN = '#287088' - _ESCAPE_LIME = '#709030' - _LABEL_CYAN = '#289870' + name = 'lovelace' + + _KW_BLUE = '#2838b0' + _NAME_GREEN = '#388038' + _DOC_ORANGE = '#b85820' + _OW_PURPLE = '#a848a8' + _FUN_BROWN = '#785840' + _STR_RED = '#b83838' + _CLS_CYAN = '#287088' + _ESCAPE_LIME = '#709030' + _LABEL_CYAN = '#289870' _EXCEPT_YELLOW = '#908828' styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/manni.py b/contrib/python/Pygments/py3/pygments/styles/manni.py index 3f327eed32..1eb0e69860 100644 --- a/contrib/python/Pygments/py3/pygments/styles/manni.py +++ b/contrib/python/Pygments/py3/pygments/styles/manni.py @@ -16,11 +16,15 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['ManniStyle'] + + class ManniStyle(Style): """ A colorful style, inspired by the terminal highlighting style. """ - + name = 'manni' + background_color = '#f0f3f3' styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/material.py b/contrib/python/Pygments/py3/pygments/styles/material.py index 816efa2ba3..db0952d20a 100644 --- a/contrib/python/Pygments/py3/pygments/styles/material.py +++ b/contrib/python/Pygments/py3/pygments/styles/material.py @@ -14,24 +14,30 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Escape, \ Error, Text, Number, Operator, Generic, Punctuation, Literal + +__all__ = ['MaterialStyle'] + + class MaterialStyle(Style): """ This style mimics the Material Theme color scheme. """ + name = 'material' + dark_teal = '#263238' - white= '#FFFFFF' - black= '#000000' - red= '#FF5370' - orange= '#F78C6C' - yellow= '#FFCB6B' - green= '#C3E88D' - cyan= '#89DDFF' - blue= '#82AAFF' - paleblue= '#B2CCD6' - purple= '#C792EA' - brown= '#C17E70' - pink= '#F07178' - violet= '#BB80B3' + white = '#FFFFFF' + black = '#000000' + red = '#FF5370' + orange = '#F78C6C' + yellow = '#FFCB6B' + green = '#C3E88D' + cyan = '#89DDFF' + blue = '#82AAFF' + paleblue = '#B2CCD6' + purple = '#C792EA' + brown = '#C17E70' + pink = '#F07178' + violet = '#BB80B3' foreground = '#EEFFFF' faded = '#546E7A' diff --git a/contrib/python/Pygments/py3/pygments/styles/monokai.py b/contrib/python/Pygments/py3/pygments/styles/monokai.py index bf968d4ab4..2ae51bcdfc 100644 --- a/contrib/python/Pygments/py3/pygments/styles/monokai.py +++ b/contrib/python/Pygments/py3/pygments/styles/monokai.py @@ -14,11 +14,16 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, Token, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal + +__all__ = ['MonokaiStyle'] + + class MonokaiStyle(Style): """ This style mimics the Monokai color scheme. """ - + name = 'monokai' + background_color = "#272822" highlight_color = "#49483e" diff --git a/contrib/python/Pygments/py3/pygments/styles/murphy.py b/contrib/python/Pygments/py3/pygments/styles/murphy.py index b2e8f716eb..0c5cc6df6a 100644 --- a/contrib/python/Pygments/py3/pygments/styles/murphy.py +++ b/contrib/python/Pygments/py3/pygments/styles/murphy.py @@ -13,11 +13,15 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['MurphyStyle'] + + class MurphyStyle(Style): """ Murphy's style from CodeRay. """ - + name = 'murphy' + styles = { Whitespace: "#bbbbbb", Comment: "#666 italic", diff --git a/contrib/python/Pygments/py3/pygments/styles/native.py b/contrib/python/Pygments/py3/pygments/styles/native.py index 1cc78fe2b2..11f83db4b9 100644 --- a/contrib/python/Pygments/py3/pygments/styles/native.py +++ b/contrib/python/Pygments/py3/pygments/styles/native.py @@ -13,11 +13,15 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Token, Whitespace +__all__ = ['NativeStyle'] + + class NativeStyle(Style): """ Pygments version of the "native" vim theme. """ - + name = 'native' + background_color = '#202020' highlight_color = '#404040' line_number_color = '#aaaaaa' diff --git a/contrib/python/Pygments/py3/pygments/styles/nord.py b/contrib/python/Pygments/py3/pygments/styles/nord.py index bc76ecc059..e5cff24520 100644 --- a/contrib/python/Pygments/py3/pygments/styles/nord.py +++ b/contrib/python/Pygments/py3/pygments/styles/nord.py @@ -14,11 +14,15 @@ from pygments.token import Keyword, Name, Comment, String, Error, Number, \ Operator, Generic, Whitespace, Punctuation, Text, Token +__all__ = ['NordStyle', 'NordDarkerStyle'] + + class NordStyle(Style): """ Pygments version of the "nord" theme by Arctic Ice Studio. """ - + name = 'nord' + line_number_color = "#D8DEE9" line_number_background_color = "#242933" line_number_special_color = "#242933" @@ -87,7 +91,8 @@ class NordDarkerStyle(Style): """ Pygments version of a darker "nord" theme by Arctic Ice Studio """ - + name = 'nord-darker' + line_number_color = "#D8DEE9" line_number_background_color = "#242933" line_number_special_color = "#242933" diff --git a/contrib/python/Pygments/py3/pygments/styles/onedark.py b/contrib/python/Pygments/py3/pygments/styles/onedark.py index e9e90fd8b8..b145ce91e2 100644 --- a/contrib/python/Pygments/py3/pygments/styles/onedark.py +++ b/contrib/python/Pygments/py3/pygments/styles/onedark.py @@ -16,13 +16,17 @@ from pygments.token import Comment, Keyword, Name, Number, Operator, \ Punctuation, String, Token +__all__ = ['OneDarkStyle'] + + class OneDarkStyle(Style): """ Theme inspired by One Dark Pro for Atom. .. versionadded:: 2.11 """ - + name = 'one-dark' + background_color = '#282C34' styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/paraiso_dark.py b/contrib/python/Pygments/py3/pygments/styles/paraiso_dark.py index 8e8e6dcf34..8cc231f31c 100644 --- a/contrib/python/Pygments/py3/pygments/styles/paraiso_dark.py +++ b/contrib/python/Pygments/py3/pygments/styles/paraiso_dark.py @@ -17,6 +17,9 @@ from pygments.token import Keyword, Name, Comment, String, Error, Text, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal +__all__ = ['ParaisoDarkStyle'] + + BACKGROUND = "#2f1e2e" CURRENT_LINE = "#41323f" SELECTION = "#4f424c" @@ -32,7 +35,8 @@ PURPLE = "#815ba4" class ParaisoDarkStyle(Style): - + name = 'paraiso-dark' + background_color = BACKGROUND highlight_color = SELECTION diff --git a/contrib/python/Pygments/py3/pygments/styles/paraiso_light.py b/contrib/python/Pygments/py3/pygments/styles/paraiso_light.py index 3f19946ef7..ac76badbfe 100644 --- a/contrib/python/Pygments/py3/pygments/styles/paraiso_light.py +++ b/contrib/python/Pygments/py3/pygments/styles/paraiso_light.py @@ -17,6 +17,9 @@ from pygments.token import Keyword, Name, Comment, String, Error, Text, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal +__all__ = ['ParaisoLightStyle'] + + BACKGROUND = "#e7e9db" CURRENT_LINE = "#b9b6b0" SELECTION = "#a39e9b" @@ -32,7 +35,8 @@ PURPLE = "#815ba4" class ParaisoLightStyle(Style): - + name = 'paraiso-light' + background_color = BACKGROUND highlight_color = SELECTION diff --git a/contrib/python/Pygments/py3/pygments/styles/pastie.py b/contrib/python/Pygments/py3/pygments/styles/pastie.py index 1809bfae9f..2892660bff 100644 --- a/contrib/python/Pygments/py3/pygments/styles/pastie.py +++ b/contrib/python/Pygments/py3/pygments/styles/pastie.py @@ -15,11 +15,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['PastieStyle'] + + class PastieStyle(Style): """ Style similar to the pastie default style. """ + name = 'pastie' + styles = { Whitespace: '#bbbbbb', Comment: '#888888', diff --git a/contrib/python/Pygments/py3/pygments/styles/perldoc.py b/contrib/python/Pygments/py3/pygments/styles/perldoc.py index a499f9ff41..071821bb1e 100644 --- a/contrib/python/Pygments/py3/pygments/styles/perldoc.py +++ b/contrib/python/Pygments/py3/pygments/styles/perldoc.py @@ -15,11 +15,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['PerldocStyle'] + + class PerldocStyle(Style): """ Style similar to the style used in the perldoc code blocks. """ + name = 'perldoc' + background_color = '#eeeedd' styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/rainbow_dash.py b/contrib/python/Pygments/py3/pygments/styles/rainbow_dash.py index 7a916d66e1..82bfed5482 100644 --- a/contrib/python/Pygments/py3/pygments/styles/rainbow_dash.py +++ b/contrib/python/Pygments/py3/pygments/styles/rainbow_dash.py @@ -14,6 +14,10 @@ from pygments.style import Style from pygments.token import Comment, Error, Generic, Name, Number, Operator, \ String, Text, Whitespace, Keyword + +__all__ = ['RainbowDashStyle'] + + BLUE_LIGHT = '#0080ff' BLUE = '#2c5dcd' GREEN = '#00cc66' @@ -37,6 +41,8 @@ class RainbowDashStyle(Style): A bright and colorful syntax highlighting theme. """ + name = 'rainbow_dash' + background_color = WHITE styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/rrt.py b/contrib/python/Pygments/py3/pygments/styles/rrt.py index 889a51cade..3376d581db 100644 --- a/contrib/python/Pygments/py3/pygments/styles/rrt.py +++ b/contrib/python/Pygments/py3/pygments/styles/rrt.py @@ -9,7 +9,10 @@ """ from pygments.style import Style -from pygments.token import Token, Comment, Name, Keyword, String +from pygments.token import Token, Comment, Name, Keyword, String, Number + + +__all__ = ['RrtStyle'] class RrtStyle(Style): @@ -17,6 +20,8 @@ class RrtStyle(Style): Minimalistic "rrt" theme, based on Zap and Emacs defaults. """ + name = 'rrt' + background_color = '#000000' highlight_color = '#0000ff' @@ -30,4 +35,5 @@ class RrtStyle(Style): Comment.Preproc: '#e5e5e5', String: '#87ceeb', Keyword.Type: '#ee82ee', + Number: '#ff00ff', } diff --git a/contrib/python/Pygments/py3/pygments/styles/sas.py b/contrib/python/Pygments/py3/pygments/styles/sas.py index 86d7ed38f8..4d19b224cd 100644 --- a/contrib/python/Pygments/py3/pygments/styles/sas.py +++ b/contrib/python/Pygments/py3/pygments/styles/sas.py @@ -15,6 +15,9 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Other, Whitespace, Generic +__all__ = ['SasStyle'] + + class SasStyle(Style): """ Style inspired by SAS' enhanced program editor. Note This is not @@ -22,6 +25,8 @@ class SasStyle(Style): program editor syntax highlighting. """ + name = 'sas' + styles = { Whitespace: '#bbbbbb', Comment: 'italic #008800', diff --git a/contrib/python/Pygments/py3/pygments/styles/solarized.py b/contrib/python/Pygments/py3/pygments/styles/solarized.py index e75aa602fe..6a1f81240b 100644 --- a/contrib/python/Pygments/py3/pygments/styles/solarized.py +++ b/contrib/python/Pygments/py3/pygments/styles/solarized.py @@ -16,6 +16,9 @@ from pygments.token import Comment, Error, Generic, Keyword, Name, Number, \ Operator, String, Token +__all__ = ['SolarizedLightStyle', 'SolarizedDarkStyle'] + + def make_style(colors): return { Token: colors['base0'], @@ -118,6 +121,8 @@ class SolarizedDarkStyle(Style): The solarized style, dark. """ + name = 'solarized-dark' + styles = make_style(DARK_COLORS) background_color = DARK_COLORS['base03'] highlight_color = DARK_COLORS['base02'] @@ -130,6 +135,8 @@ class SolarizedLightStyle(SolarizedDarkStyle): The solarized style, light. """ + name = 'solarized-light' + styles = make_style(LIGHT_COLORS) background_color = LIGHT_COLORS['base03'] highlight_color = LIGHT_COLORS['base02'] diff --git a/contrib/python/Pygments/py3/pygments/styles/staroffice.py b/contrib/python/Pygments/py3/pygments/styles/staroffice.py index 0f6cbaeb29..b2cfba9fb3 100644 --- a/contrib/python/Pygments/py3/pygments/styles/staroffice.py +++ b/contrib/python/Pygments/py3/pygments/styles/staroffice.py @@ -12,11 +12,16 @@ from pygments.style import Style from pygments.token import Comment, Error, Literal, Name, Token +__all__ = ['StarofficeStyle'] + + class StarofficeStyle(Style): """ Style similar to StarOffice style, also in OpenOffice and LibreOffice. """ + name = 'staroffice' + styles = { Token: '#000080', # Blue Comment: '#696969', # DimGray diff --git a/contrib/python/Pygments/py3/pygments/styles/stata_dark.py b/contrib/python/Pygments/py3/pygments/styles/stata_dark.py index 1dc1c63ea2..c2d0f19246 100644 --- a/contrib/python/Pygments/py3/pygments/styles/stata_dark.py +++ b/contrib/python/Pygments/py3/pygments/styles/stata_dark.py @@ -15,8 +15,12 @@ from pygments.token import Token, Keyword, Name, Comment, String, Error, \ Number, Operator, Whitespace, Generic -class StataDarkStyle(Style): +__all__ = ['StataDarkStyle'] + +class StataDarkStyle(Style): + name = 'stata-dark' + background_color = "#232629" highlight_color = "#49483e" diff --git a/contrib/python/Pygments/py3/pygments/styles/stata_light.py b/contrib/python/Pygments/py3/pygments/styles/stata_light.py index f7923d3624..5e034568ca 100644 --- a/contrib/python/Pygments/py3/pygments/styles/stata_light.py +++ b/contrib/python/Pygments/py3/pygments/styles/stata_light.py @@ -14,12 +14,17 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Whitespace, Text +__all__ = ['StataLightStyle'] + + class StataLightStyle(Style): """ Light mode style inspired by Stata's do-file editor. This is not meant to be a complete style, just for use with Stata. """ + name = 'stata-light' + styles = { Text: '#111111', Whitespace: '#bbbbbb', diff --git a/contrib/python/Pygments/py3/pygments/styles/tango.py b/contrib/python/Pygments/py3/pygments/styles/tango.py index 2858b21b44..787a697856 100644 --- a/contrib/python/Pygments/py3/pygments/styles/tango.py +++ b/contrib/python/Pygments/py3/pygments/styles/tango.py @@ -41,14 +41,17 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal +__all__ = ['TangoStyle'] + + class TangoStyle(Style): """ The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines. """ - # work in progress... - + name = 'tango' + background_color = "#f8f8f8" styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/trac.py b/contrib/python/Pygments/py3/pygments/styles/trac.py index b00aaaa3f1..5f5c319ab8 100644 --- a/contrib/python/Pygments/py3/pygments/styles/trac.py +++ b/contrib/python/Pygments/py3/pygments/styles/trac.py @@ -13,11 +13,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace +__all__ = ['TracStyle'] + + class TracStyle(Style): """ Port of the default trac highlighter design. """ + name = 'trac' + styles = { Whitespace: '#bbbbbb', Comment: 'italic #999988', diff --git a/contrib/python/Pygments/py3/pygments/styles/vim.py b/contrib/python/Pygments/py3/pygments/styles/vim.py index a254bbaacb..1a0828fb0d 100644 --- a/contrib/python/Pygments/py3/pygments/styles/vim.py +++ b/contrib/python/Pygments/py3/pygments/styles/vim.py @@ -13,11 +13,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace, Token +__all__ = ['VimStyle'] + + class VimStyle(Style): """ Styles somewhat like vim 7.0 """ + name = 'vim' + background_color = "#000000" highlight_color = "#222222" diff --git a/contrib/python/Pygments/py3/pygments/styles/vs.py b/contrib/python/Pygments/py3/pygments/styles/vs.py index e1d1dabe05..b3b98c05dd 100644 --- a/contrib/python/Pygments/py3/pygments/styles/vs.py +++ b/contrib/python/Pygments/py3/pygments/styles/vs.py @@ -13,8 +13,12 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Operator, Generic -class VisualStudioStyle(Style): +__all__ = ['VisualStudioStyle'] + +class VisualStudioStyle(Style): + name = 'vs' + background_color = "#ffffff" styles = { diff --git a/contrib/python/Pygments/py3/pygments/styles/xcode.py b/contrib/python/Pygments/py3/pygments/styles/xcode.py index 86cab45fbe..87b1323ab8 100644 --- a/contrib/python/Pygments/py3/pygments/styles/xcode.py +++ b/contrib/python/Pygments/py3/pygments/styles/xcode.py @@ -13,11 +13,16 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Literal +__all__ = ['XcodeStyle'] + + class XcodeStyle(Style): """ Style similar to the Xcode default colouring theme. """ + name = 'xcode' + styles = { Comment: '#177500', Comment.Preproc: '#633820', diff --git a/contrib/python/Pygments/py3/pygments/styles/zenburn.py b/contrib/python/Pygments/py3/pygments/styles/zenburn.py index 35d5ec5279..6751c08d7c 100644 --- a/contrib/python/Pygments/py3/pygments/styles/zenburn.py +++ b/contrib/python/Pygments/py3/pygments/styles/zenburn.py @@ -16,11 +16,16 @@ from pygments.token import Token, Name, Operator, Keyword, Generic, Comment, \ Number, String, Literal, Punctuation, Error +__all__ = ['ZenburnStyle'] + + class ZenburnStyle(Style): """ Low contrast Zenburn style. """ + name = 'zenburn' + background_color = '#3f3f3f' highlight_color = '#484848' line_number_color = '#5d6262' diff --git a/contrib/python/Pygments/py3/ya.make b/contrib/python/Pygments/py3/ya.make index 49562762f9..0a55d0425d 100644 --- a/contrib/python/Pygments/py3/ya.make +++ b/contrib/python/Pygments/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.16.1) +VERSION(2.17.2) LICENSE(BSD-3-Clause) @@ -158,9 +158,13 @@ PY_SRCS( pygments/lexers/jmespath.py pygments/lexers/jslt.py pygments/lexers/jsonnet.py + pygments/lexers/jsx.py pygments/lexers/julia.py pygments/lexers/jvm.py pygments/lexers/kuin.py + pygments/lexers/kusto.py + pygments/lexers/ldap.py + pygments/lexers/lean.py pygments/lexers/lilypond.py pygments/lexers/lisp.py pygments/lexers/macaulay2.py @@ -200,6 +204,7 @@ PY_SRCS( pygments/lexers/procfile.py pygments/lexers/prolog.py pygments/lexers/promql.py + pygments/lexers/prql.py pygments/lexers/ptx.py pygments/lexers/python.py pygments/lexers/q.py @@ -259,6 +264,8 @@ PY_SRCS( pygments/lexers/varnish.py pygments/lexers/verification.py pygments/lexers/verifpal.py + pygments/lexers/vip.py + pygments/lexers/vyper.py pygments/lexers/web.py pygments/lexers/webassembly.py pygments/lexers/webidl.py @@ -279,6 +286,7 @@ PY_SRCS( pygments/sphinxext.py pygments/style.py pygments/styles/__init__.py + pygments/styles/_mapping.py pygments/styles/abap.py pygments/styles/algol.py pygments/styles/algol_nu.py |