diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/Pygments/py3/pygments/lexers/parsers.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/parsers.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/parsers.py | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/parsers.py b/contrib/python/Pygments/py3/pygments/lexers/parsers.py index 2861cdd41a..0009082fc4 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/parsers.py +++ b/contrib/python/Pygments/py3/pygments/lexers/parsers.py @@ -4,7 +4,7 @@ Lexers for parser generators. - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -63,10 +63,10 @@ class RagelLexer(RegexLexer): (r'[+-]?[0-9]+', Number.Integer), ], 'literals': [ - (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), - (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), - (r'\[(\\\\|\\[^\\]|[^\\\]])*\]', String), # square bracket literals - (r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', String.Regex), # regular expressions + (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), + (r'\[(\\\\|\\[^\\]|[^\\\]])*\]', String), # square bracket literals + (r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', String.Regex), # regular expressions ], 'identifiers': [ (r'[a-zA-Z_]\w*', Name.Variable), @@ -105,15 +105,15 @@ class RagelLexer(RegexLexer): r'[^\\]\\[{}]', # allow escaped { or } # strings and comments may safely contain unsafe characters - r'"(\\\\|\\[^\\]|[^"\\])*"', - r"'(\\\\|\\[^\\]|[^'\\])*'", + r'"(\\\\|\\[^\\]|[^"\\])*"', + r"'(\\\\|\\[^\\]|[^'\\])*'", r'//.*$\n?', # single line comment r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment r'\#.*$\n?', # ruby comment # regular expression: There's no reason for it to start # with a * and this stops confusion with comments. - r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', + r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # / is safe now that we've handled regex and javadoc comments r'/', @@ -146,12 +146,12 @@ class RagelEmbeddedLexer(RegexLexer): r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them # strings and comments may safely contain unsafe characters - r'"(\\\\|\\[^\\]|[^"\\])*"', - r"'(\\\\|\\[^\\]|[^'\\])*'", + r'"(\\\\|\\[^\\]|[^"\\])*"', + r"'(\\\\|\\[^\\]|[^'\\])*'", r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment r'//.*$\n?', # single line comment r'\#.*$\n?', # ruby/ragel comment - r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # regular expression + r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # regular expression # / is safe now that we've handled regex and javadoc comments r'/', @@ -181,7 +181,7 @@ class RagelEmbeddedLexer(RegexLexer): # specifically allow regex followed immediately by * # so it doesn't get mistaken for a comment - r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/\*', + r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/\*', # allow / as long as it's not followed by another / or by a * r'/(?=[^/*]|$)', @@ -192,9 +192,9 @@ class RagelEmbeddedLexer(RegexLexer): )) + r')+', # strings and comments may safely contain unsafe characters - r'"(\\\\|\\[^\\]|[^"\\])*"', - r"'(\\\\|\\[^\\]|[^'\\])*'", - r"\[(\\\\|\\[^\\]|[^\]\\])*\]", # square bracket literal + r'"(\\\\|\\[^\\]|[^"\\])*"', + r"'(\\\\|\\[^\\]|[^'\\])*'", + r"\[(\\\\|\\[^\\]|[^\]\\])*\]", # square bracket literal r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment r'//.*$\n?', # single line comment r'\#.*$\n?', # ruby/ragel comment @@ -220,7 +220,7 @@ class RagelRubyLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(RubyLexer, RagelEmbeddedLexer, **options) + super().__init__(RubyLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: ruby' in text @@ -238,7 +238,7 @@ class RagelCLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(CLexer, RagelEmbeddedLexer, **options) + super().__init__(CLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: c' in text @@ -256,7 +256,7 @@ class RagelDLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(DLexer, RagelEmbeddedLexer, **options) + super().__init__(DLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: d' in text @@ -274,7 +274,7 @@ class RagelCppLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(CppLexer, RagelEmbeddedLexer, **options) + super().__init__(CppLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: c++' in text @@ -292,7 +292,7 @@ class RagelObjectiveCLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(ObjectiveCLexer, RagelEmbeddedLexer, **options) + super().__init__(ObjectiveCLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: objc' in text @@ -310,7 +310,7 @@ class RagelJavaLexer(DelegatingLexer): filenames = ['*.rl'] def __init__(self, **options): - super().__init__(JavaLexer, RagelEmbeddedLexer, **options) + super().__init__(JavaLexer, RagelEmbeddedLexer, **options) def analyse_text(text): return '@LANG: java' in text @@ -415,8 +415,8 @@ class AntlrLexer(RegexLexer): (r':', Punctuation), # literals - (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), - (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), + (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), (r'<<([^>]|>[^>])>>', String), # identifiers # Tokens start with capital letter. @@ -455,14 +455,14 @@ class AntlrLexer(RegexLexer): r'[^${}\'"/\\]+', # exclude unsafe characters # strings and comments may safely contain unsafe characters - r'"(\\\\|\\[^\\]|[^"\\])*"', - r"'(\\\\|\\[^\\]|[^'\\])*'", + r'"(\\\\|\\[^\\]|[^"\\])*"', + r"'(\\\\|\\[^\\]|[^'\\])*'", r'//.*$\n?', # single line comment r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment # regular expression: There's no reason for it to start # with a * and this stops confusion with comments. - r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', + r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # backslashes are okay, as long as we are not backslashing a % r'\\(?!%)', @@ -482,14 +482,14 @@ class AntlrLexer(RegexLexer): r'[^$\[\]\'"/]+', # exclude unsafe characters # strings and comments may safely contain unsafe characters - r'"(\\\\|\\[^\\]|[^"\\])*"', - r"'(\\\\|\\[^\\]|[^'\\])*'", + r'"(\\\\|\\[^\\]|[^"\\])*"', + r"'(\\\\|\\[^\\]|[^'\\])*'", r'//.*$\n?', # single line comment r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment # regular expression: There's no reason for it to start # with a * and this stops confusion with comments. - r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', + r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # Now that we've handled regex and javadoc comments # it's safe to let / through. @@ -508,7 +508,7 @@ class AntlrLexer(RegexLexer): def analyse_text(text): return re.search(r'^\s*grammar\s+[a-zA-Z0-9]+\s*;', text, re.M) - + # http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets class AntlrCppLexer(DelegatingLexer): @@ -523,7 +523,7 @@ class AntlrCppLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(CppLexer, AntlrLexer, **options) + super().__init__(CppLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -542,7 +542,7 @@ class AntlrObjectiveCLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(ObjectiveCLexer, AntlrLexer, **options) + super().__init__(ObjectiveCLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -561,7 +561,7 @@ class AntlrCSharpLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(CSharpLexer, AntlrLexer, **options) + super().__init__(CSharpLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -580,7 +580,7 @@ class AntlrPythonLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(PythonLexer, AntlrLexer, **options) + super().__init__(PythonLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -599,7 +599,7 @@ class AntlrJavaLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(JavaLexer, AntlrLexer, **options) + super().__init__(JavaLexer, AntlrLexer, **options) def analyse_text(text): # Antlr language is Java by default @@ -618,7 +618,7 @@ class AntlrRubyLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(RubyLexer, AntlrLexer, **options) + super().__init__(RubyLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -637,7 +637,7 @@ class AntlrPerlLexer(DelegatingLexer): filenames = ['*.G', '*.g'] def __init__(self, **options): - super().__init__(PerlLexer, AntlrLexer, **options) + super().__init__(PerlLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -652,12 +652,12 @@ class AntlrActionScriptLexer(DelegatingLexer): """ name = 'ANTLR With ActionScript Target' - aliases = ['antlr-actionscript', 'antlr-as'] + aliases = ['antlr-actionscript', 'antlr-as'] filenames = ['*.G', '*.g'] def __init__(self, **options): from pygments.lexers.actionscript import ActionScriptLexer - super().__init__(ActionScriptLexer, AntlrLexer, **options) + super().__init__(ActionScriptLexer, AntlrLexer, **options) def analyse_text(text): return AntlrLexer.analyse_text(text) and \ @@ -700,8 +700,8 @@ class TreetopBaseLexer(RegexLexer): 'rule': [ include('space'), include('end'), - (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), - (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), + (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), (r'([A-Za-z_]\w*)(:)', bygroups(Name.Label, Punctuation)), (r'[A-Za-z_]\w*', Name), (r'[()]', Punctuation), @@ -745,7 +745,7 @@ class TreetopLexer(DelegatingLexer): filenames = ['*.treetop', '*.tt'] def __init__(self, **options): - super().__init__(RubyLexer, TreetopBaseLexer, **options) + super().__init__(RubyLexer, TreetopBaseLexer, **options) class EbnfLexer(RegexLexer): |