3
V'íc ã @ sz d Z ddlmZmZmZ ddlmZ ddlmZm Z m
Z
mZmZm
Z
ddlmZ dgZG dd deZG d d deZd
S )zÈ
pygments.lexers.email
~~~~~~~~~~~~~~~~~~~~~
Lexer for the raw E-mail.
:copyright: Copyright 2006-2022 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 fddZdd Zdejdfdefgd ej fd
ej dfde
fd
e
fdejfdejfdejfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfde
jfdejfdeejejeje
jeje
jejfd 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 | t|dd| _d S )Nzhighlight-X-headerF)ÚsuperÚ__init__r Úhighlight_x)ÚselfÚoptions)Ú __class__© ú9/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/email.pyr s zEmailHeaderLexer.__init__c c sx | j r@|jdtj|jdfV | j|jddd}|E d H n4|jdtj|jdfV |jdtj|jdfV d S )Né é ÚrootÚheader)Ústack)r r ) r Ústartr ÚTagÚgroupZget_tokens_unprocessedr ÚSpecialZ 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\.-]*\w[a-zA-Z]+)\bz`(?<=\b)(?:(?:25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0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