B
    `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 dddg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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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
    ZZephirZzephirz*.zepfetchZechoZisset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)\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 r9   r9   [/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pygments/lexers/php.pyr      sH   



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 PHPZpsyshc             K   s   d|d< t j| f| d S )NTstartinline)r   __init__)selfoptionsr9   r9   r:   r<   l   s    zPsyshConsoleLexer.__init__c          	   c   s  t f | j}d}g }xt|D ]}| }|ds@|drv|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 |rt|||E d H  d}g }| tj|fV  q W |rt|||E d H  d S )N z>>> z... r      z...   )r   r>   line_refinditergroup
startswithappendlenr   ZPromptrstripr
   get_tokens_unprocessedstartZOutput)r=   textZphplexerZcurcodeZ
insertionsmatchliner9   r9   r:   rI   p   s,    

z(PsyshConsoleLexer.get_tokens_unprocessedN)r$   r%   r&   r'   r(   r)   r<   rI   r9   r9   r9   r:   r   Y   s
   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+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d5e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dGZ4dHdI Z5dJdK Z6dLdM Z7dNS )Or   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   )Z__constructZ
__destructZ__callZ__callStaticZ__get__setZ__issetZ__unsetZ__sleep__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__
magicfuncsz	[^{$"\\]+z'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})z\$z(\[\S+?\]|->z)?z(\{\$\{)(.*?)(\}\})T)_startinlinez(\{)(\$.*?)(\})z(\$\{)(\S+)(\})z[${\\])r#   rN   rX   rS   rQ   rR   r   c             K   s   t |dd| _t|ddg| _t |dd| _d|kr@|d| _t | _| jrdd	lm	} x*|
 D ]\}}|| jkrd| j| qdW tj| f| d S )
NfuncnamehighlightingTdisabledmodulesunknownr;   FrY   r   )MODULES)r   rZ   r   r[   r;   popset
_functionsZpygments.lexers._php_builtinsr]   itemsupdater   r<   )r=   r>   r]   keyvaluer9   r9   r:   r<     s    
zPhpLexer.__init__c             c   sh   dg}| j r|d xLt| ||D ]:\}}}|tjkrT|| jkrT|tj|fV  q&|||fV  q&W d S )Nr#   rN   )r;   rF   r   rI   r   r   r`   r3   )r=   rK   stackindextokenrd   r9   r9   r:   rI   .  s    


zPhpLexer.get_tokens_unprocessedc             C   s*   t | drdS d}td| r&|d7 }|S )NrN   Tg        z
<\?(?!xml)g333333?)r   r+   search)rK   rvr9   r9   r:   analyse_text:  s    
zPhpLexer.analyse_textN)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/   r0   ZDocr   r   	Attributer   r2   r   Variabler   r4   Octr5   r6   ZBinZBacktickr7   r	   ZFunctionZMagicZClassr   ZEscapeZInterpolr   r   r8   r<   rI   rj   r9   r9   r9   r:   r      s   









)!r'   r+   Zpygments.lexerr   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__compilerB   r   r   r   r9   r9   r9   r:   <module>	   s   ,0

A1