a
    ñ»jR  ã                   @   sz   d Z ddlmZmZmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZ ddlmZ dgZG dd„ deƒZG d	d„ deƒZd
S )zË
    pygments.lexers.email
    ~~~~~~~~~~~~~~~~~~~~~

    Lexer for the raw E-mail.

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    )Ú
RegexLexerÚDelegatingLexerÚbygroups)Ú	MIMELexer)ÚTextÚKeywordÚNameÚStringÚNumberÚComment)Úget_bool_optÚ
EmailLexerc                       s  e Zd ZdZ‡ fdd„Zdd„ Zdejdfdefgd	ej	fd
ej	dfde
fde
fdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdejfdeejejeje
jejejejƒfd ej	fd!efgd"œZ‡  ZS )#ÚEmailHeaderLexerzm
    Sub-lexer for raw E-mail. This lexer only process header part of e-mail.

    .. versionadded:: 2.5
    c                    s$   t ƒ jf i |¤Ž t|ddƒ| _d S )Nzhighlight-X-headerF)ÚsuperÚ__init__r   Úhighlight_x©ÚselfÚoptions©Ú	__class__© ú;E:\soccer\ml_env\Lib\site-packages\pygments/lexers/email.pyr      s    zEmailHeaderLexer.__init__c                 c   sx   | j r@| d¡tj| d¡fV  | j| d¡dd�}|E d H  n4| d¡tj| d¡fV  | d¡tj| d¡fV  d S )Né   é   ©ÚrootÚheader)Ústack)	r   Ústartr   ÚTagÚgroupÚget_tokens_unprocessedr   ÚSpecialÚ	Multiline)r   ÚmatchZdefault_actionsr   r   r   Úget_x_header_tokens   s    
ÿz$EmailHeaderLexer.get_x_header_tokensz^(?:[A-WYZ]|X400)[\w\-]*:r   z(^(X-(?:\w[\w\-]*:))([\s\S]*?\n)(?![ \t])z\n[ \t]z\n(?![ \t])z#popz\bE?SMTPS?\bz\b(?:HE|EH)LO\bz[\w\.\-\+=]+@[\w\.\-]+z<[\w\.\-\+=]+@[\w\.\-]+>z%\b(\w[\w\.-]*\.[\w\.-]*\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|ET|DT)|[A-IK-Z])\)?)zN(=\?)([\w-]+)(\?)([BbQq])(\?)([\[\w!\"#$%&\'()*+,-./:;<=>@[\\\]^_`{|}~]+)(\?=)z[\s]+z[\S]r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r   r    r   Ú
Whitespacer   ÚLabelÚFunctionr
   ÚIntegerÚHexÚ	Decoratorr   r	   ÚAffixÚConstantÚtokensÚ__classcell__r   r   r   r   r      sd   
þ
þÿÿÿýþûÿþÅûr   c                       s@   e Zd ZdZdZddgZdgZdgZdZdZ	‡ fd	d
„Z
‡  ZS )r   z»
    Lexer for raw E-mail.

    Additional options accepted:

    `highlight-X-header`
        Highlight the fields of ``X-`` user-defined email header. (default:
        ``False``).
    zE-mailÚemailÚemlz*.emlzmessage/rfc822z2https://en.wikipedia.org/wiki/Email#Message_formatz2.5c                    s   t ƒ jtttfi |¤Ž d S )N)r   r   r   r   r   r   r   r   r   r   ƒ   s    zEmailLexer.__init__)r'   r(   r)   r*   ÚnameÚaliasesÚ	filenamesÚ	mimetypesÚurlÚversion_addedr   r4   r   r   r   r   r   q   s   
N)r*   Zpygments.lexerr   r   r   Zpygments.lexers.mimer   Zpygments.tokenr   r   r   r	   r
   r   Zpygments.utilr   Ú__all__r   r   r   r   r   r   Ú<module>   s   
 ^