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/jslt.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/jslt.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/jslt.py | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/jslt.py b/contrib/python/Pygments/py3/pygments/lexers/jslt.py index 888642abb0..f4f14a685b 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/jslt.py +++ b/contrib/python/Pygments/py3/pygments/lexers/jslt.py @@ -1,94 +1,94 @@ -""" - pygments.lexers.jslt - ~~~~~~~~~~~~~~~~~~~~ - - Lexers for the JSLT language - +""" + pygments.lexers.jslt + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the JSLT language + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. -""" - -from pygments.lexer import RegexLexer, combined, words -from pygments.token import Comment, Keyword, Name, Number, Operator, \ - Punctuation, String, Whitespace - - -__all__ = ['JSLTLexer'] - - -_WORD_END = r'(?=[^0-9A-Z_a-z-])' - - -class JSLTLexer(RegexLexer): - """ - For `JSLT <https://github.com/schibsted/jslt>`_ source. - - .. versionadded:: 2.10 - """ - name = 'JSLT' - filenames = ['*.jslt'] - aliases = ['jslt'] - mimetypes = ['text/x-jslt'] - - tokens = { - 'root': [ - (r'[\t\n\f\r ]+', Whitespace), - (r'//.*(\n|\Z)', Comment.Single), - (r'-?(0|[1-9][0-9]*)', Number.Integer), - (r'-?(0|[1-9][0-9]*)(.[0-9]+a)?([Ee][+-]?[0-9]+)', Number.Float), - (r'"([^"\\]|\\.)*"', String.Double), - (r'[(),:\[\]{}]', Punctuation), - (r'(!=|[<=>]=?)', Operator), - (r'[*+/|-]', Operator), - (r'\.', Operator), - (words(('import',), suffix=_WORD_END), Keyword.Namespace, combined('import-path', 'whitespace')), - (words(('as',), suffix=_WORD_END), Keyword.Namespace, combined('import-alias', 'whitespace')), - (words(('let',), suffix=_WORD_END), Keyword.Declaration, combined('constant', 'whitespace')), - (words(('def',), suffix=_WORD_END), Keyword.Declaration, combined('function', 'whitespace')), - (words(('false', 'null', 'true'), suffix=_WORD_END), Keyword.Constant), - (words(('else', 'for', 'if'), suffix=_WORD_END), Keyword), - (words(('and', 'or'), suffix=_WORD_END), Operator.Word), - (words(( - 'all', 'any', 'array', 'boolean', 'capture', 'ceiling', - 'contains', 'ends-with', 'error', 'flatten', 'floor', - 'format-time', 'from-json', 'get-key', 'hash-int', 'index-of', - 'is-array', 'is-boolean', 'is-decimal', 'is-integer', - 'is-number', 'is-object', 'is-string', 'join', 'lowercase', - 'max', 'min', 'mod', 'not', 'now', 'number', 'parse-time', - 'parse-url', 'random', 'replace', 'round', 'sha256-hex', 'size', - 'split', 'starts-with', 'string', 'sum', 'test', 'to-json', - 'trim', 'uppercase', 'zip', 'zip-with-index', 'fallback'), suffix=_WORD_END), - Name.Builtin), - (r'[A-Z_a-z][0-9A-Z_a-z-]*:[A-Z_a-z][0-9A-Z_a-z-]*', Name.Function), - (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name), - (r'\$[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable), - ], - 'constant': [ - (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable, 'root'), - ], - 'function': [ - (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Function, combined('function-parameter-list', 'whitespace')), - ], - 'function-parameter-list': [ - (r'\(', Punctuation, combined('function-parameters', 'whitespace')), - ], - 'function-parameters': [ - (r',', Punctuation), - (r'\)', Punctuation, 'root'), - (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable), - ], - 'import-path': [ - (r'"([^"]|\\.)*"', String.Symbol, 'root'), - ], - 'import-alias': [ - (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Namespace, 'root'), - ], - 'string': [ - (r'"', String.Double, '#pop'), - (r'\\.', String.Escape), - ], - 'whitespace': [ - (r'[\t\n\f\r ]+', Whitespace), - (r'//.*(\n|\Z)', Comment.Single), - ] - } +""" + +from pygments.lexer import RegexLexer, combined, words +from pygments.token import Comment, Keyword, Name, Number, Operator, \ + Punctuation, String, Whitespace + + +__all__ = ['JSLTLexer'] + + +_WORD_END = r'(?=[^0-9A-Z_a-z-])' + + +class JSLTLexer(RegexLexer): + """ + For `JSLT <https://github.com/schibsted/jslt>`_ source. + + .. versionadded:: 2.10 + """ + name = 'JSLT' + filenames = ['*.jslt'] + aliases = ['jslt'] + mimetypes = ['text/x-jslt'] + + tokens = { + 'root': [ + (r'[\t\n\f\r ]+', Whitespace), + (r'//.*(\n|\Z)', Comment.Single), + (r'-?(0|[1-9][0-9]*)', Number.Integer), + (r'-?(0|[1-9][0-9]*)(.[0-9]+a)?([Ee][+-]?[0-9]+)', Number.Float), + (r'"([^"\\]|\\.)*"', String.Double), + (r'[(),:\[\]{}]', Punctuation), + (r'(!=|[<=>]=?)', Operator), + (r'[*+/|-]', Operator), + (r'\.', Operator), + (words(('import',), suffix=_WORD_END), Keyword.Namespace, combined('import-path', 'whitespace')), + (words(('as',), suffix=_WORD_END), Keyword.Namespace, combined('import-alias', 'whitespace')), + (words(('let',), suffix=_WORD_END), Keyword.Declaration, combined('constant', 'whitespace')), + (words(('def',), suffix=_WORD_END), Keyword.Declaration, combined('function', 'whitespace')), + (words(('false', 'null', 'true'), suffix=_WORD_END), Keyword.Constant), + (words(('else', 'for', 'if'), suffix=_WORD_END), Keyword), + (words(('and', 'or'), suffix=_WORD_END), Operator.Word), + (words(( + 'all', 'any', 'array', 'boolean', 'capture', 'ceiling', + 'contains', 'ends-with', 'error', 'flatten', 'floor', + 'format-time', 'from-json', 'get-key', 'hash-int', 'index-of', + 'is-array', 'is-boolean', 'is-decimal', 'is-integer', + 'is-number', 'is-object', 'is-string', 'join', 'lowercase', + 'max', 'min', 'mod', 'not', 'now', 'number', 'parse-time', + 'parse-url', 'random', 'replace', 'round', 'sha256-hex', 'size', + 'split', 'starts-with', 'string', 'sum', 'test', 'to-json', + 'trim', 'uppercase', 'zip', 'zip-with-index', 'fallback'), suffix=_WORD_END), + Name.Builtin), + (r'[A-Z_a-z][0-9A-Z_a-z-]*:[A-Z_a-z][0-9A-Z_a-z-]*', Name.Function), + (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name), + (r'\$[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable), + ], + 'constant': [ + (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable, 'root'), + ], + 'function': [ + (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Function, combined('function-parameter-list', 'whitespace')), + ], + 'function-parameter-list': [ + (r'\(', Punctuation, combined('function-parameters', 'whitespace')), + ], + 'function-parameters': [ + (r',', Punctuation), + (r'\)', Punctuation, 'root'), + (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Variable), + ], + 'import-path': [ + (r'"([^"]|\\.)*"', String.Symbol, 'root'), + ], + 'import-alias': [ + (r'[A-Z_a-z][0-9A-Z_a-z-]*', Name.Namespace, 'root'), + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'\\.', String.Escape), + ], + 'whitespace': [ + (r'[\t\n\f\r ]+', Whitespace), + (r'//.*(\n|\Z)', Comment.Single), + ] + } |