a
    ñ»js3  ã                   @   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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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-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)
ÚLexerÚ
RegexLexerÚincludeÚbygroupsÚdefaultÚusingÚthisÚwordsÚdo_insertionsÚline_re)
ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚOtherÚGeneric)Úget_bool_optÚget_list_optÚshebang_matches)ÚZephirLexerÚPsyshConsoleLexerÚPhpLexerc                   @   s  e Zd ZdZdZdZdgZdgZd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 source code.

    Zephir is a compiled high level language aimed
    to the creation of C-extensions for PHP.
    ÚZephirzhttp://zephir-lang.com/Úzephirz*.zepz2.0)ÚfetchZechoZ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|readonly)\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)   ZbadregexÚrootN)&Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ	filenamesÚversion_addedZzephir_keywordsZzephir_typeÚreÚDOTALLÚ	MULTILINEÚflagsr   r   ÚSingleÚ	Multiliner   r   ÚRegexr   r   r   r   ÚDeclarationÚReservedÚConstantr   ÚBuiltinr   r   ÚFloatÚHexÚIntegerÚDoubleÚtokens© rD   rD   ú9E:\soccer\ml_env\Lib\site-packages\pygments/lexers/php.pyr      s`   ýÿûÿÿý
ýþçðr   c                   @   s2   e Zd ZdZdZdZdgZdZdd„ Zdd	„ Z	d
S )r   u  
    For PsySH console output, such as:

    .. sourcecode:: psysh

        >>> $greeting = function($name): string {
        ...     return "Hello, {$name}";
        ... };
        => Closure($name): string {#2371 â€¦3}
        >>> $greeting('World')
        => "Hello, World"
    zPsySH console session for PHPzhttps://psysh.org/Úpsyshz2.7c                 K   s   d|d< t j| fi |¤Ž d S )NTÚstartinline)r   Ú__init__)ÚselfÚoptionsrD   rD   rE   rH   i   s    zPsyshConsoleLexer.__init__c              	   c   s  t f i | j¤Ž}d}g }t |¡D ]Ä}| ¡ }| d¡sB| d¡rx| t|ƒdtj	|d d… fgf¡ ||dd … 7 }q"| 
¡ dkr²| t|ƒdtj	dfgf¡ ||dd … 7 }q"|rÔt|| |¡ƒE d H  d}g }| ¡ tj|fV  q"|�rt|| |¡ƒE d H  d S )NÚ z>>> z... r   é   z...é   )r   rJ   r   ÚfinditerÚgroupÚ
startswithÚappendÚlenr   ÚPromptÚrstripr
   Úget_tokens_unprocessedÚstartÚOutput)rI   ÚtextZphplexerZcurcodeÚ
insertionsÚmatchÚlinerD   rD   rE   rU   m   s4    
ÿ
ÿ
ÿ
ÿz(PsyshConsoleLexer.get_tokens_unprocessedN)
r+   r,   r-   r.   r/   r0   r1   r3   rH   rU   rD   rD   rD   rE   r   W   s   r   c                $   @   sî  e Zd ZdZdZdZg d¢Zg d¢ZdgZdZ	dZ
d	ZejejB ejB Zd
ejdfdefdef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d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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j"d*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d0e#j'fd1e#j(fd2ejfd3ej)fd4ej*d5fg!d6ej"dfe!dƒge+d7d8d9�ej,j-fge+d:d8d9�ej fge
ej.dfge!d;ƒe
ej,dfe/dƒgd4ej*dfd<ej*fd=ej0fd>e d? e d@ ej1fdAeej1e2e3dBdC�ej1ƒfdDeej1e2e3dBdC�ej1ƒfdEeej1ej"ej1ƒfdFej*fgdGedfdHedIfe
ej4fe!dƒgdJedfe!dƒgdKœ
Z5dLdM„ Z6dNdO„ Z7dPdQ„ Z8dRS )Sr   a;  
    For PHP 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.
    ÚPHPzhttps://www.php.net/)ÚphpÚphp3Úphp4Úphp5)z*.phpz
*.php[345]z*.incz
text/x-phprK   z1(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*z+(?:[_a-z]|[^\x00-\x7f])(?:\w|[^\x00-\x7f])*z	<\?(php)?r]   z[^<]+ú<z\?>r'   z(<<<)([\'"]?)(z)(\2\n.*?\n\s*)(\3)(;?)(\n)r#   z#\[Ú	attributez#.*?\nr$   z/\*\*/z/\*\*.*?\*/r%   z(->|::)(\s*)(ú)z[~!%^&*+=|:.<>/@-]+z\?z[\[\]{}();,]+z(new)(\s+)(class)\bz(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( from)?|finally|match|readonly)\bz(true|false|null)\bÚmagicconstantsz\$\{Úvariablevariablez\$+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"   z\})Z__constructZ
__destructZ__callZ__callStaticZ__getÚ__setZ__issetZ__unsetZ__sleepZ__wakeupZ
__toStringZ__invokeZ__set_stateZ__cloneZ__debugInfoz\b)Úsuffix)	Z__LINE__Z__FILE__Z__DIR__Z__FUNCTION__Z	__CLASS__Z	__TRAIT__Z
__METHOD__Z__NAMESPACE__Z__PROPERTY__Ú
magicfuncsz	[^{$"\\]+z'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})z\$z(\[\S+?\]|->z)?z(\{\$\{)(.*?)(\}\})T)Ú_startinlinez(\{)(\$.*?)(\})z(\$\{)(\S+)(\})z[${\\]z\]z\(Úattributeparamsz\))
r*   r]   rg   rk   rf   rd   re   r"   rb   rm   c                 K   s˜   t |ddƒ| _t|ddgƒ| _t |ddƒ| _d|v r@| d¡| _tƒ | _| jr‚dd	lm	} | 
¡ D ]\}}|| jvrb| j |¡ qbtj| fi |¤Ž d S )
NÚfuncnamehighlightingTÚdisabledmodulesÚunknownrG   Frl   r   )ÚMODULES)r   rn   r   ro   rG   ÚpopÚsetÚ
_functionsZpygments.lexers._php_builtinsrq   ÚitemsÚupdater   rH   )rI   rJ   rq   ÚkeyÚvaluerD   rD   rE   rH   )  s     ÿÿ
zPhpLexer.__init__c                 c   sd   dg}| j r| d¡ t | ||¡D ]:\}}}|tju rR|| jv rR|tj|fV  q$|||fV  q$d S )Nr*   r]   )rG   rQ   r   rU   r   r   rt   r>   )rI   rX   ÚstackÚindexÚtokenrx   rD   rD   rE   rU   =  s    
ÿ

zPhpLexer.get_tokens_unprocessedc                 C   s*   t | dƒrdS d}t d| ¡r&|d7 }|S )Nr]   Tg        z
<\?(?!xml)g333333Ó?)r   r4   Úsearch)rX   ÚrvrD   rD   rE   Úanalyse_textI  s    
zPhpLexer.analyse_textN)9r+   r,   r-   r.   r/   r0   r1   r2   Ú	mimetypesr3   Z_ident_innerZ_ident_nonsr4   Ú
IGNORECASEr5   r6   r7   r   ÚPreprocr   r   r   Ú	Delimiterr   r   r8   r9   ÚDocr   r   Ú	Attributer   r=   r   ÚVariabler   r?   ÚOctr@   rA   ÚBinÚBacktickrB   r	   ÚFunctionÚMagicÚClassr   ÚEscapeÚInterpolr   r   Ú	DecoratorrC   rH   rU   r~   rD   rD   rD   rE   r   ‡   sä    
ý

ÿÿ
ÿÿ
ÿ
ö

Í6
þýüþ
ýüþ	
ÿ
ý
ÿÿÿÿÿÿòüþ“sr   ) r.   r4   Zpygments.lexerr   r   r   r   r   r   r   r	   r
   r   Zpygments.tokenr   r   r   r   r   r   r   r   r   r   Zpygments.utilr   r   r   Ú__all__r   r   r   rD   rD   rD   rE   Ú<module>   s   
00A0