3

V'íc)ã@sœdZddlZddlmZmZmZmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZdddgZejdƒZGd	d„deƒZGd
d„deƒZGdd„deƒZdS)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Ú
WhitespaceÚ
RConsoleLexerÚSLexerÚRdLexerz.*?
c@s*eZdZdZdZddgZdgZdd„ZdS)	rz@
    For R console transcripts or R CMD BATCH output files.
    ZRConsoleZrconsoleZroutz*.RoutccsÌtf|jŽ}d}g}x˜tj|ƒD]Š}|jƒ}|jdƒs@|jdƒrv|jt|ƒdtj	|dd…fgfƒ||dd…7}q |r˜t
||j|ƒƒEdHd}g}|jƒtj
|fVq W|rÈt
||j|ƒƒEdHdS)NÚú>ú+ré)rÚoptionsÚline_reÚfinditerÚgroupÚ
startswithÚappendÚlenrZPromptrÚget_tokens_unprocessedÚstartZOutput)ÚselfÚtextZslexerZcurrent_code_blockZ
insertionsÚmatchÚline©r$ú5/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/r.pyr s$
z$RConsoleLexer.get_tokens_unprocessedN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesrr$r$r$r%rs
c@seZdZdZdZdddgZdddd	d
gZddd
ddddgZdZde	j
fgeefgdefgde
jfgdefdefgde
jfdejjfgdejfdefgedƒdefdedfd ed!fed"ƒed#ƒed$ƒed%ƒed&ƒed'ƒg
d(eejfed)ƒd*efd+efgd,ed-fgd.ed-fgd/œZd0d1„Zd2S)3rzG
    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]|\.[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([^"\\]|\\.)*")r0r4r7r6r8r3r5r9Úrootr1r2cCstjd|ƒrdSdS)Nz[a-z0-9_\])\s]<-(?!-)g)\Âõ(¼?)ÚreÚsearch)r!r$r$r%Úanalyse_text•szSLexer.analyse_textN)r&r'r(r)r*r+r,Ú	mimetypesr4rÚSingler
r
r	ZReservedrÚConstantÚBuiltinZPseudorZHexrrrZFunctionrÚtokensr>r$r$r$r%rCsJ



c
@sfeZdZdZdZdgZdgZdgZddej	fde
fd	ejfd
efde
j
fdejfd
efdefgiZdS)ram
    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
    ZRdÚ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?rZEscaperr	rAZPreprocr
rBrrCr$r$r$r%ršs
)r)r<Zpygments.lexerrrrrZpygments.tokenrrrr	r
rrr
rrÚ__all__Úcompilerrrrr$r$r$r%Ú<module>	s0

,W