o a@sdZddlZddlmZmZmZmZddlmZm Z m Z m Z m Z m Z mZmZmZgdZedZGdddeZGd d d eZGd d d eZdS) z pygments.lexers.r ~~~~~~~~~~~~~~~~~ Lexers for the R/S languages. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N)Lexer RegexLexerinclude do_insertions) TextCommentOperatorKeywordNameStringNumber PunctuationGeneric) RConsoleLexerSLexerRdLexerz.*? c@s*eZdZdZdZddgZdgZddZdS) rz@ For R console transcripts or R CMD BATCH output files. RConsolerconsoleroutz*.Routc cstdi|j}d}g}t|D]E}|}|ds"|dr=|t|dtj |ddfgf||dd7}q|rNt || |EdHd}g}| tj |fVq|rgt || |EdHdSdS)N>+r)roptionsline_refinditergroup startswithappendlenrPromptrget_tokens_unprocessedstartOutput)selftextslexercurrent_code_block insertionsmatchlinerr3/usr/lib/python3/dist-packages/pygments/lexers/r.pyr" s.    z$RConsoleLexer.get_tokens_unprocessedN)__name__ __module__ __qualname____doc__namealiases filenamesr"rrrr,rs  rc@s eZdZdZdZgdZgdZgdZdZde j fgee fgde fgd e jfgd efd efgd e jfd e jjfgdejfdefgeddefdedfdedfededededededg dee jfedde fdefgd ed!fgd"ed!fgd# Zd$d%Zd&S)'rzG For S, S-plus, and R source code. .. versionadded:: 0.10 S)splussr)z*.Sz*.Rz .Rhistoryz .Rprofilez .Renviron)z text/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_dquotebuiltin_symbols valid_namenumberskeywords punctuation operatorsz (%s)\s*(?=\() statementsz\{|\}.z([^\'\\]|\\.)*\'z#popz([^"\\]|\\.)*") r8r<r?r>r@r;r=rArootr9r:cCstd|rdSdS)Nz[a-z0-9_\])\s]<-(?!-)g)\(?)research)r&rrr, analyse_texts zSLexer.analyse_textN)r-r.r/r0r1r2r3 mimetypesr<rSingler r r ReservedrConstantBuiltinPseudor Hexrrr FunctiontokensrFrrrr,rCsh    Drc @sfeZdZdZdZdgZdgZdgZddej fde fd e j fd e fd e 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 `_ and `Parsing Rd files `_. .. versionadded:: 1.6 Rdrdz*.Rdz text/x-r-docrCz \\[\\{}%]z%.*$z\\(?:cr|l?dots|R|tab)\bz \\[a-zA-Z]+\bz^\s*#(?:ifn?def|endif).*\bz[{}]z [^\\%\n{}]+rBN)r-r.r/r0r1r2r3rGr Escaperr rJPreprocr rKrrOrrrr,rs" r)r0rDpygments.lexerrrrrpygments.tokenrrrr r r r r r__all__compilerrrrrrrr,s , ,W