U
    luf)                     @   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 dddg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-2023 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                   @   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 }t|D ]}| }|ds>|drt|t|dtj	|d d fgf ||dd  7 }q|rt
|||E d H  d}g }| tj|fV  q|rt
|||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$   5/tmp/pip-unpacked-wheel-7eq1ciah/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]|\.[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([^"\\]|\\.)*")r0   r4   r7   r6   r8   r3   r5   r9   rootr1   r2   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,   	mimetypesr4   r   Singler
   r   r	   ZReservedr   ConstantBuiltinZPseudor   ZHexr   r   r   ZFunctionr   tokensr>   r$   r$   r$   r%   r   C   sn   
  
	Dc                
   @   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	   rA   ZPreprocr
   rB   r   rC   r$   r$   r$   r%   r      s    
)r)   r<   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

,W