ó
xiù\c           @   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 d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d S(
   sÐ   
    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.
iÿÿÿÿN(   t
   RegexLexert   includet   bygroupst   defaultt   usingt   thist   words(	   t   Textt   Commentt   Operatort   Keywordt   Namet   Stringt   Numbert   Punctuationt   Other(   t   get_bool_optt   get_list_optt	   iteritemst   shebang_matchest   ZephirLexert   PhpLexerc           B   s„  e  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
 BZ i d e f d e j f d e j f g d 6e d ƒ d e j d f e d ƒ g d 6d e d f g d 6d 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# 6Z" RS($   sÃ   
    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
    t   Zephirt   zephirs   *.zept   fetcht   echot   issett   emptyt   bitt   bitst   strings   \s+s   //.*?\ns	   /\*.*?\*/t   commentsandwhitespaces3   /(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)s   #popt   slashstartsregexs   \nt   badregexs   ^(?=\s|/|<!--)sC   \+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|->|[-<>+*%&|^/])=?s   [{(\[;,]s   [})\].]sá   (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)\bs   (var|let|with|function)\bsð   (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)\bs   (true|false|null|undefined)\bsm   (Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|_GET|_POST|_SERVER|this|stdClass|range|count|iterator|window)\bs   [$a-zA-Z_][\w\\]*s%   [0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?s   0x[0-9a-fA-F]+s   [0-9]+s   "(\\\\|\\"|[^"])*"s   '(\\\\|\\'|[^'])*'t   root(#   t   __name__t
   __module__t   __doc__t   namet   aliasest	   filenamest   zephir_keywordst   zephir_typet   ret   DOTALLt	   MULTILINEt   flagsR   R   t   Singlet	   MultilineR   R   t   RegexR   R	   R   R
   t   Declarationt   Reservedt   ConstantR   t   BuiltinR   R   t   Floatt   Hext   Integert   Doublet   tokens(    (    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyR      sH   										c        "   B   sç  e  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 Be j BZ i d e j d f d e f d e f g d 6d 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 d0 e" j% f d1 e" j& f d2 e" j' f d3 e j f d4 e j( f d5 e j) d6 f g d 6e* d^ dF dG ƒe j+ j, f g dH 6e* d_ dF dG ƒe j f g d) 6e
 e j- d f g d" 6e  dH ƒ e
 e j+ d f e. d ƒ g d% 6d5 e j) d f dQ e j) f dR e j/ f dS e
 dT e
 dU e j0 f dV e e j0 e1 e2 dW e3 ƒe j0 ƒ f dX e e j0 e1 e2 dW e3 ƒe j0 ƒ f dY e e j0 e j! e j0 ƒ f dZ e j) f g d6 6Z4 d[ „  Z5 d\ „  Z6 d] „  Z7 RS(`   sT  
    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.
    t   PHPt   phpt   php3t   php4t   php5s   *.phps
   *.php[345]s   *.incs
   text/x-phps   [\\\w]|[^\x00-\x7f]s   (?:[\\_a-z]|[^\x00-\x7f])s   (?:s   )*s	   <\?(php)?s   [^<]+t   <R"   s   \?>s   #pops   (<<<)([\'"]?)(s   )(\2\n.*?\n\s*)(\3)(;?)(\n)s   \s+s   #.*?\ns   //.*?\ns   /\*\*/s   /\*\*.*?\*/s	   /\*.*?\*/s   (->|::)(\s*)(t   )s   [~!%^&*+=|:.<>/@-]+s   \?s   [\[\]{}();,]+s   (class)(\s+)t	   classnames   (function)(\s*)(?=\()s   (function)(\s+)(&?)(\s*)t   functionnames   (const)(\s+)(s  (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)\bs   (true|false|null)\bt   magicconstantss   \$\{\$+s   \}s   \$+s"   (\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?s   \d+e[+-]?[0-9]+s   0[0-7]+s   0x[a-f0-9]+s   \d+s   0b[01]+s   '([^'\\]*(?:\\.[^'\\]*)*)'s   `([^`\\]*(?:\\.[^`\\]*)*)`t   "R   t   __constructt
   __destructt   __callt   __callStatict   __gett   __sett   __issett   __unsett   __sleept   __wakeupt
   __toStringt   __invoket   __set_statet   __clonet   __debugInfot   suffixs   \bt
   magicfuncst   __LINE__t   __FILE__t   __DIR__t   __FUNCTION__t	   __CLASS__t	   __TRAIT__t
   __METHOD__t   __NAMESPACE__s	   [^{$"\\]+s'   \\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})s   \$s   (\[\S+?\]|->s   )?s   (\{\$\{)(.*?)(\}\})t   _startinlines   (\{)(\$.*?)(\})s   (\$\{)(\S+)(\})s   [${\\]c         K   sÞ   t  | d t ƒ |  _ t | d d g ƒ |  _ t  | d t ƒ |  _ d | k rc | j d ƒ |  _ n  t ƒ  |  _	 |  j rÊ d d l
 m } x? t | ƒ D]. \ } } | |  j k r• |  j	 j | ƒ q• q• Wn  t j |  |  d  S(   Nt   funcnamehighlightingt   disabledmodulest   unknownt   startinlineR_   iÿÿÿÿ(   t   MODULES(   R   t   TrueR`   R   Ra   t   FalseRc   t   popt   sett
   _functionst   pygments.lexers._php_builtinsRd   R   t   updateR    t   __init__(   t   selft   optionsRd   t   keyt   value(    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyRl   è   s    	c         c   s•   d g } |  j  r" | j d ƒ n  xl t j |  | | ƒ D]U \ } } } | t j k r | |  j k r | t j | f Vq8 q n  | | | f Vq8 Wd  S(   NR"   R<   (   Rc   t   appendR    t   get_tokens_unprocessedR   R   Ri   R5   (   Rm   t   textt   stackt   indext   tokenRp   (    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyRr   ü   s    		"	c         C   s<   t  |  d ƒ r t Sd } t j d |  ƒ r8 | d 7} n  | S(   NR<   g        s
   <\?(?!xml)g333333Ó?(   R   Re   R+   t   search(   Rs   t   rv(    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyt   analyse_text  s    (   RF   RG   RH   RI   RJ   RK   RL   RM   RN   RO   RP   RQ   RR   RS   RT   (   RW   RX   RY   RZ   R[   R\   R]   R^   (8   R#   R$   R%   R&   R'   R(   t	   mimetypest   _ident_chart   _ident_begint
   _ident_endt   _ident_innerR+   t
   IGNORECASER,   R-   R.   R   t   PreprocR   R   R   t	   DelimiterR   R   R/   R0   t   DocR	   R   t	   AttributeR
   R4   R   t   VariableR   R6   t   OctR7   R8   t   Bint   BacktickR9   R   t   Functiont   Magict   ClassR   t   Escapet   InterpolR   R   Re   R:   Rl   Rr   Ry   (    (    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyR   X   s¤   	
					
	   				(   R%   R+   t   pygments.lexerR    R   R   R   R   R   R   t   pygments.tokenR   R   R	   R
   R   R   R   R   R   t   pygments.utilR   R   R   R   t   __all__R   R   (    (    (    s2   lib/python2.7/site-packages/pygments/lexers/php.pyt   <module>
   s   4@"@