o
    ‡ÎÖash  ã                   @   sh  d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZmZ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mZ g d	¢Z G d
d„ de	ƒZ!G dd„ de	ƒZ"G dd„ de	ƒZ#G dd„ de	ƒZ$G dd„ de	ƒZ%G dd„ de	ƒZ&G dd„ de&ƒZ'G dd„ de
ƒZ(G dd„ de
ƒZ)G dd„ de
ƒZ*G dd„ de	ƒZ+G d d!„ d!e	ƒZ,dS )"zÖ
    pygments.lexers.markup
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for non-HTML markup languages.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)ÚXmlLexer)ÚJavascriptLexer)ÚCssLexer)	Ú
RegexLexerÚDelegatingLexerÚincludeÚbygroupsÚusingÚthisÚdo_insertionsÚdefaultÚwords)
ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚGenericÚOther)Úget_bool_optÚClassNotFound)ÚBBCodeLexerÚMoinWikiLexerÚRstLexerÚTexLexerÚ
GroffLexerÚMozPreprocHashLexerÚMozPreprocPercentLexerÚMozPreprocXulLexerÚMozPreprocJavascriptLexerÚMozPreprocCssLexerÚMarkdownLexerÚTiddlyWiki5Lexerc                   @   sh   e Zd ZdZdZdgZdgZdefdedfdefgd	efd
e	e
jeeƒfde	eeƒfdedfgdœZdS )r   zR
    A lexer that highlights BBCode(-like) syntax.

    .. versionadded:: 0.6
    ÚBBCodeÚbbcodeztext/x-bbcodez[^[]+z\[/?\w+Útagz\[ú\s+z(\w+)(=)("?[^\s"\]]+"?)z(=)("?[^\s"\]]+"?)z\]ú#pop)Úrootr(   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	mimetypesr   r   r   r   Ú	Attributer   r   Útokens© r5   r5   ú8/usr/lib/python3/dist-packages/pygments/lexers/markup.pyr      s&    ûÿÿ÷
ør   c                   @   sì   e Zd ZdZdZddgZg ZdgZej	ej
B Zdefdeeeƒfdeejeeƒejeƒfd	eejejƒd
fdefdeeejeƒfdeeejeƒfdefdeeeeƒfdefdefdefdefgdejdfdedfdejfdejfgdœZdS )r   zI
    For MoinMoin (and Trac) Wiki markup.

    .. versionadded:: 0.7
    zMoinMoin/Trac Wiki markupz	trac-wikiÚmoinztext/x-trac-wikiz^#.*$z(!)(\S+)z^(=+)([^=]+)(=+)(\s*#.+)?$z(\{\{\{)(\n#!.+)?Ú	codeblockz(\'\'\'?|\|\||`|__|~~|\^|,,|::)z^( +)([.*-])( )z^( +)([a-z]{1,5}\.)( )z\[\[\w+.*?\]\]z(\[[^\s\]]+)(\s+[^\]]+?)?(\])z^----+$z[^\n\'\[{!_~^,|]+ú\nÚ.z\}\}\}r*   z\{\{\{z#pushz[^{}]+)r+   r8   N)r,   r-   r.   r/   r0   r1   Ú	filenamesr2   ÚreÚ	MULTILINEÚ
IGNORECASEÚflagsr   r   r   r   r   ÚHeadingr	   r
   r   r   ÚBuiltinÚ	NamespaceÚPreprocr4   r5   r5   r5   r6   r   >   s>    ÿ
ÿí
û
êr   c                   @   sz  e Zd ZdZdZg d¢ZddgZddgZej	Z
dd	„ Zd
ZdZde e¡e e¡f Zdeejeejeejeƒfdeejeejeƒfdeeeeedd�ƒfdeeeeedd�ƒfdeeeeedd�ƒfdeeeeedd�ƒfdeeeeedd�ƒfdeeeeedd�ƒfdefdeeeejeeeedd�ƒfdeeeejeedd�ƒfdeeeejeedd�ƒfdeeeejeejeeeedd�ƒfdejfdeeejeƒfdeeedd�eedd�ƒfdeej eeeeeƒfe!dƒgd efd!ed"fd#eeej"eƒfd$efd%eej#ej$ƒfd&eej$ej#ƒfd'ej%fd(ej&fd)efd*ejfd+efd,efgd-efd!e ed.fd/efgd0œZ'd1d2„ Z(d3d4„ Z)d5S )6r   a“  
    For `reStructuredText <http://docutils.sf.net/rst.html>`_ markup.

    .. versionadded:: 0.7

    Additional options accepted:

    `handlecodeblocks`
        Highlight the contents of ``.. sourcecode:: language``,
        ``.. code:: language`` and ``.. code-block:: language``
        directives with a lexer for the given language (default:
        ``True``).

        .. versionadded:: 0.8
    ÚreStructuredText)ÚrestructuredtextÚrstÚrestz*.rstz*.restz
text/x-rstztext/prs.fallenstein.rstc           
   	   c   s¼  � ddl m} | d¡t| d¡fV  | d¡t| d¡fV  | 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 }| j	rvz|| d¡ 
¡ ƒ}W n	 tyu   Y nw | d
¡}t|ƒ}|| d¡ | d¡ | d¡ }|d u rŸ| d
¡t|fV  d S g }| d¡}d}|D ]&}	t|	ƒ|krÌ| t|ƒdt|	d |… fgf¡ ||	|d … 7 }qª||	7 }qªt|| |¡ƒE d H  d S )Nr   ©Úget_lexer_by_nameé   é   é   é   é   é   é   é   é	   é
   é   TÚ )Úpygments.lexersrI   Ústartr   Úgroupr   r   ÚWordr   ÚhandlecodeblocksÚstripr   Úlenr   Ú
splitlinesÚappendr   Úget_tokens_unprocessed)
ÚselfÚmatchrI   ÚlexerÚ	indentionÚindention_sizeÚcodeÚinsÚ	codelinesÚliner5   r5   r6   Ú_handle_sourcecode�   s>   €ÿ
"
"
zRstLexer._handle_sourcecodeu   '")]}>â€™â€�Â»!?u   â€�â€‘â€’â€“â€”Â z((?=$)|(?=[-/:.,; \n\x00%s%s]))zH^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)(.+)(\n)(\1)(\n)zc^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)z!^(\s*)([-*+])( .+\n(?:\1  .+\n)*)Úinline©Ústatez1^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1  .+\n)*)z4^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1  .+\n)*)z$^(\s*)([A-Z]+\.)( .+\n(?:\1  .+\n)+)z*^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1  .+\n)+)z^(\s*)(\|)( .+\n(?:\|  .+\n)*)zl^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*)?\n)+)z,^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))z'^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$z^( *\.\.)(\s*)(\[.+\])(.*?)$z9^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))z^ *\.\..*(\n( +.*\n|\n)+)?z+^( *)(:(?:\\\\|\\:|[^:\n])+:(?=\s))([ \t]*)z!^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)z2(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*)?\n)+)ú\\.z``Úliteralz(`.+?)(<.+?>)(`__?)z`.+?`__?z(`.+?`)(:[a-zA-Z0-9:-]+?:)?z(:[a-zA-Z0-9:-]+?:)(`.+?`)z\*\*.+?\*\*z\*.+?\*z\[.*?\]_z<.+?>z[^\\\n\[*`:]+r:   z[^`]+r*   ú`)r+   rj   rn   c                 K   ó$   t |ddƒ| _tj| fi |¤Ž d S ©NrZ   T©r   rZ   r   Ú__init__©r`   Úoptionsr5   r5   r6   rs     ó   zRstLexer.__init__c                 C   s’   | d d… dkr| dd… dkrdS |   d¡}|   d|d ¡}|dkrA|d d |krC| |d  d	v rE| |d  | |d  krGd
S d S d S d S d S )NrK   z..rL   r:   g333333Ó?Ú
rJ   éÿÿÿÿz-=g      à?)Úfind)ÚtextÚp1Úp2r5   r5   r6   Úanalyse_text  s    
üzRstLexer.analyse_textN)*r,   r-   r.   r/   r0   r1   r;   r2   r<   r=   r?   ri   ÚclosersÚunicode_delimitersÚescapeÚend_string_suffixr   r   r@   r   r   r	   r
   r   r   rY   r   ÚTagr   rC   ÚClassr   ÚEscaper   ÚInterpolÚVariabler3   ÚStrongÚEmphr4   rs   r}   r5   r5   r5   r6   r   k   sÄ    )ÿÿÿþþÿÿÿÿÿÿþ
ÿÿÿÿÿÿÿÿÿÉ:ÿÿÿñýµRr   c                
   @   s  e Zd ZdZdZddgZg d¢ZddgZdefd	e	j
fd
e	j
fgdejdfdedfdejdfdedfdedfdefedƒdefgde	jfedƒdefdefde	j
fgdedfdedfedƒgdedfdedfde	j
fedƒgde	jfdefedƒgdœZd d!„ Zd"S )#r   z<
    Lexer for the TeX and LaTeX typesetting languages.
    ÚTeXÚtexÚlatex)z*.texz*.auxz*.tocz
text/x-texztext/x-latexz%.*?\nz[{}]z[&_^]z\\\[Údisplaymathz\\\(Ú
inlinemathz\$\$z\$z\\([a-zA-Z]+|.)Úcommandz\\$Úgeneralz[^\\$%&_^{}]+ú[0-9]+z[-=!+*/()\[\]]z[^=!+*/()\[\]\\$%&_^{}0-9-]+z\\\)r*   Úmathz\\\]z\[.*?\]z\*)r�   r+   r‘   r�   rŒ   rŽ   c                 C   s(   dD ]}| d t |ƒ… |kr dS qd S )N)z\documentclassz\inputz\documentstylez\relaxT)r\   )rz   rW   r5   r5   r6   r}   E  s
   ÿþzTexLexer.analyse_textN)r,   r-   r.   r/   r0   r1   r;   r2   r   r   rA   r   ÚBacktickr   r   r   r†   r   r   r3   r   r4   r}   r5   r5   r5   r6   r     sP    ý

øûýüýÞ)r   c                
   @   sÐ   e Zd ZdZdZg d¢Zg d¢ZddgZdee	e
ƒdfd	edfd
e	dfedƒgedƒd
e	fde	dfgdefdejfdejfdejfdejfde	dfgde	dfedƒdejfdefdefde	fgdœZdd„ ZdS )r   z¡
    Lexer for the (g)roff typesetting language, supporting groff
    extensions. Mainly useful for highlighting manpage sources.

    .. versionadded:: 0.6
    ÚGroff)ÚgroffÚnroffÚman)z*.[1-9]z*.manz*.1pz*.3pmzapplication/x-troffz
text/troffz	(\.)(\w+)Úrequestz\.z[^\\\n]+ÚtextlineÚescapesr9   r*   z	\\"[^\n]*z\\[fn]\wz\\\(.{2}z	\\.\[.*\]rm   z\\\nz	"[^\n"]+"z\d+z\S+r)   )r+   r˜   r™   r—   c                 C   sd   | d d… dkr
dS | d d… dkrdS | d d… dkrdS | dd…   ¡ r.| d  ¡ r0d	S d S d S )
NrJ   r:   FrL   z.\"TrM   z.TH gÍÌÌÌÌÌì?)ÚisalnumÚisspace)rz   r5   r5   r6   r}   y  s   ÿzGroffLexer.analyse_textN)r,   r-   r.   r/   r0   r1   r;   r2   r   r   r   r   r   r   r   r   r„   ÚDoubler   r4   r}   r5   r5   r5   r6   r   L  s>    ûýù
úê r   c                   @   sª   e Zd ZdZdZegZg Zg Zdej	dfde
fgdeej	eƒdfedƒej	d	fged
ƒefdeeeƒfdefdejfdejfdejfdefded	fdefdefg
dœZdS )r   z†
    Lexer for Mozilla Preprocessor files (with '#' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    Úmozhashpreprocz^#©ÚexprÚ	exprstartú.+z(literal)(.*)z#pop:2)ÚdefineÚundefÚifÚifdefÚifndefÚelseÚelifÚelifdefÚelifndefÚendifÚexpandÚfilterÚunfilterr   ÚincludesubstÚerrorr*   )ú!z!=z==z&&z||z(defined)(\()z\)r�   z__\w+?__z@\w+?@z\w+r9   r)   z\S)r+   r    rŸ   N)r,   r-   r.   r/   r0   r1   r;   r2   r   rC   r   r   r   r   r   r   r   r   ÚDecimalr   r†   rƒ   r4   r5   r5   r5   r6   r   „  s4    
þüþ
	ö
ór   c                   @   s:   e Zd ZdZdZegZg Zg Zddej	dfde
fgiZdS )r    z†
    Lexer for Mozilla Preprocessor files (with '%' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    Úmozpercentpreprocr+   z^%rž   r¡   N)r,   r-   r.   r/   r0   r1   r;   r2   r   rC   r   r4   r5   r5   r5   r6   r    ­  s    
þÿr    c                       ó4   e Zd ZdZdZdgZdgZg Z‡ fdd„Z‡  Z	S )r!   z€
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `XmlLexer`.

    .. versionadded:: 2.0
    zXUL+mozpreproczxul+mozpreprocz*.xul.inc                    ó   t ƒ jttfi |¤Ž d S ©N)Úsuperrs   r   r   rt   ©Ú	__class__r5   r6   rs   Î  ó   zMozPreprocXulLexer.__init__©
r,   r-   r.   r/   r0   r1   r;   r2   rs   Ú__classcell__r5   r5   r¸   r6   r!   Â  ó    r!   c                       r´   )r"   z‡
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `JavascriptLexer`.

    .. versionadded:: 2.0
    zJavascript+mozpreproczjavascript+mozpreprocz*.js.inc                    rµ   r¶   )r·   rs   r   r   rt   r¸   r5   r6   rs   Þ  rº   z"MozPreprocJavascriptLexer.__init__r»   r5   r5   r¸   r6   r"   Ò  r½   r"   c                       r´   )r#   z€
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `CssLexer`.

    .. versionadded:: 2.0
    zCSS+mozpreproczcss+mozpreprocz*.css.inc                    rµ   r¶   )r·   rs   r   r    rt   r¸   r5   r6   rs   î  rº   zMozPreprocCssLexer.__init__r»   r5   r5   r¸   r6   r#   â  r½   r#   c                   @   s¨  e Zd ZdZdZddgZddgZdgZej	Z
dd	„ Zd
eejeƒfdeejeƒfdeejeejeƒfdeejeejeƒfdeeeeeedd�ƒfdeeeeeedd�ƒfdeeeeedd�ƒfdeeejƒfdejfdefedƒgdefdeeejƒfdeeejƒfdeeejƒfdeeejƒfdeeejƒfdeeejƒfdejfdeeejeeejeƒfdeeejeeejeƒfd eeejeejƒfd!efd"efgd#œZd$d%„ Z d&S )'r$   zt
    For `Markdown <https://help.github.com/categories/writing-on-github/>`_ markup.

    .. versionadded:: 2.2
    ÚMarkdownÚmarkdownÚmdz*.mdz
*.markdownztext/x-markdownc                 c   sè   � ddl m} | d¡tj| d¡fV  | d¡tj| d¡fV  | d¡t| d¡fV  d}| jrGz|| d¡ ¡ ƒ}W n	 t	yF   Y nw | d¡}|du rZ| d¡t|fV  nt
g | |¡ƒE dH  | d¡tj| d¡fV  dS ©	zV
        match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks
        r   rH   rJ   rK   rL   NrM   rN   )rV   rI   rW   r   r’   rX   r   rZ   r[   r   r   r_   ©r`   ra   rI   rb   re   r5   r5   r6   Ú_handle_codeblockþ  s"   €ÿ
zMarkdownLexer._handle_codeblockz(^#[^#].+)(\n)z(^#{2,6}[^#].+)(\n)z^(.+)(\n)(=+)(\n)z^(.+)(\n)(-+)(\n)z^(\s*)([*-] )(\[[ xX]\])( .+\n)rj   rk   z^(\s*)([*-])(\s)(.+\n)z^(\s*)([0-9]+\.)( .+\n)z^(\s*>\s)(.+\n)z^(\s*```\n[\w\W]*?^\s*```$\n)z(^(\s*```)(\w+)(\n)([\w\W]*?)(^\s*```$\n)rm   z([^`]?)(`[^`\n]+`)z ([^\*]?)(\*\*[^* \n][^*\n]*\*\*)z([^_]?)(__[^_ \n][^_\n]*__)z([^\*]?)(\*[^* \n][^*\n]*\*)z([^_]?)(_[^_ \n][^_\n]*_)z([^~]?)(~~[^~ \n][^~\n]*~~)z[@#][\w/:]+z (!?\[)([^]]+)(\])(\()([^)]+)(\))z(\[)([^]]+)(\])(\[)([^]]*)(\])z^(\s*\[)([^]]*)(\]:\s*)(.+)z[^\\\s]+r:   )r+   rj   c                 K   rp   rq   rr   rt   r5   r5   r6   rs   Z  rv   zMarkdownLexer.__init__N)!r,   r-   r.   r/   r0   r1   r;   r2   r<   r=   r?   rÃ   r   r   r@   r   Ú
Subheadingr   r	   r
   rˆ   r   r’   r   r‡   ÚDeletedr   ÚEntityr‚   r3   ÚLabelr4   rs   r5   r5   r5   r6   r$   ò  s`    ÿÿÿçÿÿÿàä@r$   c                   @   sö  e Zd ZdZdZdgZdgZdgZej	Z
dd„ Zdd	„ Zd
eeeejƒfdeejeƒfdeejeƒfdeeeeeedd�ƒfdeeeeƒfdeejƒfdeejƒfdeejƒfdeejƒfdeeeeƒfdefdefedƒedƒgedddd�efgdefdejfdeeejeƒfd eeejƒfd!eeejƒfd"eeejƒfd#eeejeƒfd$eeejeƒfd%ejfd&ejfd'ejfd(ejfd)ejfd*ejfd+ej fd,eeejeƒfd-eeejeej!eƒfd.eeejeƒfd/eej!ƒfd0efd1efgd2œZ"d3d4„ Z#d5S )6r%   zf
    For `TiddlyWiki5 <https://tiddlywiki.com/#TiddlerFiles>`_ markup.

    .. versionadded:: 2.7
    ÚtiddlerÚtidz*.tidztext/vnd.tiddlywikic                 c   sä   � ddl m} | d¡t| d¡fV  | d¡t| d¡fV  | d¡t| d¡fV  d}| jrEz|| d¡ ¡ ƒ}W n	 tyD   Y nw | d¡}|du rY| d¡t|fV  dS t	g | 
|¡ƒE dH  | d¡t| d¡fV  dS rÁ   )rV   rI   rW   r   rX   r   rZ   r[   r   r   r_   rÂ   r5   r5   r6   rÃ   k  s$   €ÿ
z"TiddlyWiki5Lexer._handle_codeblockc                 c   sÂ   � ddl m} | d¡t| d¡fV  | d¡t| d¡fV  d}| jr4z|dƒ}W n	 ty3   Y nw | d¡}|du rH| d¡t|fV  dS tg | |¡ƒE dH  | d¡t| d¡fV  dS )	zP
        match args: 1:style tag 2:newline, 3:code, 4:closing style tag
        r   rH   rJ   rK   NÚcssrL   rM   )	rV   rI   rW   r   rX   rZ   r   r   r_   rÂ   r5   r5   r6   Ú_handle_cssblockˆ  s"   €ÿ
z!TiddlyWiki5Lexer._handle_cssblockz^(title)(:\s)(.+\n)z^(!)([^!].+\n)z^(!{2,6})(.+\n)z^(\s*)([*#>]+)(\s*)(.+\n)rj   rk   z^(<<<.*\n)([\w\W]*?)(^<<<.*$)z^(\|.*?\|h)$z^(\|.*?\|[cf])$z^(\|.*?\|k)$z^(;.*)$z^(```\n)([\w\W]*?)(^```$)z ^(```)(\w+)(\n)([\w\W]*?)(^```$)z$^(<style>)(\n)([\w\W]*?)(^</style>$)Úkeywords)z\definez\endÚcaptionÚcreatedÚmodifiedÚtagsÚtitleÚtypeú^z\b)ÚprefixÚsuffixrm   z\d{17}z(\s)(//[^/]+//)((?=\W|\n))z(\s)(\^\^[^\^]+\^\^)z(\s)(,,[^,]+,,)z(\s)(__[^_]+__)z(\s)(''[^']+'')((?=\W|\n))z(\s)(~~[^~]+~~)((?=\W|\n))z	<<[^>]+>>z\$\$[^$]+\$\$z\$\([^)]+\)\$z^@@.*$z	</?[^>]+>z`[^`]+`z&\S*?;z(\[{2})([^]\|]+)(\]{2})z$(\[{2})([^]\|]+)(\|)([^]\|]+)(\]{2})z(\{{2})([^}]+)(\}{2})z(\b.?.?tps?://[^\s"]+)z[\w]+r:   )r+   rÌ   rj   c                 K   rp   rq   rr   rt   r5   r5   r6   rs   ø  rv   zTiddlyWiki5Lexer.__init__N)$r,   r-   r.   r/   r0   r1   r;   r2   r<   r=   r?   rÃ   rË   r   r   r   r   r@   rÄ   r	   r
   r   r‡   rˆ   r   r‚   r   r   r   ÚIntegerrÅ   r’   ÚRegexr3   r4   rs   r5   r5   r5   r6   r%   _  s€    ÿäþýÿÿÿÿÿÔÛUr%   )-r/   r<   Úpygments.lexers.htmlr   Úpygments.lexers.javascriptr   Úpygments.lexers.cssr   Úpygments.lexerr   r   r   r   r	   r
   r   r   r   Úpygments.tokenr   r   r   r   r   r   r   r   r   r   Úpygments.utilr   r   Ú__all__r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r5   r5   r5   r6   Ú<module>   s,    
,0!- (:8)m