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/py2/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/py2/pygments/lexers/elm.py')
-rw-r--r-- | contrib/python/Pygments/py2/pygments/lexers/elm.py | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/contrib/python/Pygments/py2/pygments/lexers/elm.py b/contrib/python/Pygments/py2/pygments/lexers/elm.py index ee941d7dbb..a6df964d27 100644 --- a/contrib/python/Pygments/py2/pygments/lexers/elm.py +++ b/contrib/python/Pygments/py2/pygments/lexers/elm.py @@ -1,121 +1,121 @@ -# -*- coding: utf-8 -*- -""" - pygments.lexers.elm - ~~~~~~~~~~~~~~~~~~~ - - Lexer for the Elm programming language. - +# -*- coding: utf-8 -*- +""" + pygments.lexers.elm + ~~~~~~~~~~~~~~~~~~~ + + Lexer for the Elm programming language. + :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from pygments.lexer import RegexLexer, words, include -from pygments.token import Comment, Keyword, Name, Number, Punctuation, String, Text - -__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'] - + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, include +from pygments.token import Comment, Keyword, Name, Number, Punctuation, String, Text + +__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', - ), suffix=r'\b') - - tokens = { - 'root': [ - - # Comments + + 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 (r'\{-', Comment.Multiline, 'comment'), - (r'--.*', Comment.Single), - - # Whitespace - (r'\s+', Text), - - # Strings - (r'"', String, 'doublequote'), - - # Modules - (r'^\s*module\s*', Keyword.Namespace, 'imports'), - - # Imports - (r'^\s*import\s*', Keyword.Namespace, 'imports'), - - # Shaders - (r'\[glsl\|.*', Name.Entity, 'shader'), - - # Keywords - (reservedWords, Keyword.Reserved), - - # Types - (r'[A-Z]\w*', Keyword.Type), - - # Main - (specialName, Keyword.Reserved), - - # Prefix Operators - (words((builtinOps), prefix=r'\(', suffix=r'\)'), Name.Function), - - # Infix Operators + (r'--.*', Comment.Single), + + # Whitespace + (r'\s+', Text), + + # Strings + (r'"', String, 'doublequote'), + + # Modules + (r'^\s*module\s*', Keyword.Namespace, 'imports'), + + # Imports + (r'^\s*import\s*', Keyword.Namespace, 'imports'), + + # Shaders + (r'\[glsl\|.*', Name.Entity, 'shader'), + + # Keywords + (reservedWords, Keyword.Reserved), + + # Types + (r'[A-Z]\w*', Keyword.Type), + + # 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'.*\n', Name.Entity), - ], - } + (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', Name.Entity), + ], + } |