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/smithy.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/smithy.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/smithy.py | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/smithy.py b/contrib/python/Pygments/py3/pygments/lexers/smithy.py index 52cf85cea5..0f0a91204c 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/smithy.py +++ b/contrib/python/Pygments/py3/pygments/lexers/smithy.py @@ -1,79 +1,79 @@ -""" - pygments.lexers.smithy - ~~~~~~~~~~~~~~~~~~~~~~ - - Lexers for the Smithy IDL. - - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import re - -from pygments.lexer import RegexLexer, bygroups, words -from pygments.token import Text, Comment, Keyword, Name, String, \ - Number, Whitespace, Punctuation - -__all__ = ['SmithyLexer'] - - -class SmithyLexer(RegexLexer): - """ - For Smithy IDL - - .. versionadded:: 2.10 - """ - name = 'Smithy' - filenames = ['*.smithy'] - aliases = ['smithy'] - - flags = re.MULTILINE | re.UNICODE - unquoted = r'[A-Za-z0-9_\.#$-]+' - identifier = r"[A-Za-z0-9_\.#$-]+" - - simple_shapes = ( - 'use', 'byte', 'short', 'integer', 'long', 'float', 'document', - 'double', 'bigInteger', 'bigDecimal', 'boolean', 'blob', 'string', - 'timestamp', - ) - - aggregate_shapes = ( - 'apply', 'list', 'map', 'set', 'structure', 'union', 'resource', - 'operation', 'service', 'trait' - ) - - tokens = { - 'root': [ - (r'///.*$', Comment.Multiline), - (r'//.*$', Comment), - (r'@[0-9a-zA-Z\.#-]*', Name.Decorator), - (r'(=)', Name.Decorator), - (r'^(\$version)(:)(.+)', - bygroups(Keyword.Declaration, Name.Decorator, Name.Class)), - (r'^(namespace)(\s+' + identifier + r')\b', - bygroups(Keyword.Declaration, Name.Class)), - (words(simple_shapes, - prefix=r'^', suffix=r'(\s+' + identifier + r')\b'), - bygroups(Keyword.Declaration, Name.Class)), - (words(aggregate_shapes, - prefix=r'^', suffix=r'(\s+' + identifier + r')'), - bygroups(Keyword.Declaration, Name.Class)), - (r'^(metadata)(\s+.+)(\s*)(=)', - bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)), - (r"(true|false|null)", Keyword.Constant), - (r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number), - (identifier + ":", Name.Label), - (identifier, Name.Variable.Class), - (r'\[', Text, "#push"), - (r'\]', Text, "#pop"), - (r'\(', Text, "#push"), - (r'\)', Text, "#pop"), - (r'\{', Text, "#push"), - (r'\}', Text, "#pop"), - (r'"{3}(\\\\|\n|\\")*"{3}', String.Doc), - (r'"(\\\\|\n|\\"|[^"])*"', String.Double), - (r"'(\\\\|\n|\\'|[^'])*'", String.Single), - (r'[:,]+', Punctuation), - (r'\s+', Whitespace), - ] - } +""" + pygments.lexers.smithy + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Smithy IDL. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import Text, Comment, Keyword, Name, String, \ + Number, Whitespace, Punctuation + +__all__ = ['SmithyLexer'] + + +class SmithyLexer(RegexLexer): + """ + For Smithy IDL + + .. versionadded:: 2.10 + """ + name = 'Smithy' + filenames = ['*.smithy'] + aliases = ['smithy'] + + flags = re.MULTILINE | re.UNICODE + unquoted = r'[A-Za-z0-9_\.#$-]+' + identifier = r"[A-Za-z0-9_\.#$-]+" + + simple_shapes = ( + 'use', 'byte', 'short', 'integer', 'long', 'float', 'document', + 'double', 'bigInteger', 'bigDecimal', 'boolean', 'blob', 'string', + 'timestamp', + ) + + aggregate_shapes = ( + 'apply', 'list', 'map', 'set', 'structure', 'union', 'resource', + 'operation', 'service', 'trait' + ) + + tokens = { + 'root': [ + (r'///.*$', Comment.Multiline), + (r'//.*$', Comment), + (r'@[0-9a-zA-Z\.#-]*', Name.Decorator), + (r'(=)', Name.Decorator), + (r'^(\$version)(:)(.+)', + bygroups(Keyword.Declaration, Name.Decorator, Name.Class)), + (r'^(namespace)(\s+' + identifier + r')\b', + bygroups(Keyword.Declaration, Name.Class)), + (words(simple_shapes, + prefix=r'^', suffix=r'(\s+' + identifier + r')\b'), + bygroups(Keyword.Declaration, Name.Class)), + (words(aggregate_shapes, + prefix=r'^', suffix=r'(\s+' + identifier + r')'), + bygroups(Keyword.Declaration, Name.Class)), + (r'^(metadata)(\s+.+)(\s*)(=)', + bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)), + (r"(true|false|null)", Keyword.Constant), + (r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number), + (identifier + ":", Name.Label), + (identifier, Name.Variable.Class), + (r'\[', Text, "#push"), + (r'\]', Text, "#pop"), + (r'\(', Text, "#push"), + (r'\)', Text, "#pop"), + (r'\{', Text, "#push"), + (r'\}', Text, "#pop"), + (r'"{3}(\\\\|\n|\\")*"{3}', String.Doc), + (r'"(\\\\|\n|\\"|[^"])*"', String.Double), + (r"'(\\\\|\n|\\'|[^'])*'", String.Single), + (r'[:,]+', Punctuation), + (r'\s+', Whitespace), + ] + } |