o
    3Ih                     @   s   d Z ddlZddlmZmZ ddlmZmZmZm	Z	 ddl
mZ g dZG dd deZG d	d
 d
eZi ZG dd deZdS )z
    pygments.lexers.special
    ~~~~~~~~~~~~~~~~~~~~~~~

    Special lexers.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)Lexerline_re)TokenErrorTextGeneric)get_choice_opt)	TextLexerOutputLexerRawTokenLexerc                   @   sB   e Zd ZdZdZdgZdgZdgZdZdZ	dZ
dd	 Zd
d ZdS )r	   z3
    "Null" lexer, doesn't highlight anything.
    z	Text onlytextz*.txtz
text/plain g{Gz?c                 c   s    dt |fV  d S Nr   )r   selfr    r   W/home/air/sanwanet/gpt-api/venv/lib/python3.10/site-packages/pygments/lexers/special.pyget_tokens_unprocessed"   s   z TextLexer.get_tokens_unprocessedc                 C   s   t jS )N)r	   priority)r   r   r   r   analyse_text%   s   zTextLexer.analyse_textN)__name__
__module____qualname____doc__namealiases	filenames	mimetypesurlversion_addedr   r   r   r   r   r   r   r	      s    r	   c                   @   s.   e Zd ZdZdZdgZdZdZdZdd Z	d	S )
r
   zN
    Simple lexer that highlights everything as ``Token.Generic.Output``.
    zText outputoutputr   z2.10zoutput/outputc                 c   s    dt j|fV  d S r   )r   Outputr   r   r   r   r   3   s   z"OutputLexer.get_tokens_unprocessedN)
r   r   r   r   r   r   r   r   _exampler   r   r   r   r   r
   )   s    r
   c                   @   sB   e Zd ZdZdZg Zg ZdgZdZdZ	dd Z
dd	 Zd
d ZdS )r   a  
    Recreate a token stream formatted with the `RawTokenFormatter`.

    Additional options accepted:

    `compress`
        If set to ``"gz"`` or ``"bz2"``, decompress the token stream with
        the given compression algorithm before lexing (default: ``""``).
    zRaw token datazapplication/x-pygments-tokensz7https://pygments.org/docs/formatters/#RawTokenFormatterr   c                 K   s*   t |dg dd| _tj| fi | d S )Ncompress)r   nonegzbz2r   )r   r#   r   __init__)r   optionsr   r   r   r'   K   s   zRawTokenLexer.__init__c                 c   s    | j r?t|tr|d}z| j dkrdd l}||}n| j dkr,dd l}||}W n ty>   t|	dfV  Y nw t|t
rI|	d}|dd }| |D ]
\}}}||fV  qUd S )Nlatin1r%   r   r&   
)r#   
isinstancestrencodegzip
decompressr&   OSErrorr   decodebytesstripr   )r   r   r.   r&   itvr   r   r   
get_tokensP   s*   






zRawTokenLexer.get_tokensc           	   
   c   s    d}t |D ]h}zH|  dd\}}t|}|sCt}|ddd  }|D ]}|r5|d  s9t	dt
||}q+|t|< t|}t|tsQt	dW n tt	fyc   | }t}Y nw |||fV  |t|7 }qd S )Nr   	   .zmalformed token namezexpected str)r   finditergrouprstripsplit_ttype_cachegetr   isupper
ValueErrorgetattrastliteral_evalr+   r,   SyntaxErrorr   len)	r   r   lengthmatchttypestrvalttypettypesttype_r   r   r   r   e   s2   


z$RawTokenLexer.get_tokens_unprocessedN)r   r   r   r   r   r   r   r   r   r   r'   r7   r   r   r   r   r   r   :   s    	r   )r   rD   pygments.lexerr   r   pygments.tokenr   r   r   r   pygments.utilr   __all__r	   r
   r?   r   r   r   r   r   <module>   s    
