| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/pygments/lexers/__pycache__/ |
Upload File : |
a
SҼar � @ sr d Z ddlZddlmZmZ ddlmZ ddlmZm Z m
Z
mZmZm
Z
ddlmZmZ dgZG dd� de�ZdS ) z�
pygments.lexers.mime
~~~~~~~~~~~~~~~~~~~~
Lexer for Multipurpose Internet Mail Extensions (MIME) data.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�
RegexLexer�include)�get_lexer_for_mimetype)�Text�Name�String�Operator�Comment�Other)�get_int_opt�
ClassNotFound� MIMELexerc s� e Zd ZdZdZdgZg d�Z� fdd�Zdd� Zd d
� Z dd� Z
d
d� Zdd� Zdd� Z
ddhZdefde fgdejfdejdfged�defdefdedfged�de
fgd�Z� ZS ) r
a_
Lexer for Multipurpose Internet Mail Extensions (MIME) data. This lexer is
designed to process nested multipart data.
It assumes that the given data contains both header and body (and is
split at an empty line). If no valid header is found, then the entire data
will be treated as body.
Additional options accepted:
`MIME-max-level`
Max recursion level for nested MIME structure. Any negative number
would treated as unlimited. (default: -1)
`Content-Type`
Treat the data as a specific content type. Useful when header is
missing, or this lexer would try to parse from header. (default:
`text/plain`)
`Multipart-Boundary`
Set the default multipart boundary delimiter. This option is only used
when `Content-Type` is `multipart` and header is missing. This lexer
would try to parse from header by default. (default: None)
`Content-Transfer-Encoding`
Treat the data as a specific encoding. Or this lexer would try to parse
from header by default. (default: None)
.. versionadded:: 2.5
ZMIMEZmime)zmultipart/mixedzmultipart/relatedzmultipart/alternativec sJ t � jf i |�� |�d�| _|�d�| _|�dd�| _t|dd�| _d S )NzMultipart-BoundaryZContent_Transfer_EncodingZContent_Typez
text/plainzMIME-max-level���)�super�__init__�get�boundary�content_transfer_encoding�content_typer �max_nested_level)�self�options�� __class__� �8/usr/lib/python3.9/site-packages/pygments/lexers/mime.pyr ; s
zMIMELexer.__init__c c s� |� d�}|�� | jv r�|�d�tj|d fV |�d�tj|� d�fV |�d�}|� d�}| � |d|�� f�D ]\}}}|| ||fV qrn|�� t
|� � fV d S )N� �:� � �root)�group�lower�attention_headers�startr ZTagr �
Whitespace�end�get_tokens_unprocessedr )r �matchZfield�pos�body�i�t�vr r r �get_header_tokensB s
zMIMELexer.get_header_tokensc c s� |� � }|�� }|d dkr>|tjdfV |d }|dd � }| j�d�rP| jsz| �|�D ]\}}}|| ||fV qZd S dt� | j� }t�
|tj�}|�|�} | r�|| �
� }
| �
� }}|t|d | � � � fV || tj| �� fV n|}
d}|�||�D ]l} |
| }
| � � }||
|� }| �|�D ]\}}}|
| ||fV �q,|| tj| �� fV || �
� }
�q|
| }
|
t|�k�r�|
t||
d � fV d S )Nr �
r Z multipartz^--%s(--)?\n)r$ r! r r% r �
startswithr �get_bodypart_tokens�re�escape�compile� MULTILINE�searchr&