404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.222.30.84: ~ $
# -*- coding: utf-8 -*-
"""
    pygments.lexers.shell
    ~~~~~~~~~~~~~~~~~~~~~

    Lexers for various shells.

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

import re

from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, \
    include, default, this, using, words
from pygments.token import Punctuation, \
    Text, Comment, Operator, Keyword, Name, String, Number, Generic
from pygments.util import shebang_matches


__all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer',
           'MSDOSSessionLexer', 'PowerShellLexer',
           'PowerShellSessionLexer', 'TcshSessionLexer', 'FishShellLexer']

line_re = re.compile('.*?\n')


class BashLexer(RegexLexer):
    """
    Lexer for (ba|k|z|)sh shell scripts.

    .. versionadded:: 0.6
    """

    name = 'Bash'
    aliases = ['bash', 'sh', 'ksh', 'zsh', 'shell']
    filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
                 '*.exheres-0', '*.exlib', '*.zsh',
                 '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc',
                 'PKGBUILD']
    mimetypes = ['application/x-sh', 'application/x-shellscript']

    tokens = {
        'root': [
            include('basic'),
            (r'`', String.Backtick, 'backticks'),
            include('data'),
            include('interp'),
        ],
        'interp': [
            (r'\$\(\(', Keyword, 'math'),
            (r'\$\(', Keyword, 'paren'),
            (r'\$\{#?', String.Interpol, 'curly'),
            (r'\$[a-zA-Z_]\w*', Name.Variable),  # user variable
            (r'\$(?:\d+|[#$?!_*@-])', Name.Variable),      # builtin
            (r'\$', Text),
        ],
        'basic': [
            (r'\b(if|fi|else|while|do|done|for|then|return|function|case|'
             r'select|continue|until|esac|elif)(\s*)\b',
             bygroups(Keyword, Text)),
            (r'\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|'
             r'complete|declare|dirs|disown|echo|enable|eval|exec|exit|'
             r'export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|'
             r'local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|'
             r'shopt|source|suspend|test|time|times|trap|true|type|typeset|'
             r'ulimit|umask|unalias|unset|wait)(?=[\s)`])',
             Name.Builtin),
            (r'\A#!.+\n', Comment.Hashbang),
            (r'#.*\n', Comment.Single),
            (r'\\[\w\W]', String.Escape),
            (r'(\b\w+)(\s*)(\+?=)', bygroups(Name.Variable, Text, Operator)),
            (r'[\[\]{}()=]', Operator),
            (r'<<<', Operator),  # here-string
            (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
            (r'&&|\|\|', Operator),
        ],
        'data': [
            (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double),
            (r'"', String.Double, 'string'),
            (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
            (r"(?s)'.*?'", String.Single),
            (r';', Punctuation),
            (r'&', Punctuation),
            (r'\|', Punctuation),
            (r'\s+', Text),
            (r'\d+\b', Number),
            (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
            (r'<', Text),
        ],
        'string': [
            (r'"', String.Double, '#pop'),
            (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double),
            include('interp'),
        ],
        'curly': [
            (r'\}', String.Interpol, '#pop'),
            (r':-', Keyword),
            (r'\w+', Name.Variable),
            (r'[^}:"\'`$\\]+', Punctuation),
            (r':', Punctuation),
            include('root'),
        ],
        'paren': [
            (r'\)', Keyword, '#pop'),
            include('root'),
        ],
        'math': [
            (r'\)\)', Keyword, '#pop'),
            (r'[-+*/%^|&]|\*\*|\|\|', Operator),
            (r'\d+#\d+', Number),
            (r'\d+#(?! )', Number),
            (r'\d+', Number),
            include('root'),
        ],
        'backticks': [
            (r'`', String.Backtick, '#pop'),
            include('root'),
        ],
    }

    def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2


class ShellSessionBaseLexer(Lexer):
    """
    Base lexer for simplistic shell sessions.

    .. versionadded:: 2.1
    """
    def get_tokens_unprocessed(self, text):
        innerlexer = self._innerLexerCls(**self.options)

        pos = 0
        curcode = ''
        insertions = []
        backslash_continuation = False

        for match in line_re.finditer(text):
            line = match.group()
            m = re.match(self._ps1rgx, line)
            if backslash_continuation:
                curcode += line
                backslash_continuation = curcode.endswith('\\\n')
            elif m:
                # To support output lexers (say diff output), the output
                # needs to be broken by prompts whenever the output lexer
                # changes.
                if not insertions:
                    pos = match.start()

                insertions.append((len(curcode),
                                   [(0, Generic.Prompt, m.group(1))]))
                curcode += m.group(2)
                backslash_continuation = curcode.endswith('\\\n')
            elif line.startswith(self._ps2):
                insertions.append((len(curcode),
                                   [(0, Generic.Prompt, line[:len(self._ps2)])]))
                curcode += line[len(self._ps2):]
                backslash_continuation = curcode.endswith('\\\n')
            else:
                if insertions:
                    toks = innerlexer.get_tokens_unprocessed(curcode)
                    for i, t, v in do_insertions(insertions, toks):
                        yield pos+i, t, v
                yield match.start(), Generic.Output, line
                insertions = []
                curcode = ''
        if insertions:
            for i, t, v in do_insertions(insertions,
                                         innerlexer.get_tokens_unprocessed(curcode)):
                yield pos+i, t, v


class BashSessionLexer(ShellSessionBaseLexer):
    """
    Lexer for simplistic shell sessions.

    .. versionadded:: 1.1
    """

    name = 'Bash Session'
    aliases = ['console', 'shell-session']
    filenames = ['*.sh-session', '*.shell-session']
    mimetypes = ['application/x-shell-session', 'application/x-sh-session']

    _innerLexerCls = BashLexer
    _ps1rgx = \
        r'^((?:(?:\[.*?\])|(?:\(\S+\))?(?:| |sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)' \
        r'?|\[\S+[@:][^\n]+\].+))\s*[$#%])(.*\n?)'
    _ps2 = '>'


class BatchLexer(RegexLexer):
    """
    Lexer for the DOS/Windows Batch file format.

    .. versionadded:: 0.7
    """
    name = 'Batchfile'
    aliases = ['bat', 'batch', 'dosbatch', 'winbatch']
    filenames = ['*.bat', '*.cmd']
    mimetypes = ['application/x-dos-batch']

    flags = re.MULTILINE | re.IGNORECASE

    _nl = r'\n\x1a'
    _punct = r'&<>|'
    _ws = r'\t\v\f\r ,;=\xa0'
    _space = r'(?:(?:(?:\^[%s])?[%s])+)' % (_nl, _ws)
    _keyword_terminator = (r'(?=(?:\^[%s]?)?[%s+./:[\\\]]|[%s%s(])' %
                           (_nl, _ws, _nl, _punct))
    _token_terminator = r'(?=\^?[%s]|[%s%s])' % (_ws, _punct, _nl)
    _start_label = r'((?:(?<=^[^:])|^[^:]?)[%s]*)(:)' % _ws
    _label = r'(?:(?:[^%s%s%s+:^]|\^[%s]?[\w\W])*)' % (_nl, _punct, _ws, _nl)
    _label_compound = (r'(?:(?:[^%s%s%s+:^)]|\^[%s]?[^)])*)' %
                       (_nl, _punct, _ws, _nl))
    _number = r'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)' % _token_terminator
    _opword = r'(?:equ|geq|gtr|leq|lss|neq)'
    _string = r'(?:"[^%s"]*(?:"|(?=[%s])))' % (_nl, _nl)
    _variable = (r'(?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|'
                 r'[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|'
                 r'\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|'
                 r'(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:'
                 r'[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))' %
                 (_nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl))
    _core_token = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s])+)' % (_nl, _nl, _punct, _ws)
    _core_token_compound = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s)])+)' % (_nl, _nl,
                                                                  _punct, _ws)
    _token = r'(?:[%s]+|%s)' % (_punct, _core_token)
    _token_compound = r'(?:[%s]+|%s)' % (_punct, _core_token_compound)
    _stoken = (r'(?:[%s]+|(?:%s|%s|%s)+)' %
               (_punct, _string, _variable, _core_token))

    def _make_begin_state(compound, _core_token=_core_token,
                          _core_token_compound=_core_token_compound,
                          _keyword_terminator=_keyword_terminator,
                          _nl=_nl, _punct=_punct, _string=_string,
                          _space=_space, _start_label=_start_label,
                          _stoken=_stoken, _token_terminator=_token_terminator,
                          _variable=_variable, _ws=_ws):
        rest = '(?:%s|%s|[^"%%%s%s%s])*' % (_string, _variable, _nl, _punct,
                                            ')' if compound else '')
        rest_of_line = r'(?:(?:[^%s^]|\^[%s]?[\w\W])*)' % (_nl, _nl)
        rest_of_line_compound = r'(?:(?:[^%s^)]|\^[%s]?[^)])*)' % (_nl, _nl)
        set_space = r'((?:(?:\^[%s]?)?[^\S\n])*)' % _nl
        suffix = ''
        if compound:
            _keyword_terminator = r'(?:(?=\))|%s)' % _keyword_terminator
            _token_terminator = r'(?:(?=\))|%s)' % _token_terminator
            suffix = '/compound'
        return [
            ((r'\)', Punctuation, '#pop') if compound else
             (r'\)((?=\()|%s)%s' % (_token_terminator, rest_of_line),
              Comment.Single)),
            (r'(?=%s)' % _start_label, Text, 'follow%s' % suffix),
            (_space, using(this, state='text')),
            include('redirect%s' % suffix),
            (r'[%s]+' % _nl, Text),
            (r'\(', Punctuation, 'root/compound'),
            (r'@+', Punctuation),
            (r'((?:for|if|rem)(?:(?=(?:\^[%s]?)?/)|(?:(?!\^)|'
             r'(?<=m))(?:(?=\()|%s)))(%s?%s?(?:\^[%s]?)?/(?:\^[%s]?)?\?)' %
             (_nl, _token_terminator, _space,
              _core_token_compound if compound else _core_token, _nl, _nl),
             bygroups(Keyword, using(this, state='text')),
             'follow%s' % suffix),
            (r'(goto%s)(%s(?:\^[%s]?)?/(?:\^[%s]?)?\?%s)' %
             (_keyword_terminator, rest, _nl, _nl, rest),
             bygroups(Keyword, using(this, state='text')),
             'follow%s' % suffix),
            (words(('assoc', 'break', 'cd', 'chdir', 'cls', 'color', 'copy',
                    'date', 'del', 'dir', 'dpath', 'echo', 'endlocal', 'erase',
                    'exit', 'ftype', 'keys', 'md', 'mkdir', 'mklink', 'move',
                    'path', 'pause', 'popd', 'prompt', 'pushd', 'rd', 'ren',
                    'rename', 'rmdir', 'setlocal', 'shift', 'start', 'time',
                    'title', 'type', 'ver', 'verify', 'vol'),
                   suffix=_keyword_terminator), Keyword, 'follow%s' % suffix),
            (r'(call)(%s?)(:)' % _space,
             bygroups(Keyword, using(this, state='text'), Punctuation),
             'call%s' % suffix),
            (r'call%s' % _keyword_terminator, Keyword),
            (r'(for%s(?!\^))(%s)(/f%s)' %
             (_token_terminator, _space, _token_terminator),
             bygroups(Keyword, using(this, state='text'), Keyword),
             ('for/f', 'for')),
            (r'(for%s(?!\^))(%s)(/l%s)' %
             (_token_terminator, _space, _token_terminator),
             bygroups(Keyword, using(this, state='text'), Keyword),
             ('for/l', 'for')),
            (r'for%s(?!\^)' % _token_terminator, Keyword, ('for2', 'for')),
            (r'(goto%s)(%s?)(:?)' % (_keyword_terminator, _space),
             bygroups(Keyword, using(this, state='text'), Punctuation),
             'label%s' % suffix),
            (r'(if(?:(?=\()|%s)(?!\^))(%s?)((?:/i%s)?)(%s?)((?:not%s)?)(%s?)' %
             (_token_terminator, _space, _token_terminator, _space,
              _token_terminator, _space),
             bygroups(Keyword, using(this, state='text'), Keyword,
                      using(this, state='text'), Keyword,
                      using(this, state='text')), ('(?', 'if')),
            (r'rem(((?=\()|%s)%s?%s?.*|%s%s)' %
             (_token_terminator, _space, _stoken, _keyword_terminator,
              rest_of_line_compound if compound else rest_of_line),
             Comment.Single, 'follow%s' % suffix),
            (r'(set%s)%s(/a)' % (_keyword_terminator, set_space),
             bygroups(Keyword, using(this, state='text'), Keyword),
             'arithmetic%s' % suffix),
            (r'(set%s)%s((?:/p)?)%s((?:(?:(?:\^[%s]?)?[^"%s%s^=%s]|'
             r'\^[%s]?[^"=])+)?)((?:(?:\^[%s]?)?=)?)' %
             (_keyword_terminator, set_space, set_space, _nl, _nl, _punct,
              ')' if compound else '', _nl, _nl),
             bygroups(Keyword, using(this, state='text'), Keyword,
                      using(this, state='text'), using(this, state='variable'),
                      Punctuation),
             'follow%s' % suffix),
            default('follow%s' % suffix)
        ]

    def _make_follow_state(compound, _label=_label,
                           _label_compound=_label_compound, _nl=_nl,
                           _space=_space, _start_label=_start_label,
                           _token=_token, _token_compound=_token_compound,
                           _ws=_ws):
        suffix = '/compound' if compound else ''
        state = []
        if compound:
            state.append((r'(?=\))', Text, '#pop'))
        state += [
            (r'%s([%s]*)(%s)(.*)' %
             (_start_label, _ws, _label_compound if compound else _label),
             bygroups(Text, Punctuation, Text, Name.Label, Comment.Single)),
            include('redirect%s' % suffix),
            (r'(?=[%s])' % _nl, Text, '#pop'),
            (r'\|\|?|&&?', Punctuation, '#pop'),
            include('text')
        ]
        return state

    def _make_arithmetic_state(compound, _nl=_nl, _punct=_punct,
                               _string=_string, _variable=_variable, _ws=_ws):
        op = r'=+\-*/!~'
        state = []
        if compound:
            state.append((r'(?=\))', Text, '#pop'))
        state += [
            (r'0[0-7]+', Number.Oct),
            (r'0x[\da-f]+', Number.Hex),
            (r'\d+', Number.Integer),
            (r'[(),]+', Punctuation),
            (r'([%s]|%%|\^\^)+' % op, Operator),
            (r'(%s|%s|(\^[%s]?)?[^()%s%%^"%s%s%s]|\^[%s%s]?%s)+' %
             (_string, _variable, _nl, op, _nl, _punct, _ws, _nl, _ws,
              r'[^)]' if compound else r'[\w\W]'),
             using(this, state='variable')),
            (r'(?=[\x00|&])', Text, '#pop'),
            include('follow')
        ]
        return state

    def _make_call_state(compound, _label=_label,
                         _label_compound=_label_compound):
        state = []
        if compound:
            state.append((r'(?=\))', Text, '#pop'))
        state.append((r'(:?)(%s)' % (_label_compound if compound else _label),
                      bygroups(Punctuation, Name.Label), '#pop'))
        return state

    def _make_label_state(compound, _label=_label,
                          _label_compound=_label_compound, _nl=_nl,
                          _punct=_punct, _string=_string, _variable=_variable):
        state = []
        if compound:
            state.append((r'(?=\))', Text, '#pop'))
        state.append((r'(%s?)((?:%s|%s|\^[%s]?%s|[^"%%^%s%s%s])*)' %
                      (_label_compound if compound else _label, _string,
                       _variable, _nl, r'[^)]' if compound else r'[\w\W]', _nl,
                       _punct, r')' if compound else ''),
                      bygroups(Name.Label, Comment.Single), '#pop'))
        return state

    def _make_redirect_state(compound,
                             _core_token_compound=_core_token_compound,
                             _nl=_nl, _punct=_punct, _stoken=_stoken,
                             _string=_string, _space=_space,
                             _variable=_variable, _ws=_ws):
        stoken_compound = (r'(?:[%s]+|(?:%s|%s|%s)+)' %
                           (_punct, _string, _variable, _core_token_compound))
        return [
            (r'((?:(?<=[%s%s])\d)?)(>>?&|<&)([%s%s]*)(\d)' %
             (_nl, _ws, _nl, _ws),
             bygroups(Number.Integer, Punctuation, Text, Number.Integer)),
            (r'((?:(?<=[%s%s])(?<!\^[%s])\d)?)(>>?|<)(%s?%s)' %
             (_nl, _ws, _nl, _space, stoken_compound if compound else _stoken),
             bygroups(Number.Integer, Punctuation, using(this, state='text')))
        ]

    tokens = {
        'root': _make_begin_state(False),
        'follow': _make_follow_state(False),
        'arithmetic': _make_arithmetic_state(False),
        'call': _make_call_state(False),
        'label': _make_label_state(False),
        'redirect': _make_redirect_state(False),
        'root/compound': _make_begin_state(True),
        'follow/compound': _make_follow_state(True),
        'arithmetic/compound': _make_arithmetic_state(True),
        'call/compound': _make_call_state(True),
        'label/compound': _make_label_state(True),
        'redirect/compound': _make_redirect_state(True),
        'variable-or-escape': [
            (_variable, Name.Variable),
            (r'%%%%|\^[%s]?(\^!|[\w\W])' % _nl, String.Escape)
        ],
        'string': [
            (r'"', String.Double, '#pop'),
            (_variable, Name.Variable),
            (r'\^!|%%', String.Escape),
            (r'[^"%%^%s]+|[%%^]' % _nl, String.Double),
            default('#pop')
        ],
        'sqstring': [
            include('variable-or-escape'),
            (r'[^%]+|%', String.Single)
        ],
        'bqstring': [
            include('variable-or-escape'),
            (r'[^%]+|%', String.Backtick)
        ],
        'text': [
            (r'"', String.Double, 'string'),
            include('variable-or-escape'),
            (r'[^"%%^%s%s%s\d)]+|.' % (_nl, _punct, _ws), Text)
        ],
        'variable': [
            (r'"', String.Double, 'string'),
            include('variable-or-escape'),
            (r'[^"%%^%s]+|.' % _nl, Name.Variable)
        ],
        'for': [
            (r'(%s)(in)(%s)(\()' % (_space, _space),
             bygroups(using(this, state='text'), Keyword,
                      using(this, state='text'), Punctuation), '#pop'),
            include('follow')
        ],
        'for2': [
            (r'\)', Punctuation),
            (r'(%s)(do%s)' % (_space, _token_terminator),
             bygroups(using(this, state='text'), Keyword), '#pop'),
            (r'[%s]+' % _nl, Text),
            include('follow')
        ],
        'for/f': [
            (r'(")((?:%s|[^"])*?")([%s%s]*)(\))' % (_variable, _nl, _ws),
             bygroups(String.Double, using(this, state='string'), Text,
                      Punctuation)),
            (r'"', String.Double, ('#pop', 'for2', 'string')),
            (r"('(?:%%%%|%s|[\w\W])*?')([%s%s]*)(\))" % (_variable, _nl, _ws),
             bygroups(using(this, state='sqstring'), Text, Punctuation)),
            (r'(`(?:%%%%|%s|[\w\W])*?`)([%s%s]*)(\))' % (_variable, _nl, _ws),
             bygroups(using(this, state='bqstring'), Text, Punctuation)),
            include('for2')
        ],
        'for/l': [
            (r'-?\d+', Number.Integer),
            include('for2')
        ],
        'if': [
            (r'((?:cmdextversion|errorlevel)%s)(%s)(\d+)' %
             (_token_terminator, _space),
             bygroups(Keyword, using(this, state='text'),
                      Number.Integer), '#pop'),
            (r'(defined%s)(%s)(%s)' % (_token_terminator, _space, _stoken),
             bygroups(Keyword, using(this, state='text'),
                      using(this, state='variable')), '#pop'),
            (r'(exist%s)(%s%s)' % (_token_terminator, _space, _stoken),
             bygroups(Keyword, using(this, state='text')), '#pop'),
            (r'(%s%s)(%s)(%s%s)' % (_number, _space, _opword, _space, _number),
             bygroups(using(this, state='arithmetic'), Operator.Word,
                      using(this, state='arithmetic')), '#pop'),
            (_stoken, using(this, state='text'), ('#pop', 'if2')),
        ],
        'if2': [
            (r'(%s?)(==)(%s?%s)' % (_space, _space, _stoken),
             bygroups(using(this, state='text'), Operator,
                      using(this, state='text')), '#pop'),
            (r'(%s)(%s)(%s%s)' % (_space, _opword, _space, _stoken),
             bygroups(using(this, state='text'), Operator.Word,
                      using(this, state='text')), '#pop')
        ],
        '(?': [
            (_space, using(this, state='text')),
            (r'\(', Punctuation, ('#pop', 'else?', 'root/compound')),
            default('#pop')
        ],
        'else?': [
            (_space, using(this, state='text')),
            (r'else%s' % _token_terminator, Keyword, '#pop'),
            default('#pop')
        ]
    }


class MSDOSSessionLexer(ShellSessionBaseLexer):
    """
    Lexer for simplistic MSDOS sessions.

    .. versionadded:: 2.1
    """

    name = 'MSDOS Session'
    aliases = ['doscon']
    filenames = []
    mimetypes = []

    _innerLexerCls = BatchLexer
    _ps1rgx = r'^([^>]+>)(.*\n?)'
    _ps2 = 'More? '


class TcshLexer(RegexLexer):
    """
    Lexer for tcsh scripts.

    .. versionadded:: 0.10
    """

    name = 'Tcsh'
    aliases = ['tcsh', 'csh']
    filenames = ['*.tcsh', '*.csh']
    mimetypes = ['application/x-csh']

    tokens = {
        'root': [
            include('basic'),
            (r'\$\(', Keyword, 'paren'),
            (r'\$\{#?', Keyword, 'curly'),
            (r'`', String.Backtick, 'backticks'),
            include('data'),
        ],
        'basic': [
            (r'\b(if|endif|else|while|then|foreach|case|default|'
             r'continue|goto|breaksw|end|switch|endsw)\s*\b',
             Keyword),
            (r'\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|'
             r'complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|'
             r'glob|getspath|hashstat|history|hup|inlib|jobs|kill|'
             r'limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|'
             r'onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|'
             r'set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|'
             r'source|stop|suspend|source|suspend|telltc|time|'
             r'umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|'
             r'ver|wait|warp|watchlog|where|which)\s*\b',
             Name.Builtin),
            (r'#.*', Comment),
            (r'\\[\w\W]', String.Escape),
            (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)),
            (r'[\[\]{}()=]+', Operator),
            (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
            (r';', Punctuation),
        ],
        'data': [
            (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
            (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
            (r'\s+', Text),
            (r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
            (r'\d+(?= |\Z)', Number),
            (r'\$#?(\w+|.)', Name.Variable),
        ],
        'curly': [
            (r'\}', Keyword, '#pop'),
            (r':-', Keyword),
            (r'\w+', Name.Variable),
            (r'[^}:"\'`$]+', Punctuation),
            (r':', Punctuation),
            include('root'),
        ],
        'paren': [
            (r'\)', Keyword, '#pop'),
            include('root'),
        ],
        'backticks': [
            (r'`', String.Backtick, '#pop'),
            include('root'),
        ],
    }


class TcshSessionLexer(ShellSessionBaseLexer):
    """
    Lexer for Tcsh sessions.

    .. versionadded:: 2.1
    """

    name = 'Tcsh Session'
    aliases = ['tcshcon']
    filenames = []
    mimetypes = []

    _innerLexerCls = TcshLexer
    _ps1rgx = r'^([^>]+>)(.*\n?)'
    _ps2 = '? '


class PowerShellLexer(RegexLexer):
    """
    For Windows PowerShell code.

    .. versionadded:: 1.5
    """
    name = 'PowerShell'
    aliases = ['powershell', 'posh', 'ps1', 'psm1']
    filenames = ['*.ps1', '*.psm1']
    mimetypes = ['text/x-powershell']

    flags = re.DOTALL | re.IGNORECASE | re.MULTILINE

    keywords = (
        'while validateset validaterange validatepattern validatelength '
        'validatecount until trap switch return ref process param parameter in '
        'if global: function foreach for finally filter end elseif else '
        'dynamicparam do default continue cmdletbinding break begin alias \\? '
        '% #script #private #local #global mandatory parametersetname position '
        'valuefrompipeline valuefrompipelinebypropertyname '
        'valuefromremainingarguments helpmessage try catch throw').split()

    operators = (
        'and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle '
        'clike clt cmatch cne cnotcontains cnotlike cnotmatch contains '
        'creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt '
        'imatch ine inotcontains inotlike inotmatch ireplace is isnot le like '
        'lt match ne not notcontains notlike notmatch or regex replace '
        'wildcard').split()

    verbs = (
        'write where wait use update unregister undo trace test tee take '
        'suspend stop start split sort skip show set send select scroll resume '
        'restore restart resolve resize reset rename remove register receive '
        'read push pop ping out new move measure limit join invoke import '
        'group get format foreach export expand exit enter enable disconnect '
        'disable debug cxnew copy convertto convertfrom convert connect '
        'complete compare clear checkpoint aggregate add').split()

    commenthelp = (
        'component description example externalhelp forwardhelpcategory '
        'forwardhelptargetname functionality inputs link '
        'notes outputs parameter remotehelprunspace role synopsis').split()

    tokens = {
        'root': [
            # we need to count pairs of parentheses for correct highlight
            # of '$(...)' blocks in strings
            (r'\(', Punctuation, 'child'),
            (r'\s+', Text),
            (r'^(\s*#[#\s]*)(\.(?:%s))([^\n]*$)' % '|'.join(commenthelp),
             bygroups(Comment, String.Doc, Comment)),
            (r'#[^\n]*?$', Comment),
            (r'(&lt;|<)#', Comment.Multiline, 'multline'),
            (r'@"\n', String.Heredoc, 'heredoc-double'),
            (r"@'\n.*?\n'@", String.Heredoc),
            # escaped syntax
            (r'`[\'"$@-]', Punctuation),
            (r'"', String.Double, 'string'),
            (r"'([^']|'')*'", String.Single),
            (r'(\$|@@|@)((global|script|private|env):)?\w+',
             Name.Variable),
            (r'(%s)\b' % '|'.join(keywords), Keyword),
            (r'-(%s)\b' % '|'.join(operators), Operator),
            (r'(%s)-[a-z_]\w*\b' % '|'.join(verbs), Name.Builtin),
            (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant),  # .net [type]s
            (r'-[a-z_]\w*', Name),
            (r'\w+', Name),
            (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation),
        ],
        'child': [
            (r'\)', Punctuation, '#pop'),
            include('root'),
        ],
        'multline': [
            (r'[^#&.]+', Comment.Multiline),
            (r'#(>|&gt;)', Comment.Multiline, '#pop'),
            (r'\.(%s)' % '|'.join(commenthelp), String.Doc),
            (r'[#&.]', Comment.Multiline),
        ],
        'string': [
            (r"`[0abfnrtv'\"$`]", String.Escape),
            (r'[^$`"]+', String.Double),
            (r'\$\(', Punctuation, 'child'),
            (r'""', String.Double),
            (r'[`$]', String.Double),
            (r'"', String.Double, '#pop'),
        ],
        'heredoc-double': [
            (r'\n"@', String.Heredoc, '#pop'),
            (r'\$\(', Punctuation, 'child'),
            (r'[^@\n]+"]', String.Heredoc),
            (r".", String.Heredoc),
        ]
    }


class PowerShellSessionLexer(ShellSessionBaseLexer):
    """
    Lexer for simplistic Windows PowerShell sessions.

    .. versionadded:: 2.1
    """

    name = 'PowerShell Session'
    aliases = ['ps1con']
    filenames = []
    mimetypes = []

    _innerLexerCls = PowerShellLexer
    _ps1rgx = r'^(PS [^>]+> )(.*\n?)'
    _ps2 = '>> '


class FishShellLexer(RegexLexer):
    """
    Lexer for Fish shell scripts.

    .. versionadded:: 2.1
    """

    name = 'Fish'
    aliases = ['fish', 'fishshell']
    filenames = ['*.fish', '*.load']
    mimetypes = ['application/x-fish']

    tokens = {
        'root': [
            include('basic'),
            include('data'),
            include('interp'),
        ],
        'interp': [
            (r'\$\(\(', Keyword, 'math'),
            (r'\(', Keyword, 'paren'),
            (r'\$#?(\w+|.)', Name.Variable),
        ],
        'basic': [
            (r'\b(begin|end|if|else|while|break|for|in|return|function|block|'
             r'case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|'
             r'cd|count|test)(\s*)\b',
             bygroups(Keyword, Text)),
            (r'\b(alias|bg|bind|breakpoint|builtin|command|commandline|'
             r'complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|'
             r'fish_indent|fish_pager|fish_prompt|fish_right_prompt|'
             r'fish_update_completions|fishd|funced|funcsave|functions|help|'
             r'history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|'
             r'pushd|random|read|set_color|source|status|trap|type|ulimit|'
             r'umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)',
             Name.Builtin),
            (r'#.*\n', Comment),
            (r'\\[\w\W]', String.Escape),
            (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)),
            (r'[\[\]()=]', Operator),
            (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
        ],
        'data': [
            (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double),
            (r'"', String.Double, 'string'),
            (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
            (r"(?s)'.*?'", String.Single),
            (r';', Punctuation),
            (r'&|\||\^|<|>', Operator),
            (r'\s+', Text),
            (r'\d+(?= |\Z)', Number),
            (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
        ],
        'string': [
            (r'"', String.Double, '#pop'),
            (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double),
            include('interp'),
        ],
        'paren': [
            (r'\)', Keyword, '#pop'),
            include('root'),
        ],
        'math': [
            (r'\)\)', Keyword, '#pop'),
            (r'[-+*/%^|&]|\*\*|\|\|', Operator),
            (r'\d+#\d+', Number),
            (r'\d+#(?! )', Number),
            (r'\d+', Number),
            include('root'),
        ],
    }

Filemanager

Name Type Size Permission Actions
__init__.py File 10.65 KB 0644
__init__.pyc File 10.55 KB 0644
_asy_builtins.py File 26.68 KB 0644
_asy_builtins.pyc File 32.76 KB 0644
_cl_builtins.py File 13.72 KB 0644
_cl_builtins.pyc File 25.25 KB 0644
_cocoa_builtins.py File 39.04 KB 0644
_cocoa_builtins.pyc File 45.61 KB 0644
_csound_builtins.py File 21.14 KB 0644
_csound_builtins.pyc File 24.04 KB 0644
_lasso_builtins.py File 131.38 KB 0644
_lasso_builtins.pyc File 121.02 KB 0644
_lua_builtins.py File 8.14 KB 0644
_lua_builtins.pyc File 10.73 KB 0644
_mapping.py File 53.43 KB 0644
_mapping.pyc File 77.25 KB 0644
_mql_builtins.py File 24.16 KB 0644
_mql_builtins.pyc File 28.95 KB 0644
_openedge_builtins.py File 47.23 KB 0644
_openedge_builtins.pyc File 80.1 KB 0644
_php_builtins.py File 150.75 KB 0644
_php_builtins.pyc File 134.8 KB 0644
_postgres_builtins.py File 10.95 KB 0644
_postgres_builtins.pyc File 13.06 KB 0644
_scilab_builtins.py File 51.18 KB 0644
_scilab_builtins.pyc File 71.95 KB 0644
_sourcemod_builtins.py File 26.48 KB 0644
_sourcemod_builtins.pyc File 31.43 KB 0644
_stan_builtins.py File 9.88 KB 0644
_stan_builtins.pyc File 11.97 KB 0644
_stata_builtins.py File 24.55 KB 0644
_stata_builtins.pyc File 36.1 KB 0644
_tsql_builtins.py File 15.12 KB 0644
_tsql_builtins.pyc File 15.99 KB 0644
_vim_builtins.py File 55.75 KB 0644
_vim_builtins.pyc File 62.26 KB 0644
actionscript.py File 10.92 KB 0644
actionscript.pyc File 11.36 KB 0644
agile.py File 900 B 0644
agile.pyc File 1.4 KB 0644
algebra.py File 7.03 KB 0644
algebra.pyc File 7.76 KB 0644
ambient.py File 2.5 KB 0644
ambient.pyc File 2.87 KB 0644
ampl.py File 4.02 KB 0644
ampl.pyc File 4.61 KB 0644
apl.py File 3.09 KB 0644
apl.pyc File 1.99 KB 0644
archetype.py File 10.87 KB 0644
archetype.pyc File 7.44 KB 0644
asm.py File 24.67 KB 0644
asm.pyc File 23.89 KB 0644
automation.py File 19.19 KB 0644
automation.pyc File 16.59 KB 0644
basic.py File 19.83 KB 0644
basic.pyc File 17.63 KB 0644
bibtex.py File 4.61 KB 0644
bibtex.pyc File 4.43 KB 0644
business.py File 27.02 KB 0644
business.pyc File 25.07 KB 0644
c_cpp.py File 10.28 KB 0644
c_cpp.pyc File 9.72 KB 0644
c_like.py File 23.56 KB 0644
c_like.pyc File 26.43 KB 0644
capnproto.py File 2.14 KB 0644
capnproto.pyc File 2.02 KB 0644
chapel.py File 3.43 KB 0644
chapel.pyc File 3.36 KB 0644
clean.py File 10.16 KB 0644
clean.pyc File 8.27 KB 0644
compiled.py File 1.35 KB 0644
compiled.pyc File 2.14 KB 0644
configs.py File 27.6 KB 0644
configs.pyc File 25.05 KB 0644
console.py File 4.02 KB 0644
console.pyc File 3.85 KB 0644
crystal.py File 16.45 KB 0644
crystal.pyc File 11.39 KB 0644
csound.py File 12.25 KB 0644
csound.pyc File 9.39 KB 0644
css.py File 30.77 KB 0644
css.pyc File 37.17 KB 0644
d.py File 9.31 KB 0644
d.pyc File 7.69 KB 0644
dalvik.py File 4.32 KB 0644
dalvik.pyc File 3.71 KB 0644
data.py File 18.33 KB 0644
data.pyc File 12.44 KB 0644
diff.py File 4.76 KB 0644
diff.pyc File 4.4 KB 0644
dotnet.py File 27.02 KB 0644
dotnet.pyc File 23.13 KB 0644
dsls.py File 32.55 KB 0644
dsls.pyc File 31.3 KB 0644
dylan.py File 10.18 KB 0644
dylan.pyc File 11.14 KB 0644
ecl.py File 5.74 KB 0644
ecl.pyc File 6.7 KB 0644
eiffel.py File 2.42 KB 0644
eiffel.pyc File 2.91 KB 0644
elm.py File 2.93 KB 0644
elm.pyc File 2.91 KB 0644
erlang.py File 18.49 KB 0644
erlang.pyc File 17.2 KB 0644
esoteric.py File 9.27 KB 0644
esoteric.pyc File 9.15 KB 0644
ezhil.py File 2.95 KB 0644
ezhil.pyc File 3.71 KB 0644
factor.py File 17.44 KB 0644
factor.pyc File 23.61 KB 0644
fantom.py File 9.75 KB 0644
fantom.pyc File 5.88 KB 0644
felix.py File 9.19 KB 0644
felix.pyc File 7.73 KB 0644
forth.py File 6.98 KB 0644
forth.pyc File 4.84 KB 0644
fortran.py File 9.54 KB 0644
fortran.pyc File 11.16 KB 0644
foxpro.py File 25.62 KB 0644
foxpro.pyc File 19.9 KB 0644
functional.py File 698 B 0644
functional.pyc File 1.08 KB 0644
go.py File 3.61 KB 0644
go.pyc File 3.37 KB 0644
grammar_notation.py File 6.18 KB 0644
grammar_notation.pyc File 5.56 KB 0644
graph.py File 2.31 KB 0644
graph.pyc File 2.34 KB 0644
graphics.py File 25.23 KB 0644
graphics.pyc File 23.52 KB 0644
haskell.py File 30.49 KB 0644
haskell.pyc File 23.51 KB 0644
haxe.py File 30.23 KB 0644
haxe.pyc File 18.35 KB 0644
hdl.py File 18.26 KB 0644
hdl.pyc File 18.96 KB 0644
hexdump.py File 3.42 KB 0644
hexdump.pyc File 2.95 KB 0644
html.py File 18.82 KB 0644
html.pyc File 15.04 KB 0644
idl.py File 14.63 KB 0644
idl.pyc File 18.94 KB 0644
igor.py File 19.53 KB 0644
igor.pyc File 24.74 KB 0644
inferno.py File 3.04 KB 0644
inferno.pyc File 2.92 KB 0644
installers.py File 12.56 KB 0644
installers.pyc File 10.6 KB 0644
int_fiction.py File 54.47 KB 0644
int_fiction.pyc File 34.88 KB 0644
iolang.py File 1.86 KB 0644
iolang.pyc File 1.94 KB 0644
j.py File 4.42 KB 0644
j.pyc File 4.2 KB 0644
javascript.py File 58.72 KB 0644
javascript.pyc File 41.33 KB 0644
julia.py File 13.76 KB 0644
julia.pyc File 11.5 KB 0644
jvm.py File 65.18 KB 0644
jvm.pyc File 50.73 KB 0644
lisp.py File 137.38 KB 0644
lisp.pyc File 205.18 KB 0644
make.py File 7.16 KB 0644
make.pyc File 5.37 KB 0644
markup.py File 19.97 KB 0644
markup.pyc File 17.25 KB 0644
math.py File 700 B 0644
math.pyc File 1.09 KB 0644
matlab.py File 28.47 KB 0644
matlab.pyc File 30.52 KB 0644
ml.py File 27.23 KB 0644
ml.pyc File 14.98 KB 0644
modeling.py File 12.53 KB 0644
modeling.pyc File 10.87 KB 0644
modula2.py File 51.33 KB 0644
modula2.pyc File 25.89 KB 0644
monte.py File 6.16 KB 0644
monte.pyc File 4.94 KB 0644
ncl.py File 62.49 KB 0644
ncl.pyc File 67.46 KB 0644
nimrod.py File 5.05 KB 0644
nimrod.pyc File 4.74 KB 0644
nit.py File 2.68 KB 0644
nit.pyc File 2.99 KB 0644
nix.py File 3.94 KB 0644
nix.pyc File 4.28 KB 0644
oberon.py File 3.65 KB 0644
oberon.pyc File 3.41 KB 0644
objective.py File 22.22 KB 0644
objective.pyc File 19.74 KB 0644
ooc.py File 2.93 KB 0644
ooc.pyc File 3 KB 0644
other.py File 1.73 KB 0644
other.pyc File 2.71 KB 0644
parasail.py File 2.67 KB 0644
parasail.pyc File 2.58 KB 0644
parsers.py File 26.94 KB 0644
parsers.pyc File 23.14 KB 0644
pascal.py File 31.88 KB 0644
pascal.pyc File 29.58 KB 0644
pawn.py File 7.9 KB 0644
pawn.pyc File 7.16 KB 0644
perl.py File 31.26 KB 0644
perl.pyc File 29.81 KB 0644
php.py File 10.48 KB 0644
php.pyc File 9.26 KB 0644
praat.py File 12.26 KB 0644
praat.pyc File 11.46 KB 0644
prolog.py File 11.78 KB 0644
prolog.pyc File 8.05 KB 0644
python.py File 41.39 KB 0644
python.pyc File 36.48 KB 0644
qvt.py File 5.97 KB 0644
qvt.pyc File 5.27 KB 0644
r.py File 23.2 KB 0644
r.pyc File 32.97 KB 0644
rdf.py File 9.18 KB 0644
rdf.pyc File 6.45 KB 0644
rebol.py File 18.18 KB 0644
rebol.pyc File 13.49 KB 0644
resource.py File 2.86 KB 0644
resource.pyc File 2.86 KB 0644
rnc.py File 1.94 KB 0644
rnc.pyc File 1.78 KB 0644
roboconf.py File 2.02 KB 0644
roboconf.pyc File 2.34 KB 0644
robotframework.py File 18.3 KB 0644
robotframework.pyc File 25.03 KB 0644
ruby.py File 21.62 KB 0644
ruby.pyc File 16.91 KB 0644
rust.py File 7.51 KB 0644
rust.pyc File 5.67 KB 0644
sas.py File 9.23 KB 0644
sas.pyc File 9.63 KB 0644
scripting.py File 66.17 KB 0644
scripting.pyc File 67.97 KB 0644
shell.py File 30.69 KB 0644
shell.pyc File 24.13 KB 0644
smalltalk.py File 7.05 KB 0644
smalltalk.pyc File 5.24 KB 0644
smv.py File 2.74 KB 0644
smv.pyc File 3.16 KB 0644
snobol.py File 2.69 KB 0644
snobol.pyc File 2.27 KB 0644
special.py File 3.08 KB 0644
special.pyc File 3.86 KB 0644
sql.py File 28.75 KB 0644
sql.pyc File 28.6 KB 0644
stata.py File 3.54 KB 0644
stata.pyc File 2.7 KB 0644
supercollider.py File 3.43 KB 0644
supercollider.pyc File 3.83 KB 0644
tcl.py File 5.27 KB 0644
tcl.pyc File 5.1 KB 0644
templates.py File 71.73 KB 0644
templates.pyc File 74.43 KB 0644
testing.py File 10.5 KB 0644
testing.pyc File 8.42 KB 0644
text.py File 977 B 0644
text.pyc File 1.54 KB 0644
textedit.py File 5.92 KB 0644
textedit.pyc File 5.79 KB 0644
textfmts.py File 10.6 KB 0644
textfmts.pyc File 8.41 KB 0644
theorem.py File 18.59 KB 0644
theorem.pyc File 20.07 KB 0644
trafficscript.py File 1.51 KB 0644
trafficscript.pyc File 1.8 KB 0644
typoscript.py File 8.2 KB 0644
typoscript.pyc File 6.41 KB 0644
urbi.py File 5.62 KB 0644
urbi.pyc File 5.48 KB 0644
varnish.py File 7.1 KB 0644
varnish.pyc File 7.15 KB 0644
verification.py File 3.62 KB 0644
verification.pyc File 3.9 KB 0644
web.py File 918 B 0644
web.pyc File 1.4 KB 0644
webmisc.py File 38.96 KB 0644
webmisc.pyc File 28.98 KB 0644
whiley.py File 3.92 KB 0644
whiley.pyc File 3.23 KB 0644
x10.py File 1.92 KB 0644
x10.pyc File 2.6 KB 0644