
    L&iX;                     &   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mZmZmZmZmZmZmZmZmZ ddlmZ g 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e          Z G d de          ZdS )z
    pygments.lexers.textfmts
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for various text formats.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)guess_lexerget_lexer_by_name)
RegexLexerbygroupsdefaultinclude)
TextCommentOperatorKeywordNameStringNumberGenericLiteralPunctuation)ClassNotFound)IrcLogsLexerTodotxtLexer	HttpLexerGettextLexerNotmuchLexerKernelLogLexerc                   ^   e Zd ZdZdZdgZdgZdgZej	        ej
        z  ZdZdefdez   d	z    eej        ej                  fdez   d
z    eej        ej                  dfdez   dz    eej        eej                  fdez   dz    eej        eee          fdefgdej        fdedfgdZdS )r   zD
    Lexer for IRC logs in *irssi*, *xchat* or *weechat* style.
    zIRC logsircz*.weechatlogztext/x-irclogaf  
        (
          # irssi / xchat and others
          (?: \[|\()?                  # Opening bracket or paren for the timestamp
            (?:                        # Timestamp
                (?: (?:\d{1,4} [-/])*  # Date as - or /-separated groups of digits
                    (?:\d{1,4})
                 [T ])?                # Date/time separator: T or space
                (?: \d?\d [:.])*       # Time as :/.-separated groups of 1 or 2 digits
                    (?: \d?\d)
            )
          (?: \]|\))?\s+               # Closing bracket or paren for the timestamp
        |
          # weechat
          \d{4}\s\w{3}\s\d{2}\s        # Date
          \d{2}:\d{2}:\d{2}\s+         # Time + Whitespace
        |
          # xchat
          \w{3}\s\d{2}\s               # Date
          \d{2}:\d{2}:\d{2}\s+         # Time + Whitespace
        )?
    z^\*\*\*\*(.*)\*\*\*\*$^z(\s*<[^>]*>\s*)$z/
                (\s*<.*?>\s*)          # Nick msgzo
                (\s*[*]\s+)            # Star
                (\S+\s+.*?\n)          # Nick + rest of message z
                (\s*(?:\*{3}|<?-[!@=P]?->?)\s*)  # Star(s) or symbols
                (\S+\s+)                     # Nick + Space
                (.*?\n)                         # Rest of message z^.*?\nz
\S+:(?!//)z.*\n#pop)rootr   N)__name__
__module____qualname____doc__namealiases	filenames	mimetypesreVERBOSE	MULTILINEflags	timestampr
   r   Preprocr   Tagr   r   Insertedr   r	   	Attributetokens     e/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/pygments/lexers/textfmts.pyr   r      s=         DgG I !IJ%EI2 '09_22HHW_dh4W4WX9_  2 2Xgotx00%9 9_  D D Xgow0@AAC
 9_  F F Xgow@@	B
 )
. DN+dF#
/ FFFr3   r   c                       e Zd ZdZdZddgZddgZg dZdd	ej	        fd
ej
        fdej        fd eeej        e          fdefd eej        ee          fd eej        ej        ej        ee          fgiZdS )r   zE
    Lexer for Gettext catalog files.

    .. versionadded:: 0.9
    zGettext Catalogpotpoz*.potz*.po)zapplication/x-gettextztext/x-gettextztext/gettextr   z	^#,\s.*?$z	^#:\s.*?$z^(#|#\.\s|#\|\s|#~\s|#\s).*$z^(")([A-Za-z-]+:)(.*")$z^".*"$z0^(msgid|msgid_plural|msgstr|msgctxt)(\s+)(".*")$z^(msgstr\[)(\d)(\])(\s+)(".*")$N)r    r!   r"   r#   r$   r%   r&   r'   r   TypeDeclarationr
   Singler   r   r   PropertyVariabler	   r   Integerr1   r2   r3   r4   r   r   V   s         
 DdmG&!IKKKI 	7<(7./,gn='XfdmV446@XdmT6224/XdmV^T]D&QQS
FFFr3   r   c                       e Zd ZdZdZdgZej        ZddZ	d Z
d Zd Zd	 eej        eej        eej        eee          d
fd eej        eeeeeej        e          d
fgde
fdefdedfgdefgdZd ZdS )r   z=
    Lexer for HTTP sessions.

    .. versionadded:: 1.5
    HTTPhttpr   c                 <    d| _         t          j        | ||          S )zReset the content-type state.N)content_typer   get_tokens_unprocessed)selftextstacks      r4   rD   z HttpLexer.get_tokens_unprocessed~   s     0tUCCCr3   c              #     K   |                     d                                          dk    ra|                     d                                          }d|v r/|d |                    d                                                   }|| _        |                    d          t          j        |                     d          fV  |                    d          t          |                     d          fV  |                    d          t          |                     d          fV  |                    d          t          |                     d          fV  |                    d          t          |                     d          fV  |                    d          t          |                     d          fV  d S )	N   zcontent-type   ;            )grouplowerstripfindrC   startr   r0   r	   r   r   )rE   matchrC   s      r4   header_callbackzHttpLexer.header_callback   sq     ;;q>>!!^33 ;;q>>//11Ll""+,C\->->s-C-C,CDJJLL ,Dkk!nndnekk!nn<<<<kk!nndEKKNN2222kk!nnhA6666kk!nndEKKNN2222kk!nngu{{1~~5555kk!nndEKKNN222222r3   c              #   6  K   |                     d          t          |                    d          fV  |                     d          t          |                    d          fV  |                     d          t          |                    d          fV  d S )NrI   rL   rM   )rT   r	   rP   r   )rE   rU   s     r4   continuous_header_callbackz$HttpLexer.continuous_header_callback   s      kk!nndEKKNN2222kk!nngu{{1~~5555kk!nndEKKNN222222r3   c              #     K   t          | dd           }|                                }|                                }|rddlm} |g}d|v r+t          j        dd|          }|                    |           |D ]F}	  ||          }	|	                    |          D ]\  }
}}||
z   ||fV   d S # t          $ r Y Cw xY w|t          |fV  d S )NrC   r   )get_lexer_for_mimetype+z^(.*)/.*\+(.*)$z\1/\2)getattrrP   rT   pygments.lexersrZ   r(   subappendrD   r   r	   )rE   rU   rC   contentoffsetrZ   possible_lexer_mimetypesgeneral_typeilexeridxtokenvalues                r4   content_callbackzHttpLexer.content_callback   s5     t^T::++-- 	>>>>>>(4~$l""  "v&8(&2 4  4(//===-  22155E .3-I-I'-R-R 9 9)UE$slE588888FF %   D dG######s   ;B//
B<;B<zm(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)headerszF(HTTP)(/)(1\.[01]|2(?:\.0)?|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)z(([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|\Z)z([\t ]+)([^\r\n]+)(\r?\n|\Z)z\r?\nr`   z.+)r   rj   r`   c                 ,    |                      d          S )N)	zGET /zPOST /zPUT /zDELETE /zHEAD /z	OPTIONS /zTRACE /zPATCH /zCONNECT 
startswithrF   s    r4   analyse_textzHttpLexer.analyse_text   s!      O P P 	Pr3   N)rA   )r    r!   r"   r#   r$   r%   r(   DOTALLr+   rD   rV   rX   ri   r   r   Functionr	   	Namespacer   Reservedr   r   	Exceptionr1   ro   r2   r3   r4   r   r   r   s8         DhGIED D D D
3 3 33 3 3
$ $ $69XdmT4>4&&$@ @	
 WXg&&$nd, ,

 9/J,.HItY'
 $%
# F,P P P P Pr3   r   c            
          e Zd ZdZdZdZdgZddgZdgZe	Z
eZej        Zej        Zej        ZeZdZd	Zd
ZdZdez   dz   Zedz   ez   dz   Zdez   dz   ez   dz   Ze ee
ee
e          dfe ee
e          dfe eeee          dfeedfeedfeedfeedfdedfgde
dfeefeefde
fde
fgdedfeefeefdefdefgdZdS )r   zI
    Lexer for Todo.txt todo list format.

    .. versionadded:: 2.0
    Todotxtzhttp://todotxt.com/todotxtztodo.txtz	*.todotxtztext/x-todoz\d{4,}-\d{2}-\d{2}z	\([A-Z]\)z\+\S+z@\S+z(x )()z( )((z)( )(complete
incompletez\S+z\s*\nr   z\s+)r   rz   r{   N)r    r!   r"   r#   r$   urlr%   r&   r'   r   CompleteTaskTextr	   IncompleteTaskTextr   HeadingPriority
SubheadingDateErrorProjectr   Context
date_regexpriority_regexproject_regexcontext_regexcomplete_one_date_regexcomplete_two_date_regexpriority_date_regexr   r1   r2   r3   r4   r   r      s         D
CkG [)II   HD mGG 'J!NMM '3d:6@) *,0 1/(:ZG$N %hh/?/?'G 'G %hh/?&F&F
 !((85G"N"N X|4|,G\2G\2'6/
: '0G$G$%&%&

 )62G$G$'('(

U5 5FFFr3   r   c                      e Zd ZdZdZdZdgZd Zdedfgd e	e
j        e          fd	 e	e
j        ej                  fd
 e	e
j        e          f ed          gdedfdedfdedfgdedfd e	e
j        e          fd e	ej        ee
j                  fgdedfdedfdedfgd e	e
j        ej                  fd e	ee
j        e          fd e	ee
j        e          f ed          gdedfdedfdefd efgd!Zd" Zd# Zd$S )%r   a  
    For Notmuch email text format.

    .. versionadded:: 2.5

    Additional options accepted:

    `body_lexer`
        If given, highlight the contents of the message body with the specified
        lexer, else guess it according to the body content (default: ``None``).
    Notmuchzhttps://notmuchmail.org/notmuchc              #   &  K   |                     d          }	 | j        rt          | j                  }n!t          |                                          }n# t
          $ r t          d          }Y nw xY w|                    |          E d {V  d S )NrI   rF   )rP   
body_lexerr   r   rR   r   rD   )rE   rU   codere   s       r4   _highlight_codezNotmuchLexer._highlight_code?  s      {{1~~	. 2)$/::#DJJLL11 	. 	. 	.%f--EEE	. //55555555555s   =A A32A3z\fmessage\{\s*)messagemessage-attrz(\s*id:\s*)(\S+)z&(\s*(?:depth|match|excluded):\s*)(\d+)z(\s*filename:\s*)(.+\n)r   z\fmessage\}\nz\fheader\{\nheaderz
\fbody\{\nbodyz\fheader\}\nz'((?:Subject|From|To|Cc|Date):\s*)(.*\n)z(.*)(\s*\(.*\))(\s*\(.*\)\n)z
\fpart\{\npartz\f(part|attachment)\{\s*)r   	part-attrz
\fbody\}\nz(ID:\s*)(\d+)z*(,\s*)((?:Filename|Content-id):\s*)([^,]+)z(,\s*)(Content-type:\s*)(.+\n)z\f(?:part|attachment)\}\nz\f(?:part|attachment)\{\s*)z#pushr   z^Non-text part: .*\nz&(?s)(.*?(?=\f(?:part|attachment)\}\n)))r   r   r   r   r   r   r   c                 4    |                      d          rdndS )Nz	message{g      ?g        rl   rn   s    r4   ro   zNotmuchLexer.analyse_texty  s    ool33<ss<r3   c                 `    |                     dd           | _        t          j        | fi | d S )Nr   )getr   r   __init__)rE   optionss     r4   r   zNotmuchLexer.__init__|  s6    !++lD99D,,G,,,,,r3   N)r    r!   r"   r#   r$   r|   r%   r   r   r   r   r0   r   r   r=   r   r   Strongr   r.   r   r
   r1   ro   r   r2   r3   r4   r   r   .  s       
 
 D
$CkG6 6 6 )DE
 !((4>6"B"BC6Xdnfn557'Xdnf--/GFOO
 w/gx0GV,
 gv.7Xdnf--/,Xgngtx88:	
 GV,('3HIGV,
 xxGGH:Xk4>6::<.Xk4>6::<GFOO
 *7F;*G5KL$g.6H	
K+ +FZ= = =- - - - -r3   r   c            
       .   e Zd ZdZdZddgZddgZdedfd	ed
fdedfdedfdedfdedfdedfgdedfdedf ed
          gde	fde
fdedfg ed          dedfg ed          dedfg ed          dej        dfg ed          dej        dfgdZdS )r   zK
    For Linux Kernel log ("dmesg") output.

    .. versionadded:: 2.6
    z
Kernel logkmsgdmesgz*.kmsgz*.dmesgz^[^:]+:debug : (?=\[)debugz^[^:]+:info  : (?=\[)infoz^[^:]+:warn  : (?=\[)warnz^[^:]+:notice: (?=\[)z^[^:]+:err   : (?=\[)errorz^[^:]+:crit  : (?=\[)z^(?=\[)unknownz(^(?=.+(warning|notice|audit|deprecated))z ^(?=.+(error|critical|fail|Bug))z\[[0-9. ]+\] z(?<=\] ).+?:z\nr   basez.+\n)r   r   r   r   r   r   r   N)r    r!   r"   r#   r$   r%   r&   r	   r   r   r   r   r
   r   r   r   r1   r2   r3   r4   r   r     sH        
 DwG9%I &tW5%tV4%tV4%tV4%tW5%tW5y)
 9$G0$@GFOO
 v&g&D&!
 GFOOgv&

 GFOOdF#

 GFOOgnf-

 GFOOgmV,
A$ $FFFr3   r   )r#   r(   r]   r   r   pygments.lexerr   r   r   r   pygments.tokenr	   r
   r   r   r   r   r   r   r   r   pygments.utilr   __all__r   r   r   r   r   r   r2   r3   r4   <module>r      s    
			 : : : : : : : : A A A A A A A A A A A A* * * * * * * * * * * * * * * * * * * * * * * * ' ' ' ' ' '- - -< < < < <: < < <~    :   8TP TP TP TP TP
 TP TP TPnb b b b b: b b bJP- P- P- P- P-: P- P- P-f. . . . .Z . . . . .r3   