o
    Ñ­jR‰  ã                   @   sÎ  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 d	¡Zg d
¢Zedd„ ƒZG dd„ deƒZG dd„ ded�Z G dd„ de ƒZ!G dd„ de"ƒZ#G dd„ dƒZ$e$ƒ Z%G dd„ de&ƒZ'G dd„ dƒZ(dd„ Z)G dd„ dƒZ*e*ƒ Z+d d!„ Z,G d"d#„ d#ƒZ-G d$d%„ d%eƒZ.G d&d'„ d'eƒZ/G d(d)„ d)e e/d�Z0G d*d+„ d+ƒZ1G d,d-„ d-e0ƒZ2d.d/„ Z3G d0d1„ d1e/ƒZ4G d2d3„ d3e0e4d�Z5dS )4z·
    pygments.lexer
    ~~~~~~~~~~~~~~

    Base lexer classes.

    :copyright: Copyright 2006-present 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                 C   ó   dS )Nç        © ©Úxr!   r!   úK/var/www/html/CropPilot/venv/lib/python3.10/site-packages/pygments/lexer.pyÚ<lambda>"   ó    r%   c                   @   ó   e Zd ZdZdd„ ZdS )Ú	LexerMetaz‚
    This metaclass automagically converts ``analyse_text`` methods into
    static methods which always return float values.
    c                 C   s(   d|v rt |d ƒ|d< t | |||¡S )NÚanalyse_text)r   ÚtypeÚ__new__)ÚmcsÚnameÚbasesÚdr!   r!   r$   r+   +   s   zLexerMeta.__new__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r+   r!   r!   r!   r$   r(   %   s    r(   c                   @   sn   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d„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zddd„Zdd„ ZdS )r   a"  
    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 two additional attributes:

    .. autoattribute:: url
       :no-value:
    .. autoattribute:: version_added
       :no-value:

    Lexers included in Pygments may have additional attributes:

    .. autoattribute:: _example
       :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                 K   s„   || _ t|ddƒ| _t|ddƒ| _t|ddƒ| _t|ddƒ| _| dd	¡| _| d
¡p-| j| _g | _	t
|ddƒD ]}|  |¡ q8dS )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
   r4   r5   r6   r   r7   Úgetr8   r;   r   Ú
add_filter)Úselfr<   Úfilter_r!   r!   r$   Ú__init__‘   s   ÿzLexer.__init__c                 C   s.   | j rd| jj› d| j ›d�S d| jj› d�S )Nz<pygments.lexers.z with ú>)r<   Ú	__class__r0   ©r?   r!   r!   r$   Ú__repr__¯   s   zLexer.__repr__c                 K   s*   t |tƒst|fi |¤Ž}| j |¡ dS )z8
        Add a new stream filter to this lexer.
        N)Ú
isinstancer   r   r;   Úappend)r?   r@   r<   r!   r!   r$   r>   µ   s   
zLexer.add_filterc                 C   r   )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!   )Útextr!   r!   r$   r)   ½   r&   zLexer.analyse_textc           	   
   C   sv  t |tƒsy| jdkrt|ƒ\}}nu| jdkrezddl}W n ty- } ztdƒ|‚d}~ww d}tD ]\}}| |¡rI|t|ƒd…  	|d¡} nq2|du rb| 
|dd… ¡}| 	| d¡p_d	d¡}|}n!| 	| j¡}| d
¡rx|td
ƒd… }n| d
¡r†|td
ƒd… }| dd¡}| dd¡}| jrš| ¡ }n| jr¢| d¡}| jdkr­| | j¡}| jr¹| d¡s¹|d7 }|S )zVApply preprocessing such as decoding the input, removing BOM and normalizing newlines.r9   Úchardetr   NzkTo enable chardet encoding guessing, please install the chardet library from http://chardet.feedparser.org/Úreplacei   r8   r   u   ï»¿z
Ú
ú)rF   Ústrr8   r   rI   ÚImportErrorÚ_encoding_mapÚ
startswithÚlenÚdecodeÚdetectr=   rJ   r5   Ústripr4   r7   Ú
expandtabsr6   Úendswith)	r?   rH   Ú_rI   ÚeÚdecodedÚbomr8   Úencr!   r!   r$   Ú_preprocess_lexer_inputÎ   sR   


þ€ÿ
þÿ
€



zLexer._preprocess_lexer_inputFc                    s4   ˆ   ˆ¡‰‡ ‡fdd„}|ƒ }|st|ˆ jˆ ƒ}|S )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.
        c                  3   s&   � ˆ   ˆ¡D ]
\} }}||fV  qd S ©N)Úget_tokens_unprocessed)rW   ÚtÚv©r?   rH   r!   r$   Ústreamer  s   €ÿz"Lexer.get_tokens.<locals>.streamer)r\   r   r;   )r?   rH   Ú
unfilteredrb   Ústreamr!   ra   r$   Ú
get_tokensý   s   
zLexer.get_tokensc                 C   s   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.
        )ÚNotImplementedErrorra   r!   r!   r$   r^     s   	zLexer.get_tokens_unprocessed)F)r0   r1   r2   r3   r-   ÚaliasesÚ	filenamesÚalias_filenamesÚ	mimetypesÚpriorityÚurlÚversion_addedÚ_examplerA   rE   r>   r)   r\   re   r^   r!   r!   r!   r$   r   1   s$    ;
/r   )Ú	metaclassc                   @   s$   e Zd ZdZefdd„Zdd„ ZdS )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                 K   s<   |di |¤Ž| _ |di |¤Ž| _|| _tj| fi |¤Ž d S ©Nr!   )Ú
root_lexerÚlanguage_lexerÚneedler   rA   )r?   Ú_root_lexerÚ_language_lexerÚ_needler<   r!   r!   r$   rA   +  s   zDelegatingLexer.__init__c                 C   sŠ   d}g }g }| j  |¡D ]$\}}}|| ju r(|r#| t|ƒ|f¡ g }||7 }q| |||f¡ q|r<| t|ƒ|f¡ t|| j |¡ƒS )NÚ )rr   r^   rs   rG   rQ   Údo_insertionsrq   )r?   rH   ÚbufferedÚ
insertionsÚ
lng_bufferÚir_   r`   r!   r!   r$   r^   1  s   


ÿz&DelegatingLexer.get_tokens_unprocessedN)r0   r1   r2   r3   r   rA   r^   r!   r!   r!   r$   r   !  s    	r   c                   @   ó   e Zd ZdZdS )r   zI
    Indicates that a state should include rules from another state.
    N©r0   r1   r2   r3   r!   r!   r!   r$   r   H  s    r   c                   @   r'   )Ú_inheritzC
    Indicates the a state should inherit from its superclass.
    c                 C   r   )Nr   r!   rD   r!   r!   r$   rE   S  ó   z_inherit.__repr__N)r0   r1   r2   r3   rE   r!   r!   r!   r$   r   O  s    r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )Úcombinedz:
    Indicates a state combined from multiple states.
    c                 G   s   t  | |¡S r]   )Útupler+   )ÚclsÚargsr!   r!   r$   r+   ^  s   zcombined.__new__c                 G   s   d S r]   r!   )r?   r„   r!   r!   r$   rA   a  s   zcombined.__init__N)r0   r1   r2   r3   r+   rA   r!   r!   r!   r$   r�   Y  s    r�   c                   @   sF   e Zd ZdZdd„ Zddd„Zddd„Zdd	d
„Zdd„ Zdd„ Z	dS )Ú_PseudoMatchz:
    A pseudo match object constructed from a string.
    c                 C   s   || _ || _d S r]   )Ú_textÚ_start)r?   ÚstartrH   r!   r!   r$   rA   k  s   
z_PseudoMatch.__init__Nc                 C   s   | j S r]   )r‡   ©r?   Úargr!   r!   r$   rˆ   o  s   z_PseudoMatch.startc                 C   s   | j t| jƒ S r]   )r‡   rQ   r†   r‰   r!   r!   r$   Úendr  s   z_PseudoMatch.endc                 C   s   |rt dƒ‚| jS )NzNo such group)Ú
IndexErrorr†   r‰   r!   r!   r$   Úgroupu  s   z_PseudoMatch.groupc                 C   s   | j fS r]   )r†   rD   r!   r!   r$   Úgroupsz  s   z_PseudoMatch.groupsc                 C   s   i S r]   r!   rD   r!   r!   r$   Ú	groupdict}  r€   z_PseudoMatch.groupdictr]   )
r0   r1   r2   r3   rA   rˆ   r‹   r�   rŽ   r�   r!   r!   r!   r$   r…   f  s    


r…   c                     s   d‡ fdd„	}|S )zL
    Callback that yields multiple actions for each group in the match.
    Nc                 3   sÀ   � t ˆ ƒD ]O\}}|d u rqt|ƒtu r)| |d ¡}|r(| |d ¡||fV  q| |d ¡}|d urT|r>| |d ¡|_|| t| |d ¡|ƒ|ƒD ]}|rS|V  qLq|r^| ¡ |_d S d S )Né   )Ú	enumerater*   r	   r�   rˆ   Úposr…   r‹   )ÚlexerÚmatchÚctxr|   ÚactionÚdataÚitem©r„   r!   r$   Úcallback…  s,   €€ÿ€ÿzbygroups.<locals>.callbackr]   r!   )r„   rš   r!   r™   r$   r   �  s   r   c                   @   r}   )Ú_ThiszX
    Special singleton used for indicating the caller class.
    Used by ``using``.
    Nr~   r!   r!   r!   r$   r›   ›  s    r›   c                    sl   i ‰dˆv rˆ  d¡}t|ttfƒr|ˆd< nd|fˆd< ˆ tu r+d‡‡fdd„	}|S d‡ ‡‡fd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ÚrootNc           	      3   s€   � ˆrt | jƒ}| ˆ¡ | jdi |¤Ž}n| }| ¡ }|j| ¡ fi ˆ ¤ŽD ]\}}}|| ||fV  q'|r>| ¡ |_d S d S rp   )	Údictr<   ÚupdaterC   rˆ   r^   r�   r‹   r’   ©	r“   r”   r•   r/   ÚlxÚsr|   r_   r`   )Ú	gt_kwargsÚkwargsr!   r$   rš   º  s   €

 ÿzusing.<locals>.callbackc           	      3   st   � t | jƒ}| ˆ¡ ˆ di |¤Ž}| ¡ }|j| ¡ fi ˆ¤ŽD ]\}}}|| ||fV  q!|r8| ¡ |_d S d S rp   )rŸ   r<   r    rˆ   r^   r�   r‹   r’   r¡   ©Ú_otherr¤   r¥   r!   r$   rš   Ê  s   €

 ÿr]   )ÚpoprF   Úlistr‚   r   )r§   r¥   r£   rš   r!   r¦   r$   r   ¤  s   

õr   c                   @   r'   )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                 C   s
   || _ d S r]   )rœ   )r?   rœ   r!   r!   r$   rA   à  s   
zdefault.__init__N)r0   r1   r2   r3   rA   r!   r!   r!   r$   r   Ø  s    r   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )	r   z•
    Indicates a list of literal words that is transformed into an optimized
    regex that matches any of the words.

    .. versionadded:: 2.0
    rw   c                 C   s   || _ || _|| _d S r]   )r   ÚprefixÚsuffix)r?   r   rª   r«   r!   r!   r$   rA   ë  s   
zwords.__init__c                 C   s   t | j| j| jd�S )N©rª   r«   )r   r   rª   r«   rD   r!   r!   r$   r=   ð  s   z	words.getN)rw   rw   )r0   r1   r2   r3   rA   r=   r!   r!   r!   r$   r   ä  s    
r   c                   @   sJ   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zddd„Zdd„ Z	dd„ Z
d
S )ÚRegexLexerMetazw
    Metaclass for RegexLexer, creates the self._tokens attribute from
    self.tokens on the first instantiation.
    c                 C   s    t |tƒr	| ¡ }t ||¡jS )zBPreprocess the regular expression component of a token definition.)rF   r   r=   ÚreÚcompiler”   )rƒ   ÚregexÚrflagsrœ   r!   r!   r$   Ú_process_regexú  s   
zRegexLexerMeta._process_regexc                 C   s&   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ƒ   Útokenr!   r!   r$   Ú_process_token   s   ÿzRegexLexerMeta._process_tokenc                 C   s
  t |tƒr0|dkrdS ||v r|fS |dkr|S |dd… dkr)t|dd… ƒ S J d|›�ƒ‚t |tƒrdd	| j }|  jd
7  _g }|D ]}||ksRJ d|›�ƒ‚| |  |||¡¡ qE|||< |fS t |tƒr~|D ]}||v s{|dv s{J d| ƒ‚qk|S J d|›�ƒ‚)z=Preprocess the state transition action of a token definition.ú#popéÿÿÿÿú#pushNé   z#pop:Fzunknown new state z_tmp_%dr�   zcircular state ref )r¶   r¸   zunknown new state def )rF   rM   Úintr�   Ú_tmpnameÚextendÚ_process_stater‚   )rƒ   Ú	new_stateÚunprocessedÚ	processedÚ	tmp_stateÚitokensÚistater!   r!   r$   Ú_process_new_state  s<   



ÿ

ÿ€z!RegexLexerMeta._process_new_statec                 C   s’  t |tƒsJ d|›�ƒ‚|d dksJ d|›�ƒ‚||v r!|| S g  }||< | j}|| D ]˜}t |tƒrM||ks@J d|›�ƒ‚| |  ||t|ƒ¡¡ q.t |tƒrSq.t |tƒrm|  |j	||¡}| 
t d¡jd|f¡ q.t|ƒtu szJ d|›�ƒ‚z|  |d ||¡}W n ty¤ }	 ztd	|d ›d
|›d| ›d|	› �ƒ|	‚d}	~	ww |  |d ¡}
t|ƒdkrµd}n	|  |d ||¡}| 
||
|f¡ q.|S )z%Preprocess a single state definition.zwrong state name r   ú#zinvalid state name zcircular state reference rw   Nzwrong rule def zuncompilable regex z
 in state z of z: r�   é   )rF   rM   Úflagsr   r¼   r½   r   r   rÄ   rœ   rG   r®   r¯   r”   r*   r‚   r²   Ú	ExceptionÚ
ValueErrorrµ   rQ   )rƒ   r¿   rÀ   rœ   Útokensr±   Útdefr¾   ÚrexÚerrr´   r!   r!   r$   r½   )  sD   
ÿ

&€ÿ
ÿzRegexLexerMeta._process_stateNc                 C   s<   i  }| j |< |p| j| }t|ƒD ]	}|  |||¡ q|S )z-Preprocess a dictionary of token definitions.)Ú_all_tokensrÊ   r©   r½   )rƒ   r-   Ú	tokendefsrÀ   rœ   r!   r!   r$   Úprocess_tokendefT  s
   zRegexLexerMeta.process_tokendefc           
   
   C   sÒ   i }i }| j D ]_}|j di ¡}| ¡ D ]Q\}}| |¡}|du r;|||< z| t¡}W n	 ty5   Y qw |||< q| |d¡}|du rFq||||d …< z| t¡}	W n	 ty^   Y qw ||	 ||< qq|S )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__r=   ÚitemsÚindexr   rÉ   r¨   )
rƒ   rÊ   ÚinheritableÚcÚtoksrœ   rÓ   ÚcuritemsÚinherit_ndxÚnew_inh_ndxr!   r!   r$   Úget_tokendefs\  s6   

ÿÿäzRegexLexerMeta.get_tokendefsc                 O   sR   d| j vri | _d| _t| dƒr| jrn	|  d|  ¡ ¡| _tj	| g|¢R i |¤ŽS )z:Instantiate cls after preprocessing its token definitions.Ú_tokensr   Útoken_variantsrw   )
rÒ   rÎ   r»   ÚhasattrrÝ   rÐ   rÛ   rÜ   r*   Ú__call__)rƒ   r„   Úkwdsr!   r!   r$   rß   �  s   
zRegexLexerMeta.__call__r]   )r0   r1   r2   r3   r²   rµ   rÄ   r½   rÐ   rÛ   rß   r!   r!   r!   r$   r­   ô  s    #
+1r­   c                   @   s$   e Zd ZdZejZi Zddd„ZdS )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.
    ©rž   c                 c   sª  � d}| j }t|ƒ}||d  }	 |D ]Ž\}}}	|||ƒ}
|
r¡|dur:t|ƒtu r2|||
 ¡ fV  n|| |
ƒE dH  |
 ¡ }|	durŸt|	tƒrm|	D ]"}|dkrZt|ƒdkrY| 	¡  qI|dkrf| 
|d ¡ qI| 
|¡ qIn,t|	tƒr†t|	ƒt|ƒkr€|dd…= n||	d…= n|	dkr’| 
|d ¡ nJ d|	›�ƒ‚||d  } n3qz'|| d	kr¼d
g}|d
 }|td	fV  |d7 }W q|t|| fV  |d7 }W n
 tyÓ   Y dS w q)z~
        Split ``text`` into (tokentype, text) pairs.

        ``stack`` is the initial stack (default: ``['root']``)
        r   r·   r�   Nr¶   r¸   Fúwrong state def: rK   rž   )rÜ   r©   r*   r	   r�   r‹   rF   r‚   rQ   r¨   rG   rº   Úabsr   r   rŒ   )r?   rH   r�   r’   rÏ   Ú
statestackÚstatetokensÚrexmatchr–   r¾   Úmrœ   r!   r!   r$   r^   ¾  s`   €

€ù
á#ÿÐz!RegexLexer.get_tokens_unprocessedN©rá   )	r0   r1   r2   r3   r®   Ú	MULTILINErÇ   rÊ   r^   r!   r!   r!   r$   r   ›  s
    r   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )r   z9
    A helper object that holds lexer position data.
    Nc                 C   s*   || _ || _|pt|ƒ| _|pdg| _d S )Nrž   )rH   r’   rQ   r‹   r�   )r?   rH   r’   r�   r‹   r!   r!   r$   rA     s   zLexerContext.__init__c                 C   s   d| j ›d| j›d| j›d�S )NzLexerContext(z, ú))rH   r’   r�   rD   r!   r!   r$   rE     s   zLexerContext.__repr__©NN)r0   r1   r2   r3   rA   rE   r!   r!   r!   r$   r   ü  s    
r   c                   @   s   e Zd ZdZddd„ZdS )r   zE
    A RegexLexer that uses a context object to store its state.
    Nc                 c   s   � | j }|st|dƒ}|d }n|}||jd  }|j}	 |D ]¨\}}}|||j|jƒ}	|	rÇ|durYt|ƒtu rG|j||	 ¡ fV  |	 ¡ |_n|| |	|ƒE dH  |sY||jd  }|durÅt	|t
ƒr�|D ]'}
|
dkrwt|jƒdkrv|j ¡  qd|
dkr…|j |jd ¡ qd|j |
¡ qdn1t	|tƒr©t|ƒt|jƒkr¢|jdd…= n|j|d…= n|dkr·|j |jd ¡ nJ d	|›�ƒ‚||jd  } nHqz;|j|jkrÒW dS ||j d
krñdg|_|d }|jtd
fV  | jd7  _W q|jt||j fV  | jd7  _W n t�y   Y dS w q)z
        Split ``text`` into (tokentype, text) pairs.
        If ``context`` is given, use this lexer context instead.
        r   rž   r·   r�   Nr¶   r¸   Frâ   rK   )rÜ   r   r�   rH   r’   r‹   r*   r	   r�   rF   r‚   rQ   r¨   rG   rº   rã   r   r   rŒ   )r?   rH   ÚcontextrÏ   r•   rå   ræ   r–   r¾   rç   rœ   r!   r!   r$   r^     sn   €



€ù
ß#ÿÎz)ExtendedRegexLexer.get_tokens_unprocessedrë   )r0   r1   r2   r3   r^   r!   r!   r!   r$   r     s    r   c              	   c   s¨  � t | ƒ} zt| ƒ\}}W n ty   |E dH  Y dS w d}d}|D ]{\}}}|du r.|}d}	|r†|t|ƒ |kr†||	|| … }
|
rP|||
fV  |t|
ƒ7 }|D ]\}}}|||fV  |t|ƒ7 }qR|| }	zt| ƒ\}}W n ty{   d}Y nw |r†|t|ƒ |ks:|	t|ƒk rž||||	d… fV  |t|ƒ|	 7 }q#|rÒ|p¤d}|D ]\}}}|||fV  |t|ƒ7 }q§zt| ƒ\}}W n tyÍ   d}Y dS w |s¡dS dS )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ÚStopIterationrQ   )rz   rÊ   rÔ   rÂ   ÚrealposÚinsleftr|   r_   r`   ÚoldiÚtmpvalÚit_indexÚit_tokenÚit_valueÚpr!   r!   r$   rx   S  s\   €
ýþõ€þørx   c                   @   r'   )ÚProfilingRegexLexerMetaz>Metaclass for ProfilingRegexLexer, collects regex timing info.c                    sL   t |tƒrt|j|j|jd�‰n|‰t ˆ|¡‰tjf‡ ‡‡‡fdd„	}|S )Nr¬   c                    s`   ˆ j d  ˆˆfddg¡}t ¡ }ˆ | ||¡}t ¡ }|d  d7  < |d  || 7  < |S )Nr·   r   r    r�   )Ú
_prof_dataÚ
setdefaultÚtimer”   )rH   r’   ÚendposÚinfoÚt0ÚresÚt1©rƒ   ÚcompiledrÌ   rœ   r!   r$   Ú
match_funcž  s   z:ProfilingRegexLexerMeta._process_regex.<locals>.match_func)	rF   r   r   rª   r«   r®   r¯   ÚsysÚmaxsize)rƒ   r°   r±   rœ   r  r!   r  r$   r²   –  s   

ÿz&ProfilingRegexLexerMeta._process_regexN)r0   r1   r2   r3   r²   r!   r!   r!   r$   rø   “  s    rø   c                   @   s"   e Zd ZdZg ZdZddd„ZdS )ÚProfilingRegexLexerzFDrop-in replacement for RegexLexer that does profiling of its regexes.é   rá   c                 #   sÄ   � ˆ j j i ¡ t ˆ ||¡E d H  ˆ j j ¡ }tdd„ | ¡ D ƒ‡ fdd„dd�}tdd„ |D ƒƒ}t	ƒ  t	dˆ j j
t|ƒ|f ƒ t	d	ƒ t	d
d ƒ t	dƒ |D ]}t	d| ƒ qSt	d	ƒ d S )Nc                 s   sP   � | ]#\\}}\}}|t |ƒ d ¡ dd¡dd… |d| d| | fV  qdS )zu'z\\ú\NéA   iè  )ÚreprrT   rJ   )Ú.0r£   ÚrÚnr_   r!   r!   r$   Ú	<genexpr>´  s   € þÿz=ProfilingRegexLexer.get_tokens_unprocessed.<locals>.<genexpr>c                    s
   | ˆ j  S r]   )Ú_prof_sort_indexr"   rD   r!   r$   r%   ·  s   
 z<ProfilingRegexLexer.get_tokens_unprocessed.<locals>.<lambda>T)ÚkeyÚreversec                 s   s   � | ]}|d  V  qdS )é   Nr!   )r  r#   r!   r!   r$   r  ¹  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)rC   rù   rG   r   r^   r¨   ÚsortedrÓ   ÚsumÚprintr0   rQ   )r?   rH   r�   Úrawdatar—   Ú	sum_totalr/   r!   rD   r$   r^   ¯  s*   €þ
üÿz*ProfilingRegexLexer.get_tokens_unprocessedNrè   )r0   r1   r2   r3   rù   r  r^   r!   r!   r!   r$   r  ©  s
    r  )6r3   r®   r  rû   Úpygments.filterr   r   Úpygments.filtersr   Úpygments.tokenr   r   r   r   r	   Úpygments.utilr
   r   r   r   r   r   Úpygments.regexoptr   Ú__all__r¯   r   rO   ÚstaticmethodÚ_default_analyser*   r(   r   r   rM   r   r   r   r‚   r�   r…   r   r›   r   r   r   r   r­   r   r   r   rx   rø   r  r!   r!   r!   r$   Ú<module>   sH    
 
 q'4 (aH@