o
    ¯3Ih  ã                   @   s„   d Z ddlZddl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 g d¢ZG dd„ deƒZG dd	„ d	eƒZG d
d„ deƒZdS )zË
    pygments.lexers.diff
    ~~~~~~~~~~~~~~~~~~~~

    Lexers for diff/patch formats.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú
RegexLexerÚincludeÚbygroups)ÚTextÚCommentÚOperatorÚKeywordÚNameÚGenericÚLiteralÚ
Whitespace)Ú	DiffLexerÚDarcsPatchLexerÚ
WDiffLexerc                   @   s²   e Zd ZdZdZddgZddgZddgZd	Zd
Z	dde
eeeƒfde
ejeƒfde
ejeƒfde
ejeƒfde
ejeƒfde
ejeƒfde
ejeƒfde
eeƒfgiZdd„ ZdS )r   z>
    Lexer for unified or context-style diffs or patches.
    ÚDiffÚdiffÚudiffz*.diffz*.patchztext/x-diffztext/x-patchz"https://en.wikipedia.org/wiki/DiffÚ Úrootz( )(.*)(\n)z(!.*|---)(\n)z((?:< |-).*)(\n)z((?:> |\+).*)(\n)z*(@.*|\d(?:,\d+)?(?:a|c|d)\d+(?:,\d+)?)(\n)z((?:[Ii]ndex|diff).*)(\n)z	(=.*)(\n)ú(.*)(\n)c                 C   s@   | d d… dkr
dS | d d… dkrdS | d d… dkrdS d S )	Né   zIndex: Té   zdiff é   z--- gÍÌÌÌÌÌì?© )Útextr   r   úT/home/air/sanwanet/gpt-api/venv/lib/python3.10/site-packages/pygments/lexers/diff.pyÚanalyse_text0   s   ÿzDiffLexer.analyse_textN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesÚ	mimetypesÚurlÚversion_addedr   r   r   r
   ÚStrongÚDeletedÚInsertedÚ
SubheadingÚHeadingÚtokensr   r   r   r   r   r      s,    
þõÿr   c                   @   s*  e Zd ZdZdZdgZddgZdZdZdZ	d	e
fd
e
fde
fde
fdee
eeeee
ejee
ƒ	fdee
eeeee
ejeƒdfdejfdejfdejfd d e	¡¡eeeeeƒfdejdfdejdfdeeeƒfgdefde
dfgdedfde
fgedƒd ejfd!ejfgedƒd ejfd!ejfgd"œZd#S )$r   zÈ
    DarcsPatchLexer is a lexer for the various versions of the darcs patch
    format.  Examples of this format are derived by commands such as
    ``darcs annotate --patch`` and ``darcs send``.
    zDarcs PatchÚdpatchz*.dpatchz*.darcspatchzhttps://darcs.netz0.10)ÚhunkÚaddfileÚadddirÚrmfileÚrmdirÚmoveÚreplaceú<ú>z\{z\}z/(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])z+(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)ÚcommentzNew patches:zContext:zPatch bundle hash:z(\s*)({})(.*)(\n)ú|z\+Úinsertú-Údeleter   z	[^\]].*\nz\]ú#popz\nz
\[_[^_]*_]ÚspecialTextz\[z[^\n\[]+)r   r7   r=   r9   r;   N)r   r   r   r    r!   r"   r#   r%   r&   ÚDPATCH_KEYWORDSr   r   r   r	   r   r   ÚDater
   r+   ÚformatÚjoinr   r)   r(   r   r   r,   r   r   r   r   r   9   s`    ÿÿÿþÿ

îþþýý
Þr   c                	   @   sè   e Zd ZdZdZdZdgZdgZg ZdZ	e
je
jB ZdZdZd	Zd
ZdZeejdfeejdfeefdefgeejdfeejdfeejdfeejdfeejfdejfgeejdfeejdfeejdfeejdfeejfdejfgdœZdS )r   zï
    A wdiff lexer.

    Note that:

    * It only works with normal output (without options like ``-l``).
    * If the target files contain "[-", "-]", "{+", or "+}",
      especially they are unbalanced, the lexer will get confused.
    ÚWDiffz#https://www.gnu.org/software/wdiff/Úwdiffz*.wdiffz2.2z\{\+z\+\}z\[\-z\-\]z[^{}[\]+-]+ÚinsertedÚdeletedÚ.z#pushr<   )r   rD   rE   N)r   r   r   r    r!   r%   r"   r#   r$   r&   ÚreÚ	MULTILINEÚDOTALLÚflagsÚins_opÚins_clÚdel_opÚdel_clÚnormalr
   r)   r(   r   r,   r   r   r   r   r   s   sD    


ü



ù




ù
ðr   )r    rG   Úpygments.lexerr   r   r   Úpygments.tokenr   r   r   r   r	   r
   r   r   Ú__all__r   r   r   r   r   r   r   Ú<module>   s    
(%: