a
    ¨ˆc  ã                   @   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 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-2022 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)Ú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 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 )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© r#   úT/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pygments/lexers/r.pyr       s*    
ÿ
ÿ

ÿz$RConsoleLexer.get_tokens_unprocessedN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesr   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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d$d%„ Zd&S )'r   zG
    For S, S-plus, and R source code.

    .. versionadded:: 0.10
    Ú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-profilez;`[^`\\]*(?:\\.[^`\\]*)*`|(?:[a-zA-Z]|\.[A-Za-z_.])[\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([^"\\]|\\.)*")r/   r3   r6   r5   r7   r2   r4   r8   Úrootr0   r1   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+   Ú	mimetypesr3   r   ÚSingler
   r   r	   ZReservedr   ÚConstantÚBuiltinZPseudor   ZHexr   r   r   ZFunctionÚtokensr=   r#   r#   r#   r$   r   C   sf   ÿÿÿþÿþý
û	ÿüõùÿÿÁDr   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{}]+r9   N)r%   r&   r'   r(   r)   r*   r+   r>   r   ZEscaper   r	   r@   ZPreprocr
   rA   r   rB   r#   r#   r#   r$   r   š   s    
ñÿr   )r(   r;   Zpygments.lexerr   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