
    MhJ                         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 g dZ ej        d          Z G d de          Z G d	 d
e          Z G d de          ZdS )z
    pygments.lexers.r
    ~~~~~~~~~~~~~~~~~

    Lexers for the R/S languages.

    :copyright: Copyright 2006-2025 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                   6    e Zd ZdZdZddgZdgZdZdZdZ	d	 Z
d
S )r   z@
    For R console transcripts or R CMD BATCH output files.
    RConsolerconsoleroutz*.Routhttps://www.r-project.org z"rconsole/r-console-transcript.Routc           	   #   x  K   t          di | j        }d}g }t                              |          D ]}|                                }|                    d          s|                    d          rH|                    t          |          dt          j	        |d d         fgf           ||dd          z  }|r-t          ||                    |                    E d {V  d}g }|                                t          j        |fV  |r+t          ||                    |                    E d {V  d S d S )Nr   >+r       )r   optionsline_refinditergroup
startswithappendlenr   Promptr   get_tokens_unprocessedstartOutput)selftextslexercurrent_code_block
insertionsmatchlines          Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pygments/lexers/r.pyr'   z$RConsoleLexer.get_tokens_unprocessed#   s     ''$,''
%%d++ 	: 	:E;;==Ds## :ts';'; : !!3'9#:#:%&RaR$A#B#D E E E"d122h."" & $,"F$A$ABT$U$U W  W W W W W W W W *,&!#JkkmmW^T99999
  	O$F99:LMMO O O O O O O O O O O	O 	O    N)__name__
__module____qualname____doc__namealiases	filenamesurlversion_added_exampler'   r   r2   r1   r   r      sY          D6"G
I
%CM3H O  O  O  O  Or2   r   c                      e Zd ZdZdZg dZg dZg dZdZdZ	dZ
d	ej        fge
efgd
e
 dej        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           ed           g ed!          d"efd#efgd$ed%fgd&ed%fgd'Zd( Zd)S )*r   z+
    For S, S-plus, and R source code.
    S)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-profiler   z0.10z;`[^`\\]*(?:\\.[^`\\]*)*`|(?:[a-zA-Z]|\.[A-Za-z_.])[\w.]*|\.z#.*$(z
)\s*(?=\()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keywordsfunction_name
valid_namenumberspunctuation	operators
statementsz\{|\}.z([^\'\\]|\\.)*\'z#popz([^"\\]|\\.)*")rC   rI   rH   rK   rG   rL   rF   rJ   rM   rootrD   rE   c                 4    t          j        d|           rdS d S )Nz[a-z0-9_\])\s]<-(?!-)g)\(?)research)r+   s    r1   analyse_textzSLexer.analyse_text   s&    9-t44 	4	 	r2   N)r3   r4   r5   r6   r7   r8   r9   	mimetypesr:   r;   rI   r   Singler   Functionr   r
   Reservedr	   ConstantBuiltinPseudor   Hexr   r   r   r   tokensrS   r   r2   r1   r   r   F   s         D!!!GEEEIE E EI
%CMOJ gn%
 
 )*((($-8
 *;7

 =hG4h?

  ,-
 4VZ@K	
 GJZ FO,FO,G%&&GJGO$$GL!!GIGM""GK  
  GL!!{#4L
 !&&1
 /
EE EFN    r2   r   c            
           e Zd ZdZdZdgZdgZdgZdZd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   aR  
    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>`_.
    Rdrdz*.Rdztext/x-r-docz1http://cran.r-project.org/doc/manuals/R-exts.htmlz1.6rO   z	\\[\\{}%]z%.*$z\\(?:cr|l?dots|R|tab)\bz\\[a-zA-Z]+\bz^\s*#(?:ifn?def|endif).*\bz[{}]z[^\\%\n{}]+rN   N)r3   r4   r5   r6   r7   r8   r9   rT   r:   r;   r   Escaper   r
   rX   Preprocr   rY   r   r\   r   r2   r1   r   r      s          DfGI I
=CM
 	6=)g')9:w'*GO<dl#T"4L
FFFr2   r   )r6   rQ   pygments.lexerr   r   r   r   pygments.tokenr   r   r	   r
   r   r   r   r   r   r   __all__compiler    r   r   r   r   r2   r1   <module>rf      sp    
			 D D D D D D D D D D D D- - - - - - - - - - - - - - - - - - - - - - - - 1
0
0 2:g,O ,O ,O ,O ,OE ,O ,O ,O^W W W W WZ W W Wt$ $ $ $ $j $ $ $ $ $r2   