ó
ś%^Tc           @   sŘ   d  Z  d d l Z d d l 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 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-2014 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
i˙˙˙˙N(   t
   RegexLexert   includet   bygroupst   defaultt   usingt   this(	   t   Textt   Commentt   Operatort   Keywordt   Namet   Stringt   Numbert   Punctuationt   Other(   t   get_bool_optt   get_list_optt	   iteritemst   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(    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyR      sH   										c        !   B   sm  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 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 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 d/ e  j# f d0 e  j$ f d1 e  j% f d2 e j f d3 e j& f d4 e j' d5 f g d 6e
 e j( d f g d" 6e
 e j) d f g d% 6d4 e j' d f d6 e j' f d7 e j* f d8 e
 d9 e
 d: e j+ f d; e e j+ e, e- d< e. e j+  f d= e e j+ e, e- d< e. e j+  f d> e e j+ e j e j+  f d? e j' f g d5 6Z/ d@   Z0 dA   Z1 dB   Z2 RS(C   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   )\1\n.*?\n\s*\2;?\ns   \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+)(s2  (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|__FILE__|endif|list|__LINE__|endswitch|new|__sleep|endwhile|not|array|__wakeup|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)\bs   \$\{\$+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   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   startinlineRC   i˙˙˙˙(   t   MODULES(   R   t   TrueRD   R   RE   t   FalseRG   t   popt   sett
   _functionst   pygments.lexers._php_builtinsRH   R   t   updateR    t   __init__(   t   selft   optionsRH   t   keyt   value(    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyRP   Ń   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:   (   RG   t   appendR    t   get_tokens_unprocessedR
   R   RM   R3   (   RQ   t   textt   stackt   indext   tokenRT   (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyRV   ĺ   s    		"	c         C   s)   d } t  j d |   r% | d 7} n  | S(   Ng        s
   <\?(?!xml)g333333Ó?(   R)   t   search(   RW   t   rv(    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyt   analyse_textń   s    (3   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   R-   R.   t   DocR   R   R
   t	   AttributeR   R	   R2   t   VariableR   R4   t   OctR5   R6   t   Bint   BacktickR7   t   Classt   Functiont   Escapet   InterpolR   R   RI   R8   RP   RV   R]   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyR   V   s   	
					
			(   R#   R)   t   pygments.lexerR    R   R   R   R   R   t   pygments.tokenR   R   R   R	   R
   R   R   R   R   t   pygments.utilR   R   R   t   __all__R   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/php.pyt   <module>
   s   .@@