diff options
author | ilezhankin <ilezhankin@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
commit | 1d125034f06575234f83f24f08677955133f140e (patch) | |
tree | ec05fbbd61dc118d5de37f206ab978cff58774bd /contrib/python/Pygments/py3/pygments/lexers/elm.py | |
parent | 3a7a498715ef1b66f5054455421b845e45e3a653 (diff) | |
download | ydb-1d125034f06575234f83f24f08677955133f140e.tar.gz |
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/elm.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/elm.py | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/elm.py b/contrib/python/Pygments/py3/pygments/lexers/elm.py index 298dbf5986..b387919f0a 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/elm.py +++ b/contrib/python/Pygments/py3/pygments/lexers/elm.py @@ -1,123 +1,123 @@ -""" - pygments.lexers.elm - ~~~~~~~~~~~~~~~~~~~ - - Lexer for the Elm programming language. - +""" + pygments.lexers.elm + ~~~~~~~~~~~~~~~~~~~ + + Lexer for the Elm programming language. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - + :license: BSD, see LICENSE for details. +""" + from pygments.lexer import RegexLexer, words, include, bygroups from pygments.token import Comment, Keyword, Name, Number, Punctuation, String, \ Text, Whitespace - -__all__ = ['ElmLexer'] - - -class ElmLexer(RegexLexer): - """ - For `Elm <http://elm-lang.org/>`_ source code. - - .. versionadded:: 2.1 - """ - - name = 'Elm' - aliases = ['elm'] - filenames = ['*.elm'] - mimetypes = ['text/x-elm'] - + +__all__ = ['ElmLexer'] + + +class ElmLexer(RegexLexer): + """ + For `Elm <http://elm-lang.org/>`_ source code. + + .. versionadded:: 2.1 + """ + + name = 'Elm' + aliases = ['elm'] + filenames = ['*.elm'] + mimetypes = ['text/x-elm'] + validName = r'[a-z_][a-zA-Z0-9_\']*' - - specialName = r'^main ' - - builtinOps = ( - '~', '||', '|>', '|', '`', '^', '\\', '\'', '>>', '>=', '>', '==', - '=', '<~', '<|', '<=', '<<', '<-', '<', '::', ':', '/=', '//', '/', - '..', '.', '->', '-', '++', '+', '*', '&&', '%', - ) - - reservedWords = words(( - 'alias', 'as', 'case', 'else', 'if', 'import', 'in', - 'let', 'module', 'of', 'port', 'then', 'type', 'where', + + specialName = r'^main ' + + builtinOps = ( + '~', '||', '|>', '|', '`', '^', '\\', '\'', '>>', '>=', '>', '==', + '=', '<~', '<|', '<=', '<<', '<-', '<', '::', ':', '/=', '//', '/', + '..', '.', '->', '-', '++', '+', '*', '&&', '%', + ) + + reservedWords = words(( + 'alias', 'as', 'case', 'else', 'if', 'import', 'in', + 'let', 'module', 'of', 'port', 'then', 'type', 'where', ), suffix=r'\b') - - tokens = { - 'root': [ - - # Comments + + tokens = { + 'root': [ + + # Comments (r'\{-', Comment.Multiline, 'comment'), - (r'--.*', Comment.Single), - - # Whitespace + (r'--.*', Comment.Single), + + # Whitespace (r'\s+', Whitespace), - - # Strings - (r'"', String, 'doublequote'), - - # Modules + + # Strings + (r'"', String, 'doublequote'), + + # Modules (r'^(\s*)(module)(\s*)', bygroups(Whitespace, Keyword.Namespace, Whitespace), 'imports'), - - # Imports + + # Imports (r'^(\s*)(import)(\s*)', bygroups(Whitespace, Keyword.Namespace, Whitespace), 'imports'), - - # Shaders - (r'\[glsl\|.*', Name.Entity, 'shader'), - - # Keywords - (reservedWords, Keyword.Reserved), - - # Types + + # Shaders + (r'\[glsl\|.*', Name.Entity, 'shader'), + + # Keywords + (reservedWords, Keyword.Reserved), + + # Types (r'[A-Z][a-zA-Z0-9_]*', Keyword.Type), - - # Main - (specialName, Keyword.Reserved), - - # Prefix Operators - (words((builtinOps), prefix=r'\(', suffix=r'\)'), Name.Function), - - # Infix Operators + + # Main + (specialName, Keyword.Reserved), + + # Prefix Operators + (words((builtinOps), prefix=r'\(', suffix=r'\)'), Name.Function), + + # Infix Operators (words(builtinOps), Name.Function), - - # Numbers - include('numbers'), - - # Variable Names - (validName, Name.Variable), - - # Parens + + # Numbers + include('numbers'), + + # Variable Names + (validName, Name.Variable), + + # Parens (r'[,()\[\]{}]', Punctuation), - - ], - - 'comment': [ + + ], + + 'comment': [ (r'-(?!\})', Comment.Multiline), (r'\{-', Comment.Multiline, 'comment'), - (r'[^-}]', Comment.Multiline), + (r'[^-}]', Comment.Multiline), (r'-\}', Comment.Multiline, '#pop'), - ], - - 'doublequote': [ + ], + + 'doublequote': [ (r'\\u[0-9a-fA-F]{4}', String.Escape), (r'\\[nrfvb\\"]', String.Escape), - (r'[^"]', String), - (r'"', String, '#pop'), - ], - - 'imports': [ - (r'\w+(\.\w+)*', Name.Class, '#pop'), - ], - - 'numbers': [ - (r'_?\d+\.(?=\d+)', Number.Float), - (r'_?\d+', Number.Integer), - ], - - 'shader': [ - (r'\|(?!\])', Name.Entity), - (r'\|\]', Name.Entity, '#pop'), + (r'[^"]', String), + (r'"', String, '#pop'), + ], + + 'imports': [ + (r'\w+(\.\w+)*', Name.Class, '#pop'), + ], + + 'numbers': [ + (r'_?\d+\.(?=\d+)', Number.Float), + (r'_?\d+', Number.Integer), + ], + + 'shader': [ + (r'\|(?!\])', Name.Entity), + (r'\|\]', Name.Entity, '#pop'), (r'(.*)(\n)', bygroups(Name.Entity, Whitespace)), - ], - } + ], + } |