diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/Pygments/py3/pygments/lexers/arrow.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/arrow.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/arrow.py | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/arrow.py b/contrib/python/Pygments/py3/pygments/lexers/arrow.py index 20c9e9b5fb..ef7a1a5beb 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/arrow.py +++ b/contrib/python/Pygments/py3/pygments/lexers/arrow.py @@ -1,116 +1,116 @@ -""" - pygments.lexers.arrow - ~~~~~~~~~~~~~~~~~~~~~ - - Lexer for Arrow. - - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from pygments.lexer import RegexLexer, bygroups, default, include -from pygments.token import Text, Operator, Keyword, Punctuation, Name, \ +""" + pygments.lexers.arrow + ~~~~~~~~~~~~~~~~~~~~~ + + Lexer for Arrow. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, default, include +from pygments.token import Text, Operator, Keyword, Punctuation, Name, \ String, Number, Whitespace - -__all__ = ['ArrowLexer'] - -TYPES = r'\b(int|bool|char)((?:\[\])*)(?=\s+)' -IDENT = r'([a-zA-Z_][a-zA-Z0-9_]*)' -DECL = TYPES + r'(\s+)' + IDENT - - -class ArrowLexer(RegexLexer): - """ - Lexer for Arrow: https://pypi.org/project/py-arrow-lang/ - - .. versionadded:: 2.7 - """ - - name = 'Arrow' - aliases = ['arrow'] - filenames = ['*.arw'] - - tokens = { - 'root': [ + +__all__ = ['ArrowLexer'] + +TYPES = r'\b(int|bool|char)((?:\[\])*)(?=\s+)' +IDENT = r'([a-zA-Z_][a-zA-Z0-9_]*)' +DECL = TYPES + r'(\s+)' + IDENT + + +class ArrowLexer(RegexLexer): + """ + Lexer for Arrow: https://pypi.org/project/py-arrow-lang/ + + .. versionadded:: 2.7 + """ + + name = 'Arrow' + aliases = ['arrow'] + filenames = ['*.arw'] + + tokens = { + 'root': [ (r'\s+', Whitespace), - (r'^[|\s]+', Punctuation), - include('blocks'), - include('statements'), - include('expressions'), - ], - 'blocks': [ - (r'(function)(\n+)(/-->)(\s*)' + - DECL + # 4 groups - r'(\()', bygroups( + (r'^[|\s]+', Punctuation), + include('blocks'), + include('statements'), + include('expressions'), + ], + 'blocks': [ + (r'(function)(\n+)(/-->)(\s*)' + + DECL + # 4 groups + r'(\()', bygroups( Keyword.Reserved, Whitespace, Punctuation, Whitespace, Keyword.Type, Punctuation, Whitespace, - Name.Function, Punctuation - ), 'fparams'), - (r'/-->$|\\-->$|/--<|\\--<|\^', Punctuation), - ], - 'statements': [ - (DECL, bygroups(Keyword.Type, Punctuation, Text, Name.Variable)), - (r'\[', Punctuation, 'index'), - (r'=', Operator), - (r'require|main', Keyword.Reserved), - (r'print', Keyword.Reserved, 'print'), - ], - 'expressions': [ + Name.Function, Punctuation + ), 'fparams'), + (r'/-->$|\\-->$|/--<|\\--<|\^', Punctuation), + ], + 'statements': [ + (DECL, bygroups(Keyword.Type, Punctuation, Text, Name.Variable)), + (r'\[', Punctuation, 'index'), + (r'=', Operator), + (r'require|main', Keyword.Reserved), + (r'print', Keyword.Reserved, 'print'), + ], + 'expressions': [ (r'\s+', Whitespace), - (r'[0-9]+', Number.Integer), - (r'true|false', Keyword.Constant), - (r"'", String.Char, 'char'), - (r'"', String.Double, 'string'), - (r'\{', Punctuation, 'array'), - (r'==|!=|<|>|\+|-|\*|/|%', Operator), - (r'and|or|not|length', Operator.Word), - (r'(input)(\s+)(int|char\[\])', bygroups( + (r'[0-9]+', Number.Integer), + (r'true|false', Keyword.Constant), + (r"'", String.Char, 'char'), + (r'"', String.Double, 'string'), + (r'\{', Punctuation, 'array'), + (r'==|!=|<|>|\+|-|\*|/|%', Operator), + (r'and|or|not|length', Operator.Word), + (r'(input)(\s+)(int|char\[\])', bygroups( Keyword.Reserved, Whitespace, Keyword.Type - )), - (IDENT + r'(\()', bygroups( - Name.Function, Punctuation - ), 'fargs'), - (IDENT, Name.Variable), - (r'\[', Punctuation, 'index'), - (r'\(', Punctuation, 'expressions'), - (r'\)', Punctuation, '#pop'), - ], - 'print': [ - include('expressions'), - (r',', Punctuation), - default('#pop'), - ], - 'fparams': [ + )), + (IDENT + r'(\()', bygroups( + Name.Function, Punctuation + ), 'fargs'), + (IDENT, Name.Variable), + (r'\[', Punctuation, 'index'), + (r'\(', Punctuation, 'expressions'), + (r'\)', Punctuation, '#pop'), + ], + 'print': [ + include('expressions'), + (r',', Punctuation), + default('#pop'), + ], + 'fparams': [ (DECL, bygroups(Keyword.Type, Punctuation, Whitespace, Name.Variable)), - (r',', Punctuation), - (r'\)', Punctuation, '#pop'), - ], - 'escape': [ - (r'\\(["\\/abfnrtv]|[0-9]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})', - String.Escape), - ], - 'char': [ - (r"'", String.Char, '#pop'), - include('escape'), - (r"[^'\\]", String.Char), - ], - 'string': [ - (r'"', String.Double, '#pop'), - include('escape'), - (r'[^"\\]+', String.Double), - ], - 'array': [ - include('expressions'), - (r'\}', Punctuation, '#pop'), - (r',', Punctuation), - ], - 'fargs': [ - include('expressions'), - (r'\)', Punctuation, '#pop'), - (r',', Punctuation), - ], - 'index': [ - include('expressions'), - (r'\]', Punctuation, '#pop'), - ], - } + (r',', Punctuation), + (r'\)', Punctuation, '#pop'), + ], + 'escape': [ + (r'\\(["\\/abfnrtv]|[0-9]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})', + String.Escape), + ], + 'char': [ + (r"'", String.Char, '#pop'), + include('escape'), + (r"[^'\\]", String.Char), + ], + 'string': [ + (r'"', String.Double, '#pop'), + include('escape'), + (r'[^"\\]+', String.Double), + ], + 'array': [ + include('expressions'), + (r'\}', Punctuation, '#pop'), + (r',', Punctuation), + ], + 'fargs': [ + include('expressions'), + (r'\)', Punctuation, '#pop'), + (r',', Punctuation), + ], + 'index': [ + include('expressions'), + (r'\]', Punctuation, '#pop'), + ], + } |