
    L&i0                         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e          Z G d	 d
e          Z G d de          ZdS )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                      e Zd ZdZdZdZdgZdgZg dZg dZ	e
j        e
j        z  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.

    .. versionadded:: 2.0
    Zephirzhttp://zephir-lang.com/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|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-   badregexrootN)%__name__
__module____qualname____doc__nameurl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     `/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/pygments/lexers/php.pyr   r      s         D
#CjG	I999O+++KI$E TN(7,-"
 G+,,%|V58V$GFOO
 D&!
 4!34G+,,45=?QS+'9:% "#57 *7+>@RS/ 180@B .w/?@<) "4:.5v|D
+'(&-8(&-83
!+ +FFFrK   r   c                   ,    e Zd ZdZdZdZdgZd Zd ZdS )r   u5  
    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
    zPsySH console session for PHPzhttps://psysh.org/psyshc                 4    d|d<   t          j        | fi | d S )NTstartinline)r   __init__)selfoptionss     rL   rQ   zPsyshConsoleLexer.__init__k   s*    !%t''w'''''rK   c           	   #      K   t          di | j        }d}g }t          j        |          D ]3}|                                }|                    d          s|                    d          rH|                    t          |          dt          j	        |d d         fgf           ||dd          z  }|
                                dk    r@|                    t          |          dt          j	        dfgf           ||dd          z  }|r-t          ||                    |                    E d {V  d}g }|                                t          j        |fV  5|r+t          ||                    |                    E d {V  d S d S )	N z>>> z... r      z...   rJ   )r   rS   r   finditergroup
startswithappendlenr   Promptrstripr   get_tokens_unprocessedstartOutput)rR   textphplexercurcode
insertionsmatchlines          rL   r_   z(PsyshConsoleLexer.get_tokens_unprocessedo   s     ++dl++
%d++ 	: 	:E;;==Dv&& :$//&*A*A :!!3w<<%&RaR$A#B#D E E E48#%''!!3w<<%&$>#?#A B B B48# $,"H$C$CG$L$L N  N N N N N N N N G!#JkkmmW^T99999 	O$Z%-%D%DW%M%MO O O O O O O O O O O	O 	OrK   N)	r0   r1   r2   r3   r4   r5   r6   rQ   r_   rJ   rK   rL   r   r   X   sT          +D
CiG( ( (O O O O OrK   r   c                   0   e Zd ZdZdZdZg dZg dZdgZdZ	dZ
ej        ej        z  ej        z  Zd	ej        d
fdefdefgg dej        dfde
z   dz    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
z   dz    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	z   dz    eeeej                  fd"efd#ej        f e d$          d%e	z   d&z   ej!        fd'e	z   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d/ej(        fd0ej)        d1f e*d2d34          ej+        j,        fg e*d5d34          ej        fge	ej-        dfg e d6          e	ej+        df e.d          gd0ej)        dfd7ej)        fd8ej/        fd9e
z   d:z   e
z   d;z   ej0        fd< eej0         e1e2d=>          ej0                  fd? eej0         e1e2d=>          ej0                  fd@ eej0        ej!        ej0                  fdAej)        fgdBZ3dC Z4dD Z5dE Z6dFS )Gr   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-phpz1(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*z+(?:[_a-z]|[^\x00-\x7f])(?:\w|[^\x00-\x7f])*z	<\?(php)?rj   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|match)\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/   rj   r   rr   rp   rq   r&   c                    t          |dd          | _        t          |ddg          | _        t          |dd          | _        d|v r|                    d          | _        t                      | _        | j        rCdd	lm	} |
                                D ](\  }}|| j        vr| j                            |           )t          j        | fi | d S )
NfuncnamehighlightingTdisabledmodulesunknownrP   Fr   r   )MODULES)r   r   r   r   rP   popset
_functionspygments.lexers._php_builtinsr   itemsupdater   rQ   )rR   rS   r   keyvalues        rL   rQ   zPhpLexer.__init__  s    $0+T%3 %3!+& 5  5'FF W$$&{{>::D %%$ 	2======%mmoo 2 2
Ud222O**5111D,,G,,,,,rK   c              #      K   dg}| j         r|                    d           t          j        | ||          D ]6\  }}}|t          j        u r|| j        v r|t          j        |fV  /|||fV  7d S )Nr/   rj   )rP   r[   r   r_   r   r   r   rD   )rR   rb   stackindextokenr   s         rL   r_   zPhpLexer.get_tokens_unprocessed-  s       	 LL1$eDD	& 	&E5%
""DO++u4444%%%%%	& 	&rK   c                 b    t          | d          rdS d}t          j        d|           r|dz  }|S )Nrj   Tg        z
<\?(?!xml)g333333?)r   r:   search)rb   rvs     rL   analyse_textzPhpLexer.analyse_text9  s@    4(( 	49]D)) 	#IB	rK   N)7r0   r1   r2   r3   r4   r5   r6   r7   	mimetypes_ident_inner_ident_nonsr:   
IGNORECASEr;   r<   r=   r   Preprocr   r   r   	Delimiterr   r   r>   r?   Docr   r   	Attributer   rC   r   Variabler   rE   OctrF   rG   BinBacktickrH   r
   FunctionMagicClassr   EscapeInterpolr   r	   rI   rQ   r_   r   rJ   rK   rL   r   r      s        @ D
 C---G000II HL@KMBI%4E 7?E2u5M

1
W_f-1
,/MMXfff&6@P!4) )*1

 TN1
 '1
 (1
 )*1
 VZ(1
 7,-1
 +c1Xhdn5571
 $X.1
  H!1
" {+#1
$ hhw55{C%1
& &xx'>'>?'1
( )XgtXt44nF)1
, ,s2XgtT]335-1
0
! #*
+11
F $W%56G1
H G$%%I1
J ,&.>K1
L l"DM2M1
N 4:&O1
P 3FLAQ1
R  .S1
T $U1
V VZ(W1
X V^$Y1
Z $[1
\ +FM:]1
^ +FO<_1
` 6=(+a1
h U : CHI I I ] 	"
 U =    ]	
 4:v.
 GL!!4=&1GFOO
 6=&)6=)7G[ ?2[@4G_#XfouuT'E'E'Eo' '(  XfouuT'E'E'Eo' '(  Xfot}foFFH&
a` `FD- - -(
& 
& 
&    rK   r   ) r3   r:   pygments.lexerr   r   r   r   r   r   r	   r
   r   r   pygments.tokenr   r   r   r   r   r   r   r   r   r   pygments.utilr   r   r   __all__r   r   r   rJ   rK   rL   <module>r      s    
			/ / / / / / / / / / / / / / / / / / / / / / / /( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( E E E E E E E E E E
:
:
:? ? ? ? ?* ? ? ?D.O .O .O .O .O .O .O .Obv v v v vz v v v v vrK   