a
    €˜ëjL  ã                   @   sš   d Z ddlZddl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mZ g d¢Ze 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-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)ÚLexerÚ
RegexLexerÚincludeÚdo_insertions)
ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚGenericÚ
Whitespace)ÚRConsoleLexerÚSLexerÚRdLexerz.*?
c                   @   s6   e Zd ZdZdZddgZdgZdZdZdZ	d	d
„ Z
dS )r   z@
    For R console transcripts or R CMD BATCH output files.
    ZRConsoleZrconsoleZroutz*.Routúhttps://www.r-project.orgÚ z"rconsole/r-console-transcript.Routc              	   c   sÌ   t f i | j¤Ž}d}g }t |¡D ]Š}| ¡ }| d¡sB| d¡rx| t|ƒdtj	|d d… fgf¡ ||dd … 7 }q"|ršt
|| |¡ƒE d H  d}g }| ¡ tj|fV  q"|rÈt
|| |¡ƒE d H  d S )Nr   ú>ú+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© r%   úP/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pygments/lexers/r.pyr   #   s*    
ÿ
ÿ

ÿz$RConsoleLexer.get_tokens_unprocessedN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesÚurlÚversion_addedZ_exampler   r%   r%   r%   r&   r      s   r   c                   @   s  e Zd ZdZdZg d¢Zg d¢Zg d¢ZdZdZ	dZ
d	ejfge
efgd
e
› d�ej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ƒed ƒged!ƒd"efd#efgd$ed%fgd&ed%fgd'œZd(d)„ Zd*S )+r   z+
    For S, S-plus, and R source code.
    ÚS)ZsplusÚsÚr)z*.Sz*.Rz	.Rhistoryz	.Rprofilez	.Renviron)ztext/S-plusztext/Sztext/x-r-sourceztext/x-rztext/x-Rztext/x-r-historyztext/x-r-profiler   z0.10z;`[^`\\]*(?:\\.[^`\\]*)*`|(?:[a-zA-Z]|\.[A-Za-z_.])[\w.]*|\.z#.*$ú(z
)\s*(?=\()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[TF]\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ÚkeywordsÚfunction_nameÚ
valid_nameÚnumbersÚpunctuationÚ	operatorsÚ
statementsz\{|\}Ú.z([^\'\\]|\\.)*\'z#popz([^"\\]|\\.)*")r4   r:   r9   r<   r8   r=   r7   r;   r>   Úrootr5   r6   c                 C   s   t  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-   Ú	mimetypesr.   r/   r:   r   ÚSingler
   ZFunctionr   r	   ZReservedr   ÚConstantÚBuiltinZPseudor   ZHexr   r   r   r   ÚtokensrC   r%   r%   r%   r&   r   F   sn   ÿÿÿÿþÿþý
û	ÿüôúÿÿ¾Gr   c                
   @   sn   e Zd ZdZdZdgZdgZdgZdZd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   aR  
    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>`_.
    ZRdÚrdz*.Rdztext/x-r-docz1http://cran.r-project.org/doc/manuals/R-exts.htmlz1.6r@   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-   rD   r.   r/   r   ZEscaper   r	   rF   ZPreprocr
   rG   r   rH   r%   r%   r%   r&   r       s$   ñÿr   )r*   rA   Zpygments.lexerr   r   r   r   Zpygments.tokenr   r   r   r	   r
   r   r   r   r   r   Ú__all__Úcompiler   r   r   r   r%   r%   r%   r&   Ú<module>   s   
0
/Z