ó
l2RTc        
   @   sè  d  Z  d d l Z d d l m Z m Z d d l m Z d d l 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 m Z m Z m Z m Z m Z m Z d d l m Z m  Z  d	 d
 d d d d d d d d g
 Z! d	 e
 f d „  ƒ  YZ" d
 e
 f d „  ƒ  YZ# d e
 f d „  ƒ  YZ$ d e
 f d „  ƒ  YZ% d e
 f d „  ƒ  YZ& d e
 f d „  ƒ  YZ' d e' f d „  ƒ  YZ( d e f d „  ƒ  YZ) d e f d „  ƒ  YZ* d e f d „  ƒ  YZ+ d S(   sÖ   
    pygments.lexers.markup
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for non-HTML markup languages.

    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iÿÿÿÿN(   t	   HtmlLexert   XmlLexer(   t   JavascriptLexer(   t   CssLexer(	   t
   RegexLexert   DelegatingLexert   includet   bygroupst   usingt   thist   do_insertionst   defaultt   words(
   t   Textt   Commentt   Operatort   Keywordt   Namet   Stringt   Numbert   Punctuationt   Generict   Other(   t   get_bool_optt   ClassNotFoundt   BBCodeLexert   MoinWikiLexert   RstLexert   TexLexert
   GroffLexert   MozPreprocHashLexert   MozPreprocPercentLexert   MozPreprocXulLexert   MozPreprocJavascriptLexert   MozPreprocCssLexerc           B   s—   e  Z d  Z d Z d g Z d g Z i d e f d e d f d e f g d 6d	 e f d
 e e	 j
 e e ƒ f d e e e ƒ f d e d f g d 6Z RS(   sR   
    A lexer that highlights BBCode(-like) syntax.

    .. versionadded:: 0.6
    t   BBCodet   bbcodes   text/x-bbcodes   [^[]+s   \[/?\w+t   tags   \[t   roots   \s+s   (\w+)(=)("?[^\s"\]]+"?)s   (=)("?[^\s"\]]+"?)s   \]s   #pop(   t   __name__t
   __module__t   __doc__t   namet   aliasest	   mimetypesR   R   R   R   t	   AttributeR   R   t   tokens(    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR      s   				c           B   s[  e  Z d  Z d Z d d g Z g  Z d g Z e j e j	 BZ
 i d e f d e e e ƒ f d e e j e e ƒ e j e ƒ f d e e j e j ƒ d	 f d
 e f d e e e j e ƒ f d e e e j e ƒ f d e f d e e e e ƒ f d e f d e f d e f d e f g d 6d e j d f d e d f d e j f d e j f g d	 6Z RS(   sI   
    For MoinMoin (and Trac) Wiki markup.

    .. versionadded:: 0.7
    s   MoinMoin/Trac Wiki markups	   trac-wikit   moins   text/x-trac-wikis   ^#.*$s   (!)(\S+)s   ^(=+)([^=]+)(=+)(\s*#.+)?$s   (\{\{\{)(\n#!.+)?t	   codeblocks   (\'\'\'?|\|\||`|__|~~|\^|,,|::)s   ^( +)([.*-])( )s   ^( +)([a-z]{1,5}\.)( )s   \[\[\w+.*?\]\]s   (\[[^\s\]]+)(\s+[^\]]+?)?(\])s   ^----+$s   [^\n\'\[{!_~^,|]+s   \nt   .R&   s   \}\}\}s   #pops   \{\{\{s   #pushs   [^{}]+(   R'   R(   R)   R*   R+   t	   filenamesR,   t   ret	   MULTILINEt
   IGNORECASEt   flagsR   R   R   R   R   t   HeadingR   R	   R   R   t   Builtint	   Namespacet   PreprocR.   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR   ?   s4   		!					c           B   sÊ  e  Z d  Z d Z d d d g Z d d g Z d d g Z e j Z	 d	 „  Z
 d
 Z d Z d e j e ƒ e j e ƒ f Z i d e e j e e j e e j e ƒ f d e e j e e j e ƒ f d e e e e e d d ƒƒ f d e e e e e d d ƒƒ f d e e e e e d d ƒƒ f d e e e e e d d ƒƒ f d e e e e e d d ƒƒ f d e e e e e d d ƒƒ f d e
 f d e e e e j e e e e d d ƒƒ f d e e e e j e e d d ƒƒ f d e e e e j e e d d ƒƒ f d e e e e j e e j e e e e d d ƒƒ f d e j f d e e e j e ƒ f d e e e j e e j ƒ f d e e e d d ƒe e d d ƒƒ f d  e e j  e e e e e ƒ f e! d ƒ g d! 6d" e f d# e d$ f d% e e e j" e ƒ f d& e f d' e e j# e j$ ƒ f d( e e j$ e j# ƒ f d) e j% f d* e j& f d+ e f d, e j f d- e f d. e f g d 6d/ e f d# e e d0 f d1 e f g d$ 6Z' d2 „  Z( d3 „  Z) RS(4   s“  
    For `reStructuredText <http://docutils.sf.net/rst.html>`_ markup.

    .. versionadded:: 0.7

    Additional options accepted:

    `handlecodeblocks`
        Highlight the contents of ``.. sourcecode:: language``,
        ``.. code:: language`` and ``.. code-block:: language``
        directives with a lexer for the given language (default:
        ``True``).

        .. versionadded:: 0.8
    t   reStructuredTextt   rstt   restt   restructuredtexts   *.rsts   *.rests
   text/x-rsts   text/prs.fallenstein.rstc         c   sU  d d l  m } | j d ƒ t | j d ƒ f V| j d ƒ t | j d ƒ f V| j d ƒ t j | j d ƒ f V| j d ƒ t | j d ƒ f V| j d ƒ t | j d ƒ f V| j d ƒ t | j d ƒ f V| j d	 ƒ t | j d	 ƒ f Vd  } |  j
 r8y | | j d ƒ j ƒ  ƒ } Wq8t k
 r4q8Xn  | j d
 ƒ } t | ƒ } | | j d ƒ | j d ƒ | j d ƒ } | d  k r§| j d
 ƒ t | f Vd  Sg  } | j t ƒ } d } xd | D]\ }	 t |	 ƒ | k r| j t | ƒ d t |	 |  f g f ƒ | |	 | 7} qÉ| |	 7} qÉWx% t | | j | ƒ ƒ D] }
 |
 VqBWd  S(   Niÿÿÿÿ(   t   get_lexer_by_namei   i   i   i   i   i   i   i   i	   i
   i   t    i    (   t   pygments.lexersR?   t   startR   t   groupR   R   t   WordR   t   Nonet   handlecodeblockst   stripR   t   lenR   t
   splitlinest   Truet   appendR
   t   get_tokens_unprocessed(   t   selft   matchR?   t   lexert	   indentiont   indention_sizet   codet   inst	   codelinest   linet   item(    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyt   _handle_sourcecode‚   s<      #    	-)u   '")]}>â€™â€Â»!?u   â€â€‘â€’â€“â€”Â s   ((?=$)|(?=[-/:.,; \n\x00%s%s]))sH   ^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)(.+)(\n)(\1)(\n)sc   ^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)s!   ^(\s*)([-*+])( .+\n(?:\1  .+\n)*)t   statet   inlines1   ^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1  .+\n)*)s4   ^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1  .+\n)*)s$   ^(\s*)([A-Z]+\.)( .+\n(?:\1  .+\n)+)s*   ^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1  .+\n)+)s   ^(\s*)(\|)( .+\n(?:\|  .+\n)*)sl   ^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)s,   ^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))s'   ^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$s   ^( *\.\.)(\s*)(\[.+\])(.*?)$s9   ^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))s   ^ *\.\..*(\n( +.*\n|\n)+)?s   ^( *)(:[a-zA-Z-]+:)(\s*)$s   ^( *)(:.*?:)([ \t]+)(.*?)$s!   ^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)s2   (::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*|)\n)+)R&   s   \\.s   ``t   literals   (`.+?)(<.+?>)(`__?)s   `.+?`__?s   (`.+?`)(:[a-zA-Z0-9:-]+?:)?s   (:[a-zA-Z0-9:-]+?:)(`.+?`)s   \*\*.+?\*\*s   \*.+?\*s   \[.*?\]_s   <.+?>s   [^\\\n\[*`:]+R1   s   [^`]+s   #popt   `c         K   s)   t  | d t ƒ |  _ t j |  |  d  S(   NRF   (   R   RJ   RF   R   t   __init__(   RM   t   options(    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR\     s    c         C   s¤   |  d  d k r' |  d d !d k r' d S|  j  d ƒ } |  j  d | d ƒ } | d k r  | d d | k r  |  | d d	 k r  |  | d |  | d k r  d
 Sd  S(   Ni   s   ..i   R1   g333333Ó?s   
i   iÿÿÿÿs   -=g      à?(   t   find(   t   textt   p1t   p2(    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyt   analyse_text	  s    #(*   R'   R(   R)   R*   R+   R2   R,   R3   R4   R6   RW   t   closerst   unicode_delimiterst   escapet   end_string_suffixR   R   R7   R   R   R   R	   R   R   RD   R   t   TagR   R:   t   Classt   FunctionR   t   EscapeR   t   Interpolt   VariableR-   t   Strongt   EmphR.   R\   Rb   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR   l   sŽ   		*$$'						c        
   B   s‘  e  Z d  Z d Z d d g Z d d d g Z d d g Z i d	 e f d
 e j	 f d e j	 f g d 6d e
 j d f d e
 d f d e
 j d f d e
 d f d e d f d e f e d ƒ d e f g d 6d e j f e d ƒ d e f d e f d e j	 f g d 6d e
 d f d e
 d f e d ƒ g d 6d e
 d f d e
 d f d e j	 f e d ƒ g d 6d e j f d  e f e d ƒ g d 6Z d! „  Z RS("   s<   
    Lexer for the TeX and LaTeX typesetting languages.
    t   TeXt   text   latexs   *.texs   *.auxs   *.tocs
   text/x-texs   text/x-latexs   %.*?\ns   [{}]s   [&_^]t   generals   \\\[t   displaymaths   \\\(t
   inlinemaths   \$\$s   \$s   \\([a-zA-Z]+|.)t   commands   \\$s   [^\\$%&_^{}]+R&   s   [0-9]+s   [-=!+*/()\[\]]s   [^=!+*/()\[\]\\$%&_^{}0-9-]+t   maths   \\\)s   #pops   \\\]s   \[.*?\]s   \*c         C   s/   x( d D]  } |  t  | ƒ  | k r t Sq Wd  S(   Ns   \documentclasss   \inputs   \documentstyles   \relax(   s   \documentclasss   \inputs   \documentstyles   \relax(   RH   RJ   (   R_   RB   (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyRb   H  s    
(   R'   R(   R)   R*   R+   R2   R,   R   R   R8   R   t   BacktickR   R   R   Rl   R   R   R-   R   R.   Rb   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR     sB   							c        	   B   s;  e  Z d  Z d Z d d d g Z d d g Z d d g Z i d	 e e e	 ƒ d
 f d e
 d
 f d e d f e d ƒ g d 6e d ƒ d e f d e d f g d 6d e f d e j f d e j f d e j f d e j f d e d
 f g d 6d e d f e d ƒ d e j f d e f d e f d e f g d
 6Z d „  Z RS(   s¡   
    Lexer for the (g)roff typesetting language, supporting groff
    extensions. Mainly useful for highlighting manpage sources.

    .. versionadded:: 0.6
    t   Grofft   grofft   nrofft   mans   *.[1234567]s   *.mans   application/x-troffs
   text/troffs	   (\.)(\w+)t   requests   \.s   [^\\\n]+t   textlineR&   t   escapess   \ns   #pops	   \\"[^\n]*s   \\[fn]\ws   \\\(.{2}s	   \\.\[.*\]s   \\.s   \\\ns	   "[^\n"]+"s   \d+s   \S+s   \s+c         C   sg   |  d  d k r t  S|  d  d k r( t S|  d  d k r< t S|  d d !j ƒ  rc |  d j ƒ  rc d Sd  S(   Ni   R1   i   s   .\"i   s   .TH gÍÌÌÌÌÌì?(   t   FalseRJ   t   isalnumt   isspace(   R_   (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyRb   |  s    #(   R'   R(   R)   R*   R+   R2   R,   R   R   R   R   R   R   R   R   Rj   t   DoubleR   R.   Rb   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR   O  s4   						c           B   sþ   e  Z d  Z d Z e g Z g  Z g  Z i d e j d( f d e	 f g d 6d e
 e j e ƒ d f e d) ƒ e j d f g d 6e d* ƒ e f d e
 e e ƒ f d  e f d! e j f d" e j f d# e j f d$ e f d% e d f d& e f d' e f g
 d 6Z RS(+   s†   
    Lexer for Mozilla Preprocessor files (with '#' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    t   mozhashpreprocs   ^#t   exprt	   exprstarts   .+R&   s   (literal)(.*)s   #pop:2t   definet   undeft   ift   ifdeft   ifndeft   elset   elift   elifdeft   elifndeft   endift   expandt   filtert   unfilterR   t   includesubstt   errors   #popt   !s   !=s   ==s   &&s   ||s   (defined)(\()s   \)s   [0-9]+s   __\w+?__s   @\w+?@s   \w+s   \ns   \s+s   \S(   R„   R…   (   R†   R‡   Rˆ   R‰   RŠ   s   elseRŒ   R   RŽ   R   s   expands   filterR’   s   includeR“   s   error(   R•   s   !=s   ==s   &&s   ||(   R'   R(   R)   R*   R+   R2   R,   R   R:   R   R   R   R   R   R   R   R   t   DecimalR   Rl   Rh   R.   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR   ‡  s0   	  			c           B   sN   e  Z d  Z d Z e g Z g  Z g  Z i d e j d f d e	 f g d 6Z
 RS(   s†   
    Lexer for Mozilla Preprocessor files (with '%' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    t   mozpercentpreprocs   ^%R„   R…   s   .+R&   (   s   exprs	   exprstart(   R'   R(   R)   R*   R+   R2   R,   R   R:   R   R.   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR   °  s   	c           B   s5   e  Z d  Z d Z d g Z d g Z g  Z d „  Z RS(   s€   
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `XmlLexer`.

    .. versionadded:: 2.0
    s   XUL+mozpreprocs   xul+mozpreprocs   *.xul.inc         K   s    t  t |  ƒ j t t |  d  S(   N(   t   superR    R\   R   R   (   RM   R]   (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR\   Ñ  s    (   R'   R(   R)   R*   R+   R2   R,   R\   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR    Å  s   		c           B   s5   e  Z d  Z d Z d g Z d g Z g  Z d „  Z RS(   s‡   
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `JavascriptLexer`.

    .. versionadded:: 2.0
    s   Javascript+mozpreprocs   javascript+mozpreprocs   *.js.inc         K   s    t  t |  ƒ j t t |  d  S(   N(   R˜   R!   R\   R   R   (   RM   R]   (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR\   â  s    (   R'   R(   R)   R*   R+   R2   R,   R\   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR!   Ö  s   		c           B   s5   e  Z d  Z d Z d g Z d g Z g  Z d „  Z RS(   s€   
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `CssLexer`.

    .. versionadded:: 2.0
    s   CSS+mozpreprocs   css+mozpreprocs   *.css.inc         K   s    t  t |  ƒ j t t |  d  S(   N(   R˜   R"   R\   R   R   (   RM   R]   (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR\   ó  s    (   R'   R(   R)   R*   R+   R2   R,   R\   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyR"   ç  s   		(,   R)   R3   t   pygments.lexers.htmlR    R   t   pygments.lexers.javascriptR   t   pygments.lexers.cssR   t   pygments.lexerR   R   R   R   R   R	   R
   R   R   t   pygments.tokenR   R   R   R   R   R   R   R   R   R   t   pygments.utilR   R   t   __all__R   R   R   R   R   R   R   R    R!   R"   (    (    (    s:   /usr/lib/python2.7/dist-packages/pygments/lexers/markup.pyt   <module>
   s*   @F	!-©:8)