ó
xiù\c           @   sÞ   d  Z  d d l Z d d l m Z 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 d d d g Z e j d ƒ Z d e f d	 „  ƒ  YZ d e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d S(   sÄ   
    pygments.lexers.r
    ~~~~~~~~~~~~~~~~~

    Lexers for the R/S languages.

    :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iÿÿÿÿN(   t   Lexert
   RegexLexert   includet   do_insertionst   bygroups(	   t   Textt   Commentt   Operatort   Keywordt   Namet   Stringt   Numbert   Punctuationt   Generict   RConsoleLexert   SLexert   RdLexers   .*?
c           B   s2   e  Z d  Z d Z d d g Z d g Z d „  Z RS(   s@   
    For R console transcripts or R CMD BATCH output files.
    t   RConsolet   rconsolet   routs   *.Routc         c   s%  t  |  j   } d } g  } xÒ t j | ƒ D]Á } | j ƒ  } | j d ƒ s[ | j d ƒ r˜ | j t | ƒ d t j	 | d  f g f ƒ | | d 7} q+ | rÕ x% t
 | | j | ƒ ƒ D] } | Vq· Wd } g  } n  | j ƒ  t j | f Vq+ W| r!x( t
 | | j | ƒ ƒ D] } | VqWn  d  S(   Nt    t   >t   +i    i   (   R   t   optionst   line_ret   finditert   groupt
   startswitht   appendt   lenR   t   PromptR   t   get_tokens_unprocessedt   startt   Output(   t   selft   textt   slexert   current_code_blockt
   insertionst   matcht   linet   item(    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyR   !   s(    		(   t   __name__t
   __module__t   __doc__t   namet   aliasest	   filenamesR   (    (    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyR      s
   	c           B   sÄ  e  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 i d e j	 f g d 6e e
 f g d 6d e f g d 6d e j f g d 6d e f d e f g d 6d e j f d e
 j j f g d 6d e j f d  e f g d! 6e 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' 6d( e e
 j f e d' ƒ d) e f d* e f g d+ 6d, e d- f g d$ 6d. e d- f g d& 6Z d/ „  Z RS(0   sG   
    For S, S-plus, and R source code.

    .. versionadded:: 0.10
    t   St   splust   st   rs   *.Ss   *.Rs	   .Rhistorys	   .Rprofiles	   .Renvirons   text/S-pluss   text/Ss   text/x-r-sources   text/x-rs   text/x-Rs   text/x-r-historys   text/x-r-profiles?   (?:`[^`\\]*(?:\\.[^`\\]*)*`)|(?:(?:[a-zA-z]|[_.][^0-9])[\w_.]*)s   #.*$t   commentst
   valid_names   \[{1,2}|\]{1,2}|\(|\)|;|,t   punctuationsH   (if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])t   keywordss(   <<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?s$   \*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}t	   operatorssm   (NULL|NA(_(integer|real|complex|character)_)?|letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))(?![\w.])s   (T|F)\bt   builtin_symbolss#   0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?s;   [+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?t   numberss   \s+s   \'t   string_squotes   \"t   string_dquotet
   statementss   (%s)\s*(?=\()s   \{|\}t   .t   roots   ([^\'\\]|\\.)*\'s   #pops   ([^"\\]|\\.)*"c         C   s   t  j d |  ƒ r d Sd  S(   Ns   [a-z0-9_\])\s]<-(?!-)g)\Âõ(¼?(   t   ret   search(   R#   (    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyt   analyse_text˜   s    (   R*   R+   R,   R-   R.   R/   t	   mimetypesR5   R   t   SingleR	   R   R   t   ReservedR   t   Constantt   Builtint   PseudoR   t   HexR   R   R
   t   Functiont   tokensRB   (    (    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyR   F   sL   											c        
   B   s   e  Z d  Z d Z d g Z d g Z d g Z i 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 d 6Z RS(   sm  
    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
    t   Rdt   rds   *.Rds   text/x-r-docs	   \\[\\{}%]s   %.*$s   \\(?:cr|l?dots|R|tab)\bs   \\[a-zA-Z]+\bs   ^\s*#(?:ifn?def|endif).*\bs   [{}]s   [^\\%\n{}]+R>   R?   (   R*   R+   R,   R-   R.   R/   RC   R
   t   EscapeR   R   RF   t   PreprocR	   RG   R   RK   (    (    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyR      s   
						(   R,   R@   t   pygments.lexerR    R   R   R   R   t   pygments.tokenR   R   R   R   R	   R
   R   R   R   t   __all__t   compileR   R   R   R   (    (    (    s0   lib/python2.7/site-packages/pygments/lexers/r.pyt   <module>
   s   (@.W