File: //usr/lib/python3/dist-packages/pygments/lexers/__pycache__/r.cpython-38.pyc
U
G�
\� � @ s� d Z ddlZddlmZmZmZmZmZ ddlm Z m
Z
mZmZm
Z
mZmZmZmZ dddgZe�d�ZG d d� de�ZG d
d� de�ZG dd� de�ZdS )z�
pygments.lexers.r
~~~~~~~~~~~~~~~~~
Lexers for the R/S languages.
:copyright: Copyright 2006-2017 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 Zd ZdZdZddgZdgZdd� ZdS ) r z@
For R console transcripts or R CMD BATCH output files.
ZRConsoleZrconsoleZroutz*.Routc c s� t f | j�}d}g }t�|�D ]�}|�� }|�d�s>|�d�rt|�t|�dtj |d d� fgf� ||dd � 7 }q|r�t
||�|��D ]
}|V q�d}g }|�� tj
|fV q|r�t
||�|��D ]
}|V q�d S )N� �>�+r � )r Zoptions�line_re�finditer�group�
startswith�append�lenr ZPromptr �get_tokens_unprocessed�startZOutput)�self�textZslexerZcurrent_code_blockZ
insertions�match�line�item� r$ �3/usr/lib/python3/dist-packages/pygments/lexers/r.pyr ! s2
� � �z$RConsoleLexer.get_tokens_unprocessedN)�__name__�
__module__�__qualname__�__doc__�name�aliases� filenamesr r$ r$ r$ r% r s
c @ s e Zd ZdZdZdddgZdddd d
gZddd
ddddgZdZde j
fgeefgdefgde
jfgdefdefgde
jfdejjfgdejfdefged�defdedfd ed!fed"�ed#�ed$�ed%�ed&�ed'�g
d(e ejfed)�d*efd+efgd,ed-fgd.ed-fgd/�Zd0d1� Zd2S )3r zG
For S, S-plus, and R source code.
.. versionadded:: 0.10
�SZsplus�s�rz*.Sz*.Rz .Rhistoryz .Rprofilez .Renvironztext/S-plusztext/Sztext/x-r-sourceztext/x-rztext/x-Rztext/x-r-historyztext/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([^"\\]|\\.)*")r0 r4 r7 r6 r8 r3 r5 r9 �rootr1 r2 c C s t �d| �rdS d S )Nz[a-z0-9_\])\s]<-(?!-)g)\��(�?)�re�search)r r$ r$ r% �analyse_text� s zSLexer.analyse_textN)r&