|e2dZddlZddlmZmZmZmZmZmZm Z m Z m Z m Z ddl mZmZmZmZmZmZmZmZmZmZddlmZmZmZgdZGddeZGd d eZGd d eZy) z pygments.lexers.php ~~~~~~~~~~~~~~~~~~~ Lexers for PHP and related languages. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N) Lexer RegexLexerincludebygroupsdefaultusingthiswords do_insertionsline_re) TextCommentOperatorKeywordNameStringNumber PunctuationOtherGeneric) get_bool_opt get_list_optshebang_matches) ZephirLexerPsyshConsoleLexerPhpLexerc0eZdZdZdZdZdgZdgZgdZgdZ e je jzZ defd ej fd ej"fged d ej(d fded fed gded fgdedfed dedfdedfdefdedfdej2dfdej4fdej6fdej:fdej<fdej@fdejBfdejDfdejFfdej fgd Z$y!)"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 Zephirzhttp://zephir-lang.com/zephirz*.zep)fetchechoissetempty)bitbitsstring\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]?z0x[0-9a-fA-F]+z[0-9]+z"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*')r*r-badregexrootN)%__name__ __module__ __qualname____doc__nameurlaliases filenameszephir_keywords zephir_typereDOTALL MULTILINEflagsr rSingle MultilinerrRegexrrrr DeclarationReservedConstantrBuiltinrrFloatHexIntegerDoubletokens5/usr/lib/python3/dist-packages/pygments/lexers/php.pyrrs D #CjG I9O+K II $ETN  ( 7,, -" + ,%||V 5 8V $ FO  D& ! 4!3 4 + ,45=?Q S +'9 :  %"#5 7*7+>+>@R S/180@0@ B.w/?/? @<< )"4:: . 5v|| D  +  ' (&-- 8 (&-- 83 !+FrKrc*eZdZdZdZdZdgZdZdZy)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/psyshc :d|d<tj|fi|y)NT startinline)r__init__)selfoptionss rLrQzPsyshConsoleLexer.__init__ks!%  t'w'rKc #Ktdi|j}d}g}tj|D]}|j }|j ds|j dr:|j t|dtj|ddfgf||ddz }p|jdk(r7|j t|dtjdfgf||ddz }|r't||j|Ed{d}g}|jtj|f|r$t||j|Ed{yy7U7w) Nz>>> z... rz...rJ)rrSr finditergroup startswithappendlenrPromptrstripr get_tokens_unprocessedstartOutput)rRtextphplexercurcode insertionsmatchlines rLr_z(PsyshConsoleLexer.get_tokens_unprocessedosn+dll+ %%d+ :E;;=Dv&$//&*A!!3w<%&Ra$A#B#DE48#%'!!3w<%&$>#?#AB48#,"H$C$CG$L NNN G!#JkkmW^^T99! :" $Z%-%D%DW%MO O O  N  Os%D E% E! AE%E#E%#E%N) r0r1r2r3r4r5r6rQr_rJrKrLrrXs%  +D CiG(OrKrceZdZdZdZdZgdZgdZdgZdZ dZ e je jze jzZd ej"d fd efd efggd ej"dfde zdzeeeej*eej*eefdefdedfdej0fdej0fdej2fdej4fdej2fde zdzeeeej:fdefdefdefdeeeefdeeed fd!eeefd"eeeeed#fd$e zdzeeeej>fd%efd&ej>fe d'd(ejBd)fd*e zejBfe ej$fd+e"jFfd,e"jFfd-e"jHfd.e"jJfd/e"jLfd0e"jNfd1ej0fd2ejPfd3ejRd4fd5ejBdfe d ge*d6d78ejVjXfge*d9d78ej>fge ejZdfge d:e ejVdfe.dgd3ejRdfd;ejRfdze zd?zej`fd@eej`e1e2dABej`fdCeej`e1e2dABej`fdDeej`ejBej`fdEejRfgdFedfdGedHfe ejffe d gdIedfe d gdJ Z4dKZ5dLZ6dMZ7yN)Ora; 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 ``>> 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. PHPzhttps://www.php.net/)phpphp3php4php5)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)?rjz[^<]+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|finally|match)\bz(true|false|null)\bmagicconstantsz\$\{variablevariablez\$+z"(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?z\d+e[+-]?[0-9]+z0[0-7]+z 0x[a-f0-9]+z\d+z0b[01]+z'([^'\\]*(?:\\.[^'\\]*)*)'z`([^`\\]*(?:\\.[^`\\]*)*)`"r&z\}) __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[${\\]z\]z\(attributeparamsz\)) r/rjrtrrsrqrrr&rorc t|dd|_t|ddg|_t|dd|_d|vr|j d|_t |_|jrHdd lm }|jD]/\}}||jvs|jj|1tj|fi|y) NfuncnamehighlightingTdisabledmodulesunknownrPFrr)MODULES)rrrrrPpopset _functionspygments.lexers._php_builtinsritemsupdaterrQ)rRrSrkeyvalues rLrQzPhpLexer.__init__)s$0 +T%3!+ &  5'F W $&{{>:D %  $ $ =%mmo 2 Ud222OO**51 2 D,G,rKc#Kdg}|jr|jdtj|||D]C\}}}|tj ur$||j vr|tj|f=|||fEyw)Nr/rj)rPr[rr_rrrrD)rRrbstackindextokenrs rLr_zPhpLexer.get_tokens_unprocessed=s    LL 11$eD & E5% "DOO+u44% %  &sA?BcZt|dryd}tjd|r|dz }|S)NrjTgz <\?(?!xml)g333333?)rr:search)rbrvs rL analyse_textzPhpLexer.analyse_textIs0 4 (  99]D ) #IB rKN)8r0r1r2r3r4r5r6r7 mimetypes _ident_inner _ident_nonsr: IGNORECASEr;r<r=rPreprocrrr Delimiterrr r>r?Docrr AttributerrCrVariablerrEOctrFrGBinBacktickrHr FunctionMagicClassrEscapeInterpolrr DecoratorrIrQr_rrJrKrLrrsH@ D C-G0IIHL@K MMBII % 4E7??E 2 u  5M 3 W__f -3  ,/M M fff&6&6@P@P!4) *3 TN 3 [+ . 3  '3  (3 )) *3 VZZ (3 7,, -3  +c 1 hdnn 5 73 $X .!3 "H #3 ${ +%3 &$XgtW%E F'3 (hw5{ C)3 *&x'> ?+3 ,) gtXt 4n F-3 0 ,s 2 gtT]] 3 513 4 !#* +53 J$W%5%5 6K3 L $ %M3 Ndmm%7 8O3 Pl "DMM 2Q3 R4:: &S3 T3FLL AU3 V  .W3 X $Y3 ZVZZ ([3 \V^^ $]3 ^ $_3 `+FMM :a3 b+FOO > * EN  K ( EN YpFd-( &rKr) r3r:pygments.lexerrrrrrrr r r r pygments.tokenr rrrrrrrrr pygments.utilrrr__all__rrrrJrKrLrsb ///(((EE :?*?D.O.ObFzFrK