3 ��X� � @ s� d Z ddlZddlmZ ddlmZmZmZmZmZm Z ddl mZmZm Z mZmZmZmZmZ ddlmZ ddgZG d d� de�ZG d d� de�ZdS )z� pygments.lexers.textedit ~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for languages related to text processing. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N)�bisect)� RegexLexer�include�default�bygroups�using�this)�Text�Comment�Operator�Keyword�Name�String�Number�Punctuation)�PythonLexer�AwkLexer�VimLexerc @ s� e Zd ZdZdZddddgZdgZdgZd efd e j fged�dej d fded"fed �gded fgdedfed�dedfdedfdefdedfdejdfdejfdejfdejfdejfdejfdejfdejfdej fgd �Zd!S )#r z5 For Awk scripts. .. versionadded:: 1.5 ZAwkZawkZgawkZmawkZnawkz*.awkzapplication/x-awkz\s+z#.*$�commentsandwhitespacez(/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/\B�#popz(?=/)�badregexz\nz ^(?=\s|/)�slashstartsregexz3\+\+|--|\|\||&&|in\b|\$|!?~|(\*\*|[-<>+*%\^/!=|])=?z[{(\[;,]z[})\].]z3(break|continue|do|while|exit|for|if|else|return)\bz function\bz�(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next|nextfile|print|printf|strftime|systime|delete|system)\bz�(ARGC|ARGIND|ARGV|BEGIN|CONVFMT|ENVIRON|END|ERRNO|FIELDWIDTHS|FILENAME|FNR|FS|IGNORECASE|NF|NR|OFMT|OFS|ORFS|RLENGTH|RS|RSTART|RT|SUBSEP)\bz [$a-zA-Z_]\w*z%[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?z0x[0-9a-fA-F]+z[0-9]+z"(\\\\|\\"|[^"])*"z'(\\\\|\\'|[^'])*')r r r �rootN)r r )�__name__� __module__�__qualname__�__doc__�name�aliases� filenames� mimetypesr r �Singler r �Regexr r r r ZDeclarationZReservedr �Builtin�Otherr ZFloat�HexZInteger�Double�tokens� r( r( �/usr/lib/python3.6/textedit.pyr s@ c @ s e Zd ZdZdZdgZdddddd d ddg Zd gZej Z dZdde d ee e�eeeeee e�e�fde d ee e�eee e��fdefdefdejfdejfdejfdefdefdejfdefdefdefdejfdejfd efgiZd!d"� Zd#d$� Z d%d&� Z!d'S )(r zA Lexer for VimL script files. .. versionadded:: 0.8 ZVimLZvimz*.vimz.vimrcz.exrcz.gvimrcZ_vimrcZ_exrcZ_gvimrcZvimrcZgvimrcz text/x-vimzpy(?:t(?:h(?:o(?:n)?)?)?)?r z^([ \t:]*)(z()([ \t]*)(<<)([ \t]*)(.*)((?:\n|.)*)(\6)z)([ \t])(.*)z^\s*".*z[ \t]+z/(\\\\|\\/|[^\n/])*/z"(\\\\|\\"|[^\n"])*"z'(''|[^\n'])*'z(?<=\s)"[^\-:.%#=*].*z-?\d+z#[0-9a-f]{6}z^:z [()<>+=!|,~-]z7\b(let|if|else|endif|elseif|fun|function|endfunction)\bz+\b(NONE|bold|italic|underline|dark|light)\bz\b\w+\b�.c K s8 ddl m}m}m} || _|| _|| _tj| f|� d S )Nr )�command�option�auto) Zpygments.lexers._vim_builtinsr+ r, r- �_cmd�_opt�_autr �__init__)�selfZoptionsr+ r, r- r( r( r) r1 { s zVimLexer.__init__c C s� t ||f�}|dkrd||d d |dt||d d �� krd||d d dt|�� |krddS |t|�k r�|| d |dt|| d �� ko�|| d dt|�� |kS dS )a It's kind of difficult to decide if something might be a keyword in VimL because it allows you to abbreviate them. In fact, 'ab[breviate]' is a good example. :ab, :abbre, or :abbreviate are valid ways to call it so rather than making really awful regexps like:: \bab(?:b(?:r(?:e(?:v(?:i(?:a(?:t(?:e)?)?)?)?)?)?)?)?\b we match `\b\w+\b` and then call is_in() on those tokens. See `scripts/get_vimkw.py` for how the lists are extracted. r � NTF)r �len)r2 �w�mapping�pr( r( r) �is_in� s , $zVimLexer.is_inc c s� x�t j| |�D ]v\}}}|tjkrx| j|| j�r>|t|fV q�| j|| j�sZ| j|| j�rj|tj |fV q�|t |fV q|||fV qW d S )N)r �get_tokens_unprocessedr r$ r8 r. r r/ r0 r# r )r2 �text�index�token�valuer( r( r) r9 � s zVimLexer.get_tokens_unprocessedN)"r r r r r r r r �re� MULTILINE�flagsZ_pythonr r r r r r r r r r"