3
.ßL]E*  ã               @   s    d Z ddlZddl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 ddlmZmZmZmZ ddg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-2019 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú
RegexLexerÚincludeÚbygroupsÚdefaultÚusingÚthisÚwords)	ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚOther)Úget_bool_optÚget_list_optÚ	iteritemsÚshebang_matchesÚZephirLexerÚPhpLexerc               @   s  e Zd ZdZdZdgZdgZddddgZd	d
dg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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
    ZZephirZzephirz*.zepÚfetchZechoZissetÚemptyÚbitÚbitsÚstringz\s+z//.*?\nz	/\*.*?\*/Úcommentsandwhitespacez3/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)z#popz\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   ZbadregexÚrootN)$Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesZzephir_keywordsZzephir_typeÚreÚDOTALLÚ	MULTILINEÚflagsr	   r
   ÚSingleÚ	Multiliner   r   ÚRegexr   r   r   r   ZDeclarationZReservedÚConstantr   ÚBuiltinr   r   ÚFloatÚHexÚIntegerÚDoubleÚtokens© r5   r5   ú9/tmp/pip-install-5sebvq2j/pygments/pygments/lexers/php.pyr      sF   



c            "   @   s®  e Zd ZdZdZddddgZddd	g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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d0e#j&fd1e#j'fd2e#j(fd3ejfd4ej)fd5ej*d6fge+dddFdG�ej,j-fge+dedFdG�ej fgeej.dfge!dPƒeej,dfe/dƒgd5ej*dfdQej*fdRej0fdSe dT e dU ej1fdVeej1e2e3dWdX�ej1ƒfdYeej1e2e3dWdX�ej1ƒfdZeej1ej"ej1ƒfd[ej*fgd\œZ4d]d^„ Z5d_d`„ Z6dadb„ Z7dcS )fr   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.
    ZPHPÚphpZphp3Zphp4Zphp5z*.phpz
*.php[345]z*.incz
text/x-phpz[\\\w]|[^\x00-\x7f]z(?:[\\_a-z]|[^\x00-\x7f])z(?:z)*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)\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   r7   rV   r<   r:   r;   r   c             K   s˜   t |ddƒ| _t|ddgƒ| _t |ddƒ| _d|kr@|jdƒ| _tƒ | _| jr†dd	lm	} x*t
|ƒD ]\}}|| jkrd| jj|ƒ qdW tj| f|Ž d S )
NÚfuncnamehighlightingTÚdisabledmodulesÚunknownÚstartinlineFrW   r   )ÚMODULES)r   rX   r   rY   r[   ÚpopÚsetÚ
_functionsZpygments.lexers._php_builtinsr\   r   Úupdater   Ú__init__)ÚselfÚoptionsr\   ÚkeyÚvaluer5   r5   r6   ra   è   s    
zPhpLexer.__init__c             c   sh   dg}| j r|jdƒ xLtj| ||ƒD ]:\}}}|tjkrT|| jkrT|tj|fV  q&|||fV  q&W d S )Nr   r7   )r[   Úappendr   Úget_tokens_unprocessedr   r   r_   r/   )rb   ÚtextÚstackÚindexÚtokenre   r5   r5   r6   rg   ü   s    


zPhpLexer.get_tokens_unprocessedc             C   s*   t | dƒrdS d}tjd| ƒr&|d7 }|S )Nr7   Tg        z
<\?(?!xml)g333333Ó?)r   r'   Úsearch)rh   Úrvr5   r5   r6   Úanalyse_text  s    
zPhpLexer.analyse_textN)r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   )rN   rO   rP   rQ   rR   rS   rT   rU   )8r    r!   r"   r#   r$   r%   r&   Ú	mimetypesZ_ident_charZ_ident_beginZ
_ident_endZ_ident_innerr'   Ú
IGNORECASEr(   r)   r*   r
   ZPreprocr   r   r   Z	Delimiterr   r	   r+   r,   ZDocr   r   Ú	Attributer   r.   r   ÚVariabler   r0   ÚOctr1   r2   ZBinZBacktickr3   r   ZFunctionZMagicZClassr   ZEscapeZInterpolr   r   r4   ra   rg   rn   r5   r5   r5   r6   r   X   s¢   






  
 

)r#   r'   Zpygments.lexerr   r   r   r   r   r   r   Zpygments.tokenr	   r
   r   r   r   r   r   r   r   Zpygments.utilr   r   r   r   Ú__all__r   r   r5   r5   r5   r6   Ú<module>
   s   $,@