
    k"g:                     X   d Z ddlZddlZddlZddlmZmZ ddlm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 ddlmZ g dZ ej2                  d	      Zg d
Z ed       Z G d de      Z G d de      Z  G d de       Z! G d de"      Z# G d d      Z$ e$       Z% G d de&      Z' G d d      Z(d Z) G d d      Z* e*       Z+d Z, G d d       Z- G d! d"e      Z. G d# d$e      Z/ G d% d&e e/      Z0 G d' d(      Z1 G d) d*e0      Z2d+ Z3 G d, d-e/      Z4 G d. d/e0e4      Z5y)0z
    pygments.lexer
    ~~~~~~~~~~~~~~

    Base lexer classes.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)apply_filtersFilter)get_filter_by_name)ErrorTextOther
Whitespace
_TokenType)get_bool_optget_int_optget_list_optmake_analysatorFutureguess_decode)	regex_opt)Lexer
RegexLexerExtendedRegexLexerDelegatingLexerLexerContextincludeinheritbygroupsusingthisdefaultwordsline_rez.*?
))s   ﻿utf-8)s     zutf-32)s     zutf-32be)s   zutf-16)s   zutf-16bec                      y)N         )xs    S/var/www/html/djangosite/lib/python3.12/site-packages/pip/_vendor/pygments/lexer.py<lambda>r%   "           c                       e Zd ZdZd Zy)	LexerMetaz
    This metaclass automagically converts ``analyse_text`` methods into
    static methods which always return float values.
    c                 \    d|v rt        |d         |d<   t        j                  | |||      S )Nanalyse_text)r   type__new__)mcsnamebasesds       r$   r-   zLexerMeta.__new__+   s3    Q /.0A BAn||Cua00r'   N)__name__
__module____qualname____doc__r-   r"   r'   r$   r)   r)   %   s    
1r'   r)   c                   R    e Zd ZdZdZg Zg Zg Zg ZdZ	dZ
d Zd Zd Zd Zd
dZd	 Zy)r   au  
    Lexer for a specific language.

    See also :doc:`lexerdevelopment`, a high-level guide to writing
    lexers.

    Lexer classes have attributes used for choosing the most appropriate
    lexer based on various criteria.

    .. autoattribute:: name
       :no-value:
    .. autoattribute:: aliases
       :no-value:
    .. autoattribute:: filenames
       :no-value:
    .. autoattribute:: alias_filenames
    .. autoattribute:: mimetypes
       :no-value:
    .. autoattribute:: priority

    Lexers included in Pygments should have an additional attribute:

    .. autoattribute:: url
       :no-value:

    You can pass options to the constructor. The basic options recognized
    by all lexers and processed by the base `Lexer` class are:

    ``stripnl``
        Strip leading and trailing newlines from the input (default: True).
    ``stripall``
        Strip all leading and trailing whitespace from the input
        (default: False).
    ``ensurenl``
        Make sure that the input ends with a newline (default: True).  This
        is required for some lexers that consume input linewise.

        .. versionadded:: 1.3

    ``tabsize``
        If given and greater than 0, expand tabs in the input (default: 0).
    ``encoding``
        If given, must be an encoding name. This encoding will be used to
        convert the input string to Unicode, if it is not already a Unicode
        string (default: ``'guess'``, which uses a simple UTF-8 / Locale /
        Latin1 detection.  Can also be ``'chardet'`` to use the chardet
        library, if it is installed.
    ``inencoding``
        Overrides the ``encoding`` if given.
    Nr   c                 l   || _         t        |dd      | _        t        |dd      | _        t        |dd      | _        t        |dd      | _        |j                  dd	      | _        |j                  d
      xs | j                  | _        g | _	        t        |dd      D ]  }| j                  |        y)a  
        This constructor takes arbitrary options as keyword arguments.
        Every subclass must first process its own options and then call
        the `Lexer` constructor, since it processes the basic
        options like `stripnl`.

        An example looks like this:

        .. sourcecode:: python

           def __init__(self, **options):
               self.compress = options.get('compress', '')
               Lexer.__init__(self, **options)

        As these options must all be specifiable as strings (due to the
        command line usage), there are various utility functions
        available to help with that, see `Utilities`_.
        stripnlTstripallFensurenltabsizer   encodingguess
inencodingfiltersr"   N)optionsr   r8   r9   r:   r   r;   getr<   r?   r   
add_filter)selfr@   filter_s      r$   __init__zLexer.__init__   s    & #GY=$Wj%@$Wj$?"7Iq9J8L1BT]]#GY; 	%GOOG$	%r'   c                     | j                   r'd| j                  j                  d| j                   dS d| j                  j                  z  S )Nz<pygments.lexers.z with >z<pygments.lexers.%s>)r@   	__class__r2   rC   s    r$   __repr__zLexer.__repr__   s@    <<59^^5L5L59\\C C *DNN,C,CCCr'   c                 r    t        |t              st        |fi |}| j                  j	                  |       y)z8
        Add a new stream filter to this lexer.
        N)
isinstancer   r   r?   append)rC   rD   r@   s      r$   rB   zLexer.add_filter   s/     '6*(<G<GG$r'   c                      y)a  
        A static method which is called for lexer guessing.

        It should analyse the text and return a float in the range
        from ``0.0`` to ``1.0``.  If it returns ``0.0``, the lexer
        will not be selected as the most probable one, if it returns
        ``1.0``, it will be selected immediately.  This is used by
        `guess_lexer`.

        The `LexerMeta` metaclass automatically wraps this function so
        that it works like a static method (no ``self`` or ``cls``
        parameter) and the return value is automatically converted to
        `float`. If the return value is an object that is boolean `False`
        it's the same as if the return values was ``0.0``.
        Nr"   )texts    r$   r+   zLexer.analyse_text   r&   r'   c                     t        t              s j                  dk(  rt              \  }n j                  dk(  r	 ddlm} d}t        D ]6  \  }}j                  |      st        |      d j                  |d      } n |9|j                  dd       }	j                  |	j                  d	      xs d
d      }|nZj                   j                        j                  d      r.t        d      d nj                  d      rt        d      d j                  dd      j                  dd       j                  rj                         n j                   rj                  d       j"                  dkD  rj%                   j"                         j&                  rj)                  d      sdz   fd}
 |
       }|st+        | j,                         }|S # t        $ r}t        d      |d}~ww xY w)ae  
        This method is the basic interface of a lexer. It is called by
        the `highlight()` function. It must process the text and return an
        iterable of ``(tokentype, value)`` pairs from `text`.

        Normally, you don't need to override this method. The default
        implementation processes the options recognized by all lexers
        (`stripnl`, `stripall` and so on), and then yields all tokens
        from `get_tokens_unprocessed()`, with the ``index`` dropped.

        If `unfiltered` is set to `True`, the filtering mechanism is
        bypassed even if filters are defined.
        r=   chardetr   )rQ   zkTo enable chardet encoding guessing, please install the chardet library from http://chardet.feedparser.org/Nreplacei   r<   r   u   ﻿z

c               3   N   K   j                        D ]  \  } }}||f  y wN)get_tokens_unprocessed)_tvrC   rO   s      r$   streamerz"Lexer.get_tokens.<locals>.streamer   s0     66t< 1ad
s   "%)rL   strr<   r   pip._vendorrQ   ImportError_encoding_map
startswithlendecodedetectrA   rR   r9   stripr8   r;   
expandtabsr:   endswithr   r?   )rC   rO   
unfilteredrX   rQ   edecodedbomr<   encr[   streams   ``          r$   
get_tokenszLexer.get_tokens   s    $$}}'&t,a)+T3 %2 MCs+"&s3xy/"8"89"M
 ?!..et5C"kk#''**=*H*35G{{4==1??8,H/Dx(CMN+ ||FD)||D$'==::<D\\::d#D<<!??4<<0D==t!4DLD	 "64<<>FU # T% 'L MRSTTs   G2 2	H;HHc                     t         )aS  
        This method should process the text and return an iterable of
        ``(index, tokentype, value)`` tuples where ``index`` is the starting
        position of the token within the input text.

        It must be overridden by subclasses. It is recommended to
        implement it as a generator to maximize effectiveness.
        )NotImplementedError)rC   rO   s     r$   rW   zLexer.get_tokens_unprocessed  s
     "!r'   )F)r2   r3   r4   r5   r/   aliases	filenamesalias_filenames	mimetypespriorityurlrE   rJ   rB   r+   rm   rW   r"   r'   r$   r   r   1   sY    1h D G
 I O I H C%<D%">@	"r'   r   )	metaclassc                        e Zd ZdZefdZd Zy)r   a   
    This lexer takes two lexer as arguments. A root lexer and
    a language lexer. First everything is scanned using the language
    lexer, afterwards all ``Other`` tokens are lexed using the root
    lexer.

    The lexers from the ``template`` lexer package use this base lexer.
    c                 r     |di || _          |di || _        || _        t        j                  | fi | y Nr"   )
root_lexerlanguage_lexerneedler   rE   )rC   _root_lexer_language_lexer_needler@   s        r$   rE   zDelegatingLexer.__init__  s9    %00-88t'w'r'   c                 l   d}g }g }| j                   j                  |      D ]N  \  }}}|| j                  u r&|r|j                  t	        |      |f       g }||z  };|j                  |||f       P |r|j                  t	        |      |f       t        || j                  j                  |            S )N )r{   rW   r|   rM   ra   do_insertionsrz   )rC   rO   buffered
insertions
lng_bufferirY   rZ   s           r$   rW   z&DelegatingLexer.get_tokens_unprocessed  s    

**AA$G 	-GAq!DKK%%s8}j&AB!#JA!!1a),	- s8}j9:Z!__CCHMO 	Or'   N)r2   r3   r4   r5   r   rE   rW   r"   r'   r$   r   r     s     >C (Or'   r   c                       e Zd ZdZy)r   zI
    Indicates that a state should include rules from another state.
    Nr2   r3   r4   r5   r"   r'   r$   r   r   4  s     	r'   r   c                       e Zd ZdZd Zy)_inheritzC
    Indicates the a state should inherit from its superclass.
    c                      y)Nr   r"   rI   s    r$   rJ   z_inherit.__repr__?  s    r'   N)r2   r3   r4   r5   rJ   r"   r'   r$   r   r   ;  s    r'   r   c                       e Zd ZdZd Zd Zy)combinedz:
    Indicates a state combined from multiple states.
    c                 .    t         j                  | |      S rV   )tupler-   )clsargss     r$   r-   zcombined.__new__J  s    }}S$''r'   c                      y rV   r"   )rC   r   s     r$   rE   zcombined.__init__M  s    r'   N)r2   r3   r4   r5   r-   rE   r"   r'   r$   r   r   E  s    (r'   r   c                   :    e Zd ZdZd Zd	dZd	dZd	dZd Zd Z	y)
_PseudoMatchz:
    A pseudo match object constructed from a string.
    c                      || _         || _        y rV   )_text_start)rC   startrO   s      r$   rE   z_PseudoMatch.__init__W  s    
r'   Nc                     | j                   S rV   )r   rC   args     r$   r   z_PseudoMatch.start[  s    {{r'   c                 F    | j                   t        | j                        z   S rV   )r   ra   r   r   s     r$   endz_PseudoMatch.end^  s    {{S_,,r'   c                 4    |rt        d      | j                  S )NzNo such group)
IndexErrorr   r   s     r$   groupz_PseudoMatch.groupa  s    _--zzr'   c                     | j                   fS rV   )r   rI   s    r$   groupsz_PseudoMatch.groupsf  s    

}r'   c                     i S rV   r"   rI   s    r$   	groupdictz_PseudoMatch.groupdicti  s    	r'   rV   )
r2   r3   r4   r5   rE   r   r   r   r   r   r"   r'   r$   r   r   R  s%    -
r'   r   c                       d fd	}|S )zL
    Callback that yields multiple actions for each group in the match.
    c           
   3     K   t              D ]  \  }}|	t        |      t        u r1|j                  |dz         }|s1|j	                  |dz         ||f K|j                  |dz         }|b|r|j	                  |dz         |_         || t        |j	                  |dz         |      |      D ]	  }|s|   |r|j                         |_        y y w)N   )	enumerater,   r
   r   r   posr   r   )lexermatchctxr   actiondataitemr   s          r$   callbackzbygroups.<locals>.callbackq  s     "4 	'IAv~f+{{1q5)++a!e,fd::{{1q5)#"'++a!e"4 &u'3EKKA4F'Ms!T '"&J'	'  iikCG s   <C 0C1AC8!CrV   r"   )r   r   s   ` r$   r   r   m  s    "& Or'   c                       e Zd ZdZy)_ThiszX
    Special singleton used for indicating the caller class.
    Used by ``using``.
    Nr   r"   r'   r$   r   r     s    r'   r   c                      i dv r4j                  d      }t        |t        t        f      r|d<   nd|fd<    t        u r	dfd	}|S d fd	}|S )a  
    Callback that processes the match with a different lexer.

    The keyword arguments are forwarded to the lexer, except `state` which
    is handled separately.

    `state` specifies the state that the new lexer will start in, and can
    be an enumerable such as ('root', 'inline', 'string') or a simple
    string which is assumed to be on top of the root state.

    Note: For that to work, `_other` must not be an `ExtendedRegexLexer`.
    statestackrootc              3   *  K   	r.	j                  | j                          | j                  di 	}n| }|j                         } |j                  |j                         fi D ]  \  }}}||z   ||f  |r|j                         |_        y y wry   )updater@   rH   r   rW   r   r   r   )
r   r   r   lxsr   rY   rZ   	gt_kwargskwargss
           r$   r   zusing.<locals>.callback  s      emm,$U__.v.A4244U[[]PiP "1a!eQk!"))+ s   BBc              3     K   
j                  | j                          di 
}|j                         } |j                  |j	                         fi 	D ]  \  }}}||z   ||f  |r|j                         |_        y y wry   )r   r@   r   rW   r   r   r   )r   r   r   r   r   r   rY   rZ   _otherr   r   s           r$   r   zusing.<locals>.callback  s     MM%--(!&!BA4244U[[]PiP "1a!eQk!"))+ s   BBrV   )poprL   listr   r   )r   r   r   r   r   s   ``  @r$   r   r     se     I&JJwa$'!"Ig"(!Ig~	&2 O		& Or'   c                       e Zd ZdZd Zy)r   z
    Indicates a state or state action (e.g. #pop) to apply.
    For example default('#pop') is equivalent to ('', Token, '#pop')
    Note that state tuples may be used as well.

    .. versionadded:: 2.0
    c                     || _         y rV   )r   )rC   r   s     r$   rE   zdefault.__init__  s	    
r'   N)r2   r3   r4   r5   rE   r"   r'   r$   r   r     s    r'   r   c                       e Zd ZdZddZd Zy)r   z
    Indicates a list of literal words that is transformed into an optimized
    regex that matches any of the words.

    .. versionadded:: 2.0
    c                 .    || _         || _        || _        y rV   )r   prefixsuffix)rC   r   r   r   s       r$   rE   zwords.__init__  s    
r'   c                 Z    t        | j                  | j                  | j                        S )Nr   r   )r   r   r   r   rI   s    r$   rA   z	words.get  s    DKKLLr'   N)r   r   )r2   r3   r4   r5   rE   rA   r"   r'   r$   r   r     s    
Mr'   r   c                   <    e Zd ZdZd Zd Zd Zd Zd
dZd Z	d	 Z
y)RegexLexerMetazw
    Metaclass for RegexLexer, creates the self._tokens attribute from
    self.tokens on the first instantiation.
    c                     t        |t              r|j                         }t        j                  ||      j
                  S )zBPreprocess the regular expression component of a token definition.)rL   r   rA   recompiler   )r   regexrflagsr   s       r$   _process_regexzRegexLexerMeta._process_regex  s.    eV$IIKEzz%(...r'   c                 R    t        |      t        u st        |      s
J d|       |S )z5Preprocess the token component of a token definition.z0token type must be simple type or callable, not )r,   r
   callable)r   tokens     r$   _process_tokenzRegexLexerMeta._process_token  s.    E{j(HUO 	LDIK	L;r'   c                    t        |t              r5|dk(  ry||v r|fS |dk(  r|S |dd dk(  rt        |dd        S J d|z         t        |t              rfd| j                  z  }| xj                  d	z  c_        g }|D ]3  }||k7  s
J d
|z         |j                  | j                  |||             5 |||<   |fS t        |t              r|D ]  }||v r|dv rJ d|z           |S J d|z         )z=Preprocess the state transition action of a token definition.#pop#pushN   z#pop:zunknown new state %rz_tmp_%dr   zcircular state ref %r)r   r   zunknown new state zunknown new state def %r)rL   r\   intr   _tmpnameextend_process_stater   )r   	new_stateunprocessed	processed	tmp_stateitokensistates          r$   _process_new_statez!RegexLexerMeta._process_new_state  sK   i%F"k)!|#g%  2A')IabM***@4y@@u	8,!CLL0ILLALG# F*L,Cf,LL*s11+2;V E FF $+Ii <	5)# 2+-"332(612 42 @4y@@5r'   c                    t        |      t        u s
J d|z         |d   dk7  s
J d|z         ||v r||   S g x}||<   | j                  }||   D ]?  }t        |t              r;||k7  s
J d|z         |j                  | j                  ||t        |                   Ot        |t              r`t        |t              rO| j                  |j                  ||      }|j                  t        j                  d      j                  d|f       t        |      t        u s
J d|z         	 | j!                  |d   ||      }| j'                  |d         }
t)        |      dk(  rd}n| j                  |d   ||      }|j                  ||
|f       B |S # t"        $ r }	t%        d	|d   d
|d| d|	      |	d}	~	ww xY w)z%Preprocess a single state definition.zwrong state name %rr   #zinvalid state name %rzcircular state reference %rr   Nzwrong rule def %rzuncompilable regex z
 in state z of z: r      )r,   r\   flagsrL   r   r   r   r   r   r   r   rM   r   r   r   r   r   	Exception
ValueErrorr   ra   )r   r   r   r   tokensr   tdefr   rexerrr   s              r$   r   zRegexLexerMeta._process_state  s   E{c!@#85#@@!Qx3? 7% ??IU##$&&5!& !	3D$(u}K&Ce&KK}c00i14T< =$) $(224::{IV	rzz"~33T9EF:&B(;d(BB&F((a&%@
 &&tAw/E4yA~ 	22473>	K	 MM3y12C!	3D   F "&q'5#s"< =BEFFs   *F	F=F88F=Nc                     i x}| j                   |<   |xs | j                  |   }t        |      D ]  }| j                  |||        |S )z-Preprocess a dictionary of token definitions.)_all_tokensr   r   r   )r   r/   	tokendefsr   r   s        r$   process_tokendefzRegexLexerMeta.process_tokendef?  sS    ,..	COOD)1D!1	)_ 	<Ey)U;	<r'   c                    i }i }| j                   D ]  }|j                  j                  di       }|j                         D ]t  \  }}|j                  |      }|!|||<   	 |j	                  t
              }|||<   :|j                  |d      }|O||||dz    	 |j	                  t
              }	||	z   ||<   v  |S # t        $ r Y w xY w# t        $ r Y w xY w)a  
        Merge tokens from superclasses in MRO order, returning a single tokendef
        dictionary.

        Any state that is not defined by a subclass will be inherited
        automatically.  States that *are* defined by subclasses will, by
        default, override that state in the superclass.  If a subclass wishes to
        inherit definitions from a superclass, it can use the special value
        "inherit", which will cause the superclass' state definition to be
        included at that point in the state.
        r   Nr   )__mro____dict__rA   itemsindexr   r   r   )
r   r   inheritablectoksr   r   curitemsinherit_ndxnew_inh_ndxs
             r$   get_tokendefszRegexLexerMeta.get_tokendefsG  s     	CA::>>(B/D $

 Cu!::e,#
 %*F5M!&+kk'&: *5K&)ooeT:& 7<[]3C #(++g"6K *5{)BK&9C	CB ) & ! ! " s$   B;C
;	CC
	CCc                     d| j                   vrLi | _        d| _        t        | d      r| j                  rn%| j                  d| j                               | _        t        j                  | g|i |S )z:Instantiate cls after preprocessing its token definitions._tokensr   token_variantsr   )
r   r   r   hasattrr  r   r   r   r,   __call__)r   r   kwdss      r$   r  zRegexLexerMeta.__call__x  sh    CLL( COCLs,-#2D2D!222s7H7H7JK}}S040400r'   rV   )r2   r3   r4   r5   r   r   r   r   r   r   r  r"   r'   r$   r   r     s.    
/!AF*X/b1r'   r   c                   4    e Zd ZdZej
                  Zi ZddZy)r   z
    Base for simple stateful regular expression-based lexers.
    Simplifies the lexing process so that you need only
    provide a list of states and regular expressions.
    c              #   :  K   d}| j                   }t        |      }||d      }	 |D ]&  \  }}}	 |||      }
|
s|8t        |      t        u r|||
j	                         f n || |
      E d{    |
j                         }|	t        |	t              rX|	D ]R  }|dk(  r t        |      dkD  s|j                          (|dk(  r|j                  |d          B|j                  |       T nWt        |	t              r#t        |	      t        |      k\  r|dd= n*||	d= n$|	dk(  r|j                  |d          n
J d|	z         ||d      } n7 	 ||   dk(  rd	g}|d	   }|t        df |dz  }P|t        ||   f |dz  }d7 # t        $ r Y yw xY ww)
z~
        Split ``text`` into (tokentype, text) pairs.

        ``stack`` is the initial stack (default: ``['root']``)
        r   r   r   Nr   r   wrong state def: %rrS   r   )r   r   r,   r
   r   r   rL   r   ra   r   rM   r   absr	   r   r   )rC   rO   r   r   r   
statestackstatetokensrexmatchr   r   mr   s               r$   rW   z!RegexLexer.get_tokens_unprocessed  s     LL	%[

2//: 0+&)T3')<:5"%vqwwy"88'-dA66%%'C ,%i7)2 =#(F?'*:':(2(8%*g%5$.$5$5jn$E$.$5$5e$<= (	37  #9~Z@$.qrN$.yz$:&'1&--jn=K*?)*KK5&/
2&?C0JCyD(&,X
&/&7!:t33q ud3i//1HC_  7P " sM   8F5F0F	1>F0B!F F 2F4F F	FFFFN)r   )	r2   r3   r4   r5   r   	MULTILINEr   r   rW   r"   r'   r$   r   r     s     LLE0 F;r'   r   c                       e Zd ZdZddZd Zy)r   z9
    A helper object that holds lexer position data.
    Nc                 `    || _         || _        |xs t        |      | _        |xs dg| _        y )Nr   )rO   r   ra   r   r   )rC   rO   r   r   r   s        r$   rE   zLexerContext.__init__  s.    	##d)&vh
r'   c                 V    d| j                   d| j                  d| j                  dS )NzLexerContext(z, ))rO   r   r   rI   s    r$   rJ   zLexerContext.__repr__  s    IItxx- 	-r'   NN)r2   r3   r4   r5   rE   rJ   r"   r'   r$   r   r     s    '-r'   r   c                       e Zd ZdZddZy)r   zE
    A RegexLexer that uses a context object to store its state.
    Nc              #     K   | j                   }|st        |d      }|d   }n |}||j                  d      }|j                  }	 |D ]  \  }}} |||j                  |j
                        }	|	s)|lt        |      t        u r5|j                  ||	j                         f |	j                         |_        n& || |	|      E d{    |s||j                  d      }|5t        |t              r|D ]  }
|
dk(  r4t        |j                        dkD  s!|j                  j                          <|
dk(  r)|j                  j                  |j                  d          j|j                  j                  |
        nt        |t              rAt        |      t        |j                        k\  r|j                  dd= nH|j                  |d= n8|dk(  r)|j                  j                  |j                  d          n
J d|z         ||j                  d      } n 	 |j                  |j
                  k\  ry||j                     d	k(  r9dg|_        |d   }|j                  t         d	f |xj                  dz  c_        ;|j                  t"        ||j                     f |xj                  dz  c_        s7 # t$        $ r Y yw xY ww)
z
        Split ``text`` into (tokentype, text) pairs.
        If ``context`` is given, use this lexer context instead.
        r   r   r   r   Nr   r   r  rS   )r   r   r   rO   r   r   r,   r
   r   rL   r   ra   r   rM   r   r  r   r   r   )rC   rO   contextr   r   r
  r  r   r   r  r   s              r$   rW   z)ExtendedRegexLexer.get_tokens_unprocessed  su    
 LL	tQ'C#F+KC#CIIbM2K88D/: 2+&)T377CGG4)<:5"%''61779"<<&'eegCG'-dAs';;;#,.7		".F ,%i7)2 <#(F?'*399~'9(+		%*g%5$'II$4$4SYYr]$C$'II$4$4U$;< (	37"9~SYY?$'IIabM$'IIij$9&'1II,,SYYr];K*?)*KK5&/		"&>G2Jww#'')CGG},%+H	&/&7!ggtT111 ''5$sww-77GGqLGc  <R " s^   A,K	/AK	J7AK	DK	J: 2K	3A	J: <K	>7J: 5K	:	KK	KK	r  )r2   r3   r4   r5   rW   r"   r'   r$   r   r     s    @r'   r   c              #     K   t        |       } 	 t        |       \  }}d}d}|D ]  \  }}}||}d}	|rx|t        |      z   |k\  rg||	||z
   }
|
r|||
f |t        |
      z  }|D ]  \  }}}|||f |t        |      z  } ||z
  }		 t        |       \  }}|r|t        |      z   |k\  rg|	t        |      k  s||||	d f |t        |      |	z
  z  } |r9|xs d}|D ]  \  }}}|||f |t        |      z  } 	 t        |       \  }}|r8yy# t        $ r |E d{  7   Y yw xY w# t        $ r d}Y w xY w# t        $ r d}Y yw xY ww)ag  
    Helper for lexers which must combine the results of several
    sublexers.

    ``insertions`` is a list of ``(index, itokens)`` pairs.
    Each ``itokens`` iterable should be inserted at position
    ``index`` into the token stream given by the ``tokens``
    argument.

    The result is a combined token stream.

    TODO: clean up the code here.
    NTr   F)iternextStopIterationra   )r   r   r   r   realposinsleftr   rY   rZ   olditmpvalit_indexit_tokenit_valueps                  r$   r   r   ?  s     j!Jj)w GG  %1a?G!c!f*-tEAI&Fq&((3v;&07 ),(Hx113x=() 19D!%j!1w !c!f*- #a&=1ah&&s1v}$G+%0 ,Q 	GAq!1a-s1vG		!*-NE7 E  4 !    	G	s   ED A*ED,E*E9AE?D= EED) D#!D)&E(D))E,D:7E9D::E=EE
EEc                       e Zd ZdZd Zy)ProfilingRegexLexerMetaz>Metaclass for ProfilingRegexLexer, collects regex timing info.c                      t        |t              r-t        |j                  |j                  |j                        n|t        j                  |      t        j                  f fd	}|S )Nr   c                     j                   d   j                  
	fddg      }t        j                         }j                  | ||      }t        j                         }|dxx   dz  cc<   |dxx   ||z
  z  cc<   |S )Nr   r   r!   r   )
_prof_data
setdefaulttimer   )rO   r   endposinfot0rest1r   compiledr   r   s          r$   
match_funcz:ProfilingRegexLexerMeta._process_regex.<locals>.match_func  sr    >>"%00%3xHDB..sF3CBGqLGGrBwGJr'   )	rL   r   r   r   r   r   r   sysmaxsize)r   r   r   r   r0  r/  r   s   `  ` @@r$   r   z&ProfilingRegexLexerMeta._process_regex  sZ    eU#EKK#(<<1C C::c6*), 	 	 r'   N)r2   r3   r4   r5   r   r"   r'   r$   r$  r$    s
    Hr'   r$  c                        e Zd ZdZg ZdZddZy)ProfilingRegexLexerzFDrop-in replacement for RegexLexer that does profiling of its regexes.   c              #   J   K    j                   j                  j                  i        t        j	                   ||      E d {     j                   j                  j                         }t        d |j                         D         fdd      }t        d |D              }t                t        d j                   j                  t        |      |fz         t        d       t        dd	z         t        d
       |D ]  }t        d|z          t        d       y 7 ݭw)Nc              3      K   | ]H  \  \  }}\  }}|t        |      j                  d       j                  dd      dd |d|z  d|z  |z  f J yw)zu'z\\\NA   i  )reprrd   rR   ).0r   rnrY   s        r$   	<genexpr>z=ProfilingRegexLexer.get_tokens_unprocessed.<locals>.<genexpr>  sa      @+FQFQ 47==/77EcrJ4!8TAX\3 @s   AAc                 "    | j                      S rV   )_prof_sort_index)r#   rC   s    r$   r%   z<ProfilingRegexLexer.get_tokens_unprocessed.<locals>.<lambda>  s    Ad&;&;$< r'   T)keyreversec              3   &   K   | ]	  }|d      yw)   Nr"   )r;  r#   s     r$   r>  z=ProfilingRegexLexer.get_tokens_unprocessed.<locals>.<genexpr>  s     +!+s   z2Profiling result for %s lexing %d chars in %.3f mszn==============================================================================================================z$%-20s %-64s ncalls  tottime  percall)r   r   zn--------------------------------------------------------------------------------------------------------------z%-20s %-65s %5d %8.4f %8.4f)rH   r'  rM   r   rW   r   sortedr   sumprintr2   ra   )rC   rO   r   rawdatar   	sum_totalr1   s   `      r$   rW   z*ProfilingRegexLexer.get_tokens_unprocessed  s     !!((,44T4GGG..++//1 @/6}}@ ="	$
 +d++	B~~&&D	9=> 	?i47IIJi 	5A/!34	5i# 	Hs   A D#D!CD#Nr  )r2   r3   r4   r5   r'  r@  rW   r"   r'   r$   r4  r4    s    PJr'   r4  )6r5   r   r1  r)  pip._vendor.pygments.filterr   r   pip._vendor.pygments.filtersr   pip._vendor.pygments.tokenr   r   r   r	   r
   pip._vendor.pygments.utilr   r   r   r   r   r   pip._vendor.pygments.regexoptr   __all__r   r   r_   staticmethod_default_analyser,   r)   r   r   r\   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$  r4  r"   r'   r$   <module>rR     sJ   
 
  = ; Q Q* * 3* "**W
,  . 	1 	1Y"i Y"xOe ON	c 	  *
u 
 64  w/d	 	MF M e1Y e1P^. ^B- - E EP=@n ,*0G r'   