3

V'ícÙ0ã@s¾dZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZddl
mZmZmZmZmZmZmZmZmZmZddlmZmZmZdddgZGd	d„deƒZGd
d„deƒZGdd„deƒZdS)zÐ
    pygments.lexers.php
    ~~~~~~~~~~~~~~~~~~~

    Lexers for PHP and related languages.

    :copyright: Copyright 2006-2022 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@seZdZdZdZdZdgZdgZdddd	gZd
ddgZ	e
je
jBZ
d
efdejfdejfgedƒdejdfdedfedƒgdedfgdedfedƒdedfdedfdefdedfdejdfdejfdejfdejfdejfd ej fd!ej!fd"ej"fd#ej#fd$ejfgd%œZ$d&S)'rz¦
    For Zephir language source code.

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

    .. versionadded:: 2.0
    ZZephirzhttp://zephir-lang.com/Zzephirz*.zepÚfetchZechoZissetÚemptyÚbitÚbitsÚstringz\s+z//.*?\nz	/\*.*?\*/Úcommentsandwhitespacez3/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)z#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]?z0x[0-9a-fA-F]+z[0-9]+z"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*')r!r#ZbadregexÚrootN)%Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ	filenamesZzephir_keywordsZzephir_typeÚreÚDOTALLÚ	MULTILINEÚflagsrr
ÚSingleÚ	MultilinerrÚRegexrrrrZDeclarationZReservedÚConstantrÚBuiltinrrÚFloatÚHexÚIntegerÚDoubleÚtokens©r;r;ú7/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/php.pyrsJ



c@s.eZdZdZdZdZdgZdd„Zdd„Zd	S)
ru5
    For PsySH console output, such as:

    .. sourcecode:: psysh

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

    .. versionadded:: 2.7
    zPsySH console session for PHPzhttps://psysh.org/ZpsyshcKsd|d<tj|f|ŽdS)NTÚstartinline)rÚ__init__)ÚselfÚoptionsr;r;r<r>kszPsyshConsoleLexer.__init__ccstf|jŽ}d}g}xÒtj|ƒD]Ä}|jƒ}|jdƒs@|jdƒrv|jt|ƒdtj	|dd…fgfƒ||dd…7}q |j
ƒdkr°|jt|ƒdtj	dfgfƒ||dd…7}q |rÒt||j|ƒƒEdHd}g}|j
ƒtj|fVq W|rt||j|ƒƒEdHdS)NÚz>>> z... réz...é)rr@rÚfinditerÚgroupÚ
startswithÚappendÚlenrZPromptÚrstripr
Úget_tokens_unprocessedÚstartZOutput)r?ÚtextZphplexerZcurcodeZ
insertionsÚmatchÚliner;r;r<rJos,

z(PsyshConsoleLexer.get_tokens_unprocessedN)	r%r&r'r(r)r*r+r>rJr;r;r;r<rXsc"@sžeZdZdZdZdZddddgZdd	d
gZdgZdZ	d
Z
ejej
BejBZdejdfdefdefgdejdfde
deeeejeejeeƒfdefdejfdejfdejfdejfdejfde
deeeejƒfdefdefdefd eeeƒd!fd"eeeƒfd#eeeeeƒd$fd%e	deeeejƒfd&efd'ejfe d(ƒd)e	d*ej!fd+e	ej!fe	ejfd,e"j#fd-e"j#fd.e"j$fd/e"j%fd0e"j&fd1e"j'fd2ejfd3ej(fd4ej)d5fge*dcdEdFej+j,fge*dddEdFejfge	ej-dfge dOƒe	ej+dfe.dƒgd4ej)dfdPej)fdQej/fdRe
dSe
dTej0fdUeej0e1e2dVdWej0ƒfdXeej0e1e2dVdWej0ƒfdYeej0ej!ej0ƒfdZej)fgd[œZ3d\d]„Z4d^d_„Z5d`da„Z6dbS)era;
    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.
    ZPHPzhttps://www.php.net/ÚphpZphp3Zphp4Zphp5z*.phpz
*.php[345]z*.incz
text/x-phpz1(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*z+(?:[_a-z]|[^\x00-\x7f])(?:\w|[^\x00-\x7f])*z	<\?(php)?z[^<]+ú<z\?>z#popz(<<<)([\'"]?)(z)(\2\n.*?\n\s*)(\3)(;?)(\n)z\s+z#.*?\nz//.*?\nz/\*\*/z/\*\*.*?\*/z	/\*.*?\*/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|match)\bz(true|false|null)\bÚmagicconstantsz\$\{\$+z\}z\$+z"(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?z\d+e[+-]?[0-9]+z0[0-7]+z0x[a-f0-9]+z\d+z0b[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$rOrnrTrRrSr cKs˜t|ddƒ|_t|ddgƒ|_t|ddƒ|_d|kr@|jdƒ|_tƒ|_|jr†dd	lm	}x*|j
ƒD]\}}||jkrd|jj|ƒqdWtj
|f|ŽdS)
NÚfuncnamehighlightingTÚdisabledmodulesÚunknownr=Fror)ÚMODULES)rrprrqr=ÚpopÚsetÚ
_functionsZpygments.lexers._php_builtinsrsÚitemsÚupdaterr>)r?r@rsÚkeyÚvaluer;r;r<r>s
zPhpLexer.__init__ccshdg}|jr|jdƒxLtj|||ƒD]:\}}}|tjkrT||jkrT|tj|fVq&|||fVq&WdS)Nr$rO)r=rGrrJrrrvr5)r?rLÚstackÚindexÚtokenrzr;r;r<rJ-s


zPhpLexer.get_tokens_unprocessedcCs*t|dƒrdSd}tjd|ƒr&|d7}|S)NrOTgz
<\?(?!xml)g333333Ó?)rr-Úsearch)rLÚrvr;r;r<Úanalyse_text9s
zPhpLexer.analyse_textN)rVrWrXrYrZr[r\r]r^r_r`rarbrcrd)rfrgrhrirjrkrlrm)7r%r&r'r(r)r*r+r,Ú	mimetypesZ_ident_innerZ_ident_nonsr-Ú
IGNORECASEr.r/r0r
ZPreprocrrrZ	Delimiterrrr1r2ZDocrrÚ	Attributerr4rÚVariablerr6ÚOctr7r8ZBinZBacktickr9r	ZFunctionZMagicZClassrZEscapeZInterpolrrr:r>rJr€r;r;r;r<r‰s 









) r(r-Zpygments.lexerrrrrrrrr	r
rZpygments.tokenrr
rrrrrrrrZ
pygments.utilrrrÚ__all__rrrr;r;r;r<Ú<module>	s00
B1