o
    ‡ÎÖa1  ã                   @   sÂ   d Z ddl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mZ g d¢Ze d¡ZG dd	„ d	eƒZG d
d„ deƒZG dd„ deƒZ dS )zÐ
    pygments.lexers.php
    ~~~~~~~~~~~~~~~~~~~

    Lexers for PHP and related languages.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)	ÚLexerÚ
RegexLexerÚincludeÚbygroupsÚdefaultÚusingÚthisÚwordsÚdo_insertions)
ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚOtherÚGeneric)Úget_bool_optÚget_list_optÚshebang_matches)ÚZephirLexerÚPsyshConsoleLexerÚPhpLexerz.*?
c                   @   s  e Zd ZdZdZdgZdgZg d¢Zg d¢Ze	j
e	jB Zdefdejfd	ejfged
ƒdejdfdedfedƒgdedfgdedfed
ƒdedfdedfdefdedfdejd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j"fdejfgdœZ#d S )!r   zÃ
    For `Zephir language <http://zephir-lang.com/>`_ source code.

    Zephir is a compiled high level language aimed
    to the creation of C-extensions for PHP.

    .. versionadded:: 2.0
    ÚZephirÚzephirz*.zep)ÚfetchÚechoÚissetÚempty)ÚbitÚbitsÚstringú\s+ú//.*?\nú	/\*.*?\*/Úcommentsandwhitespacez3/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)ú#popú/z\nz	^(?=\s|/)ÚslashstartsregexzC\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|->|[-<>+*%&|^/])=?z[{(\[;,]z[})\].]zá(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|require|inline|throw|try|catch|finally|new|delete|typeof|instanceof|void|namespace|use|extends|this|fetch|isset|unset|echo|fetch|likely|unlikely|empty)\bz(var|let|with|function)\bzð(abstract|boolean|bool|char|class|const|double|enum|export|extends|final|native|goto|implements|import|int|string|interface|long|ulong|char|uchar|float|unsigned|private|protected|public|short|static|self|throws|reverse|transient|volatile)\bz(true|false|null|undefined)\bzm(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|_GET|_POST|_SERVER|this|stdClass|range|count|iterator|window)\bz[$a-zA-Z_][\w\\]*z%[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?z0x[0-9a-fA-F]+z[0-9]+z"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*')r'   r*   ÚbadregexÚrootN)$Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesÚzephir_keywordsÚzephir_typeÚreÚDOTALLÚ	MULTILINEÚflagsr   r   ÚSingleÚ	Multiliner   r   ÚRegexr   r   r   r   ÚDeclarationÚReservedÚConstantr   ÚBuiltinr   r   ÚFloatÚHexÚIntegerÚDoubleÚtokens© rF   rF   ú5/usr/lib/python3/dist-packages/pygments/lexers/php.pyr      s^    	ýÿûÿÿý
ýþç
ðr   c                   @   s*   e Zd ZdZdZdgZdd„ Zdd„ ZdS )	r   uZ  
    For `PsySH`_ console output, such as:

    .. sourcecode:: psysh

        >>> $greeting = function($name): string {
        ...     return "Hello, {$name}";
        ... };
        => Closure($name): string {#2371 â€¦3}
        >>> $greeting('World')
        => "Hello, World"

    .. _PsySH: https://psysh.org/
    .. versionadded:: 2.7
    zPsySH console session for PHPÚpsyshc                 K   s   d|d< t j| fi |¤Ž d S )NTÚstartinline)r   Ú__init__)ÚselfÚoptionsrF   rF   rG   rJ   l   s   zPsyshConsoleLexer.__init__c              	   c   s  � t di | j¤Ž}d}g }t |¡D ]b}| ¡ }| d¡s"| d¡r=| t|ƒdtj	|d d… fgf¡ ||dd … 7 }q| 
¡ dkrZ| t|ƒdtj	dfgf¡ ||dd … 7 }q|rkt|| |¡ƒE d H  d}g }| ¡ tj|fV  q|r„t|| |¡ƒE d H  d S d S )	NÚ z>>> z... r   é   z...é   rF   )r   rL   Úline_reÚfinditerÚgroupÚ
startswithÚappendÚlenr   ÚPromptÚrstripr
   Úget_tokens_unprocessedÚstartÚOutput)rK   ÚtextÚphplexerÚcurcodeÚ
insertionsÚmatchÚlinerF   rF   rG   rX   p   s8   €
ÿ
ÿ

ÿÿÿz(PsyshConsoleLexer.get_tokens_unprocessedN)r-   r.   r/   r0   r1   r2   rJ   rX   rF   rF   rF   rG   r   Y   s    r   c                   @   sæ  e Zd ZdZdZg d¢Zg d¢ZdgZdZdZ	de d	 Z
e	e
 ZejejB ejB Zd
ejdfdefdefgg dejdf‘de d eeeejeejeeƒf‘def‘dejf‘dejf‘dejf‘dejf‘dejf‘de d eeeejƒf‘def‘def‘def‘deeeƒdf‘deeeƒf‘d eeeeeƒd!f‘d"e d eeeej ƒf‘d#ef‘d$ej f‘e!d%ƒ‘d&e d' ej"f‘d(e ej"f‘e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jf‘d0ej)f‘d1ej*d2f‘e+d3d4d5�ej,j-fge+d6d4d5�ej fgeej.dfge!d7ƒeej,dfe/dƒgd1ej*dfd8ej*fd9ej0fd:e d; e d< ej1fd=eej1e2e3d>d?�ej1ƒfd@eej1e2e3d>d?�ej1ƒfdAeej1ej"ej1ƒfdBej*fgdCœZ4dDdE„ Z5dFdG„ Z6dHdI„ Z7dJS )Kr   aT  
    For `PHP <http://www.php.net/>`_ source code.
    For PHP embedded in HTML, use the `HtmlPhpLexer`.

    Additional options accepted:

    `startinline`
        If given and ``True`` the lexer starts highlighting with
        php code (i.e.: no starting ``<?php`` required).  The default
        is ``False``.
    `funcnamehighlighting`
        If given and ``True``, highlight builtin function names
        (default: ``True``).
    `disabledmodules`
        If given, must be a list of module names whose function names
        should not be highlighted. By default all modules are highlighted
        except the special ``'unknown'`` module that includes functions
        that are known to php but are undocumented.

        To get a list of allowed modules have a look into the
        `_php_builtins` module:

        .. sourcecode:: pycon

            >>> from pygments.lexers._php_builtins import MODULES
            >>> MODULES.keys()
            ['PHP Options/Info', 'Zip', 'dba', ...]

        In fact the names of those modules match the module names from
        the php documentation.
    ÚPHP)ÚphpÚphp3Úphp4Úphp5)z*.phpz
*.php[345]z*.incz
text/x-phpz[\\\w]|[^\x00-\x7f]z(?:[\\_a-z]|[^\x00-\x7f])z(?:z)*z	<\?(php)?rb   z[^<]+ú<z\?>r(   z(<<<)([\'"]?)(z)(\2\n.*?\n\s*)(\3)(;?)(\n)r$   z#.*?\nr%   z/\*\*/z/\*\*.*?\*/r&   z(->|::)(\s*)(ú)z[~!%^&*+=|:.<>/@-]+z\?z[\[\]{}();,]+z(class)(\s+)Ú	classnamez(function)(\s*)(?=\()z(function)(\s+)(&?)(\s*)Úfunctionnamez(const)(\s+)(a  (and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|FALSE|print|for|require|continue|foreach|require_once|declare|return|default|static|do|switch|die|stdClass|echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|virtual|endfor|include_once|while|endforeach|global|endif|list|endswitch|new|endwhile|not|array|E_ALL|NULL|final|php_user_filter|interface|implements|public|private|protected|abstract|clone|try|catch|throw|this|use|namespace|trait|yield|finally)\bz(true|false|null)\bÚmagicconstantsz\$\{\$+z\}z\$+z"(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?z\d+e[+-]?[0-9]+z0[0-7]+z0x[a-f0-9]+z\d+z0b[01]+z'([^'\\]*(?:\\.[^'\\]*)*)'z`([^`\\]*(?:\\.[^`\\]*)*)`ú"r#   )Ú__constructÚ
__destructÚ__callÚ__callStaticÚ__getÚ__setÚ__issetÚ__unsetÚ__sleepÚ__wakeupÚ
__toStringÚ__invokeÚ__set_stateÚ__cloneÚ__debugInfoz\b)Úsuffix)Ú__LINE__Ú__FILE__Ú__DIR__Ú__FUNCTION__Ú	__CLASS__Ú	__TRAIT__Ú
__METHOD__Ú__NAMESPACE__Ú
magicfuncsz	[^{$"\\]+z'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})z\$z(\[\S+?\]|->z)?z(\{\$\{)(.*?)(\}\})T)Ú_startinlinez(\{)(\$.*?)(\})z(\$\{)(\S+)(\})z[${\\])r,   rb   r„   rj   rh   ri   r#   c                 K   s˜   t |ddƒ| _t|ddgƒ| _t |ddƒ| _d|v r | d¡| _tƒ | _| jrAdd	lm	} | 
¡ D ]\}}|| jvr@| j |¡ q1tj| fi |¤Ž d S )
NÚfuncnamehighlightingTÚdisabledmodulesÚunknownrI   Fr…   r   )ÚMODULES)r   r†   r   r‡   rI   ÚpopÚsetÚ
_functionsÚpygments.lexers._php_builtinsr‰   ÚitemsÚupdater   rJ   )rK   rL   r‰   ÚkeyÚvaluerF   rF   rG   rJ     s"   ÿÿ
€zPhpLexer.__init__c                 c   sf   � dg}| j r| d¡ t | ||¡D ]\}}}|tju r*|| jv r*|tj|fV  q|||fV  qd S )Nr,   rb   )rI   rT   r   rX   r   r   rŒ   r@   )rK   r[   ÚstackÚindexÚtokenr‘   rF   rF   rG   rX   .  s   €
ÿ

úzPhpLexer.get_tokens_unprocessedc                 C   s*   t | dƒrdS d}t d| ¡r|d7 }|S )Nrb   Tg        z
<\?(?!xml)g333333Ó?)r   r6   Úsearch)r[   ÚrvrF   rF   rG   Úanalyse_text:  s   
zPhpLexer.analyse_textN)8r-   r.   r/   r0   r1   r2   r3   Ú	mimetypesÚ_ident_charÚ_ident_beginÚ
_ident_endÚ_ident_innerr6   Ú
IGNORECASEr7   r8   r9   r   ÚPreprocr   r   r   Ú	Delimiterr   r   r:   r;   ÚDocr   r   Ú	Attributer   r?   r   ÚVariabler   rA   ÚOctrB   rC   ÚBinÚBacktickrD   r	   ÚFunctionÚMagicÚClassr   ÚEscapeÚInterpolr   r   rE   rJ   rX   r—   rF   rF   rF   rG   r   Š   s
    
ý
ÿ
ÿÿþûúù
öõô
ÿóñðïîíÿì
ÿê
öè#Ý$Ü%Û&Ú'Ù(Ø)×*Ö+Õ,Ô-Ó.Ò/Ñ
0Ð4ýüþ
ýüþ
	ÿ
ý
ÿÿÿÿÿÿò°br   )!r0   r6   Úpygments.lexerr   r   r   r   r   r   r   r	   r
   Úpygments.tokenr   r   r   r   r   r   r   r   r   r   Úpygments.utilr   r   r   Ú__all__ÚcompilerP   r   r   r   rF   rF   rF   rG   Ú<module>   s    
,0
A1