3
.ßL]‡  ã               @   sœ   d Z ddlZddlmZmZmZmZmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZ dddgZejdƒZG d	d„ deƒZG d
d„ deƒZG dd„ deƒZdS )zÄ
    pygments.lexers.r
    ~~~~~~~~~~~~~~~~~

    Lexers for the R/S languages.

    :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)ÚLexerÚ
RegexLexerÚincludeÚdo_insertionsÚbygroups)	ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚGenericÚRConsoleLexerÚSLexerÚRdLexerz.*?
c               @   s*   e Zd ZdZdZddgZdgZdd„ ZdS )	r   z@
    For R console transcripts or R CMD BATCH output files.
    ZRConsoleZrconsoleZroutz*.Routc             c   sà   t f | jŽ}d}g }x¢tj|ƒD ]”}|jƒ }|jdƒs@|jdƒrv|jt|ƒdtj	|d d… fgfƒ ||dd … 7 }q |r¢xt
||j|ƒƒD ]
}|V  qŒW d}g }|jƒ tj|fV  q W |rÜxt
||j|ƒƒD ]
}|V  qÎW d S )NÚ ú>ú+r   é   )r   ÚoptionsÚline_reÚfinditerÚgroupÚ
startswithÚappendÚlenr   ZPromptr   Úget_tokens_unprocessedÚstartZOutput)ÚselfÚtextZslexerZcurrent_code_blockZ
insertionsÚmatchÚlineÚitem© r%   ú7/tmp/pip-install-5sebvq2j/pygments/pygments/lexers/r.pyr   !   s(    

z$RConsoleLexer.get_tokens_unprocessedN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesr   r%   r%   r%   r&   r      s
   c               @   s  e Zd ZdZdZdddgZdddd	d
gZdddddddgZdZde	j
fgeefgdefgdejfgdefdefgdejfdejjfgdejfdefgedƒdefdedfd ed!fed"ƒed#ƒed$ƒed%ƒed&ƒed'ƒg
d(e ejfed)ƒd*efd+efgd,ed-fgd.ed-fgd/œZd0d1„ Zd2S )3r   zG
    For S, S-plus, and R source code.

    .. versionadded:: 0.10
    ÚSZsplusÚsÚrz*.Sz*.Rz	.Rhistoryz	.Rprofilez	.Renvironztext/S-plusztext/Sztext/x-r-sourceztext/x-rztext/x-Rztext/x-r-historyztext/x-r-profilez?(?:`[^`\\]*(?:\\.[^`\\]*)*`)|(?:(?:[a-zA-z]|[_.][^0-9])[\w_.]*)z#.*$z\[{1,2}|\]{1,2}|\(|\)|;|,zH(if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])z(<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?z$\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}zm(NULL|NA(_(integer|real|complex|character)_)?|letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))(?![\w.])z(T|F)\bz#0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?z;[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?Úcommentsz\s+z\'Ústring_squotez\"Ústring_dquoteÚbuiltin_symbolsÚ
valid_nameÚnumbersÚkeywordsÚpunctuationÚ	operatorsz(%s)\s*(?=\()Ú
statementsz\{|\}Ú.z([^\'\\]|\\.)*\'z#popz([^"\\]|\\.)*")r1   r5   r8   r7   r9   r4   r6   r:   Úrootr2   r3   c             C   s   t jd| ƒrdS d S )Nz[a-z0-9_\])\s]<-(?!-)g)\�Âõ(¼?)ÚreÚsearch)r!   r%   r%   r&   Úanalyse_text˜   s    zSLexer.analyse_textN)r'   r(   r)   r*   r+   r,   r-   Ú	mimetypesr5   r   ÚSingler   r   r
   ZReservedr	   ÚConstantÚBuiltinZPseudor   ZHexr   r   r   ZFunctionÚtokensr?   r%   r%   r%   r&   r   F   sJ   



c            
   @   sf   e Zd ZdZdZdgZdgZdgZddej	fde
fd	ejfd
efde
jfdejfdefdefgiZdS )r   am  
    Pygments Lexer for R documentation (Rd) files

    This is a very minimal implementation, highlighting little more
    than the macros. A description of Rd syntax is found in `Writing R
    Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_
    and `Parsing Rd files <http://developer.r-project.org/parseRd.pdf>`_.

    .. versionadded:: 1.6
    ZRdÚrdz*.Rdztext/x-r-docr<   z	\\[\\{}%]z%.*$z\\(?:cr|l?dots|R|tab)\bz\\[a-zA-Z]+\bz^\s*#(?:ifn?def|endif).*\bz[{}]z[^\\%\n{}]+r;   N)r'   r(   r)   r*   r+   r,   r-   r@   r   ZEscaper   r
   rB   ZPreprocr   rC   r   rD   r%   r%   r%   r&   r   �   s   
)r*   r=   Zpygments.lexerr   r   r   r   r   Zpygments.tokenr   r   r	   r
   r   r   r   r   r   Ú__all__Úcompiler   r   r   r   r%   r%   r%   r&   Ú<module>
   s   ,

.W