
T_Tc           @   s   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
 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 g Z d e f d	     YZ d e f d
     YZ d e f d     YZ d S(   s   
    pygments.lexers.c_cpp
    ~~~~~~~~~~~~~~~~~~~~~

    Lexers for C/C++ languages.

    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iN(   t
   RegexLexert   includet   bygroupst   usingt   thist   inheritt   defaultt   words(   t   get_bool_opt(	   t   Textt   Commentt   Operatort   Keywordt   Namet   Stringt   Numbert   Punctuationt   Errort   CLexert   CppLexert   CFamilyLexerc        &   B   s;  e  Z d  Z d Z d Z i d e j d f d e j d f d e d e e e	  e j  d f d e d	 e e e	  e j  d f d
 e
 f d e
 f d e
 f d e j f d e j f g	 d 6d e 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 f d e f d e f e d d3 d4 e f d5 e j f e d d3 d4 e j f d= e j f e d dT dU d3 d4 e j f dV e j f dW e e j e
 e  f dX e f g dY 6e d  dZ e d[ e e e	  e j e e	  e e	  e  d\ f dZ e d] e e e	  e j e e	  e e	  e  f e  d^  g d_ 6e d  e dY  d` e f da e db f g d^ 6e d  e dY  da e f dc e dd f de e db f g d\ 6df e db f dg e j! f dh e f d e f di e f g d 6dj e j f dk e j f dl e j db f dm e j f dn e j f d
 e j db f g d 6do e j dd f dp e j db f dq e j db f dr e f g d 6Z" ds dt du dL dv dw dx dy dz d{ d| d} d~ d d d d d d g Z# d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d g Z$ d   Z% d   Z& RS(   sg   
    For C family source code.  This is used as a base class to avoid repetitious
    definitions.
    s   (?:\s|//.*?\n|/[*].*?[*]/)+s   \s*(?:/[*].*?[*]/\s*)*s   ^#if\s+0t   if0s   ^#t   macros   ^(s
   )(#if\s+0)s   )(#)s   \ns   \s+s   \\\ns   //(\n|(.|\n)*?[^\\]\n)s   /(\\\n)?[*](.|\n)*?[*](\\\n)?/t
   whitespaces   L?"t   strings4   L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'s'   (\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*s   (\d+\.\d*|\.\d+|\d+[fF])[fF]?s   0x[0-9a-fA-F]+[LlUu]*s   0[0-7]+[LlUu]*s
   \d+[LlUu]*s   \*/s   [~!%^&*+=|?:<>/-]s
   [()\[\],.]t   autot   breakt   caset   constt   continueR   t   dot   elset   enumt   externt   fort   gotot   ift   registert
   restrictedt   returnt   sizeoft   statict   structt   switcht   typedeft   uniont   volatilet   whilet   suffixs   \bsQ   (bool|int|long|float|short|double|char|unsigned|signed|void|[a-z_][a-z0-9_]*_t)\bt   inlinet   _inlinet   __inlinet   nakedt   restrictt   threadt   typenames   (__m(128i|128d|128|64))\bt   asmt   int8t   basedt   exceptt   int16t   stdcallt   cdeclt   fastcallt   int32t   declspect   finallyt   int64t   tryt   leavet   wchar_tt   w64t	   unalignedt   raiset   noopt
   identifiert   forceinlinet   assumet   prefixt   __s   (true|false|NULL)\bs   ([a-zA-Z_]\w*)(\s*)(:)(?!:)s   [a-zA-Z_]\w*t
   statementss7   ((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))(s   )?(\{)t   functions   )?(;)t	   statementt   roots   [{}]t   ;s   #pops   \{s   #pushs   \}t   "sO   \\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})s	   [^\\"\n]+s   \\s   [^/\n]+s   /[*](.|\n)*?[*]/s   //.*?\nt   /s	   (?<=\\)\ns   ^\s*#if.*?(?<!\\)\ns   ^\s*#el(?:se|if).*\ns   ^\s*#endif.*?(?<!\\)\ns   .*?\nt   size_tt   ssize_tt   off_tt	   ptrdiff_tt   sig_atomic_tt   fpos_tt   clock_tt   time_tt   va_listt   jmp_buft   FILEt   DIRt   div_tt   ldiv_tt	   mbstate_tt	   wctrans_tt   wint_tt   wctype_tt   _Boolt   _Complext   int8_tt   int16_tt   int32_tt   int64_tt   uint8_tt   uint16_tt   uint32_tt   uint64_tt   int_least8_tt   int_least16_tt   int_least32_tt   int_least64_tt   uint_least8_tt   uint_least16_tt   uint_least32_tt   uint_least64_tt   int_fast8_tt   int_fast16_tt   int_fast32_tt   int_fast64_tt   uint_fast8_tt   uint_fast16_tt   uint_fast32_tt   uint_fast64_tt   intptr_tt	   uintptr_tt   intmax_tt	   uintmax_tc         K   s>   t  | d t  |  _ t  | d t  |  _ t j |  |  d  S(   Nt   stdlibhighlightingt   c99highlighting(   R   t   TrueR   R   R    t   __init__(   t   selft   options(    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s    c         c   s   x t  j |  |  D]t \ } } } | t k ry |  j rR | |  j k rR t j } qy |  j ry | |  j k ry t j } qy n  | | | f Vq Wd  S(   N(	   R    t   get_tokens_unprocessedR   R   t   stdlib_typesR   t   TypeR   t	   c99_types(   R   t   textt   indext   tokent   value(    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s    (   R   R   R   R   R   s   defaultR   s   elseR    R!   R"   R#   R$   s   registerR&   R'   R(   R)   R*   R+   R,   s   unionR.   R/   (   R1   R2   R3   R4   R5   R6   R7   (   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   ('   t   __name__t
   __module__t   __doc__t   _wst   _ws1R
   t   PreprocR   R   R   R	   t   Singlet	   MultilineR   t   CharR   t   Floatt   Hext   Octt   IntegerR   R   R   R   R   R   t   ReservedR   t   Builtint   LabelR   t   FunctionR   t   Escapet   tokensR   R   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s   						  	   	$$														c           B   sG   e  Z d  Z d Z d g Z d d d g Z d d g Z d Z d	   Z RS(
   s9   
    For C source code with preprocessor directives.
    t   Ct   cs   *.cs   *.hs   *.idcs   text/x-chdrs   text/x-csrcg?c         C   s<   t  j d |  t  j  r d St  j d |  t  j  r8 d Sd  S(   Ns   ^\s*#include [<"]g?s   ^\s*#ifdef (   t   ret   searcht	   MULTILINE(   R   (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyt   analyse_text   s    (	   R   R   R   t   namet   aliasest	   filenamest	   mimetypest   priorityR   (    (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s   	c        &   B   s  e  Z d  Z d Z d d g Z d d d d d d	 d
 d d d d d g Z d d g Z d Z i e dL d7 d8 e	 f d9 e	 j
 f d: e e	 e  d; f e g d< 6e e dM dD dE d7 d8 e	 j f dF e	 j f g dG 6dH e j dI f dJ e dI f g d; 6Z dK   Z RS(N   s;   
    For C++ source code with preprocessor directives.
    s   C++t   cpps   c++s   *.cpps   *.hpps   *.c++s   *.h++s   *.ccs   *.hhs   *.cxxs   *.hxxs   *.Cs   *.Hs   *.cps   *.CPPs   text/x-c++hdrs   text/x-c++srcg?R8   t   catcht
   const_castt   deletet   dynamic_castt   explicitt   exportt   friendt   mutablet	   namespacet   newt   operatort   privatet	   protectedt   publict   reinterpret_castR5   t   static_castt   templateR   t   throwt   throwst   typeidR7   R   t   virtualt	   constexprt   nullptrt   decltypet   thread_localt   alignast   alignoft   static_assertt   noexceptt   overridet   finalR0   s   \bs   char(16_t|32_t)\bs   (class)(\s+)t	   classnameRP   t   virtual_inheritancet   uuidoft   supert   single_inheritancet   multiple_inheritancet	   interfacet   eventRN   RO   s#   __(offload|blockingoffload|outer)\bRS   s   [a-zA-Z_]\w*s   #pops   \s*(?=>)c         C   s0   t  j d |   r d St  j d |   r, d Sd  S(   Ns   #include <[a-z]+>g?s   using namespace g?(   R   R   (   R   (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s    ($   s   asmR   R   R   R   R   R   R   R   s	   namespaces   newR   R   R   R   R   s   restrictR   s   templates   thiss   throwR   R   s   typenames   usingR   R   R   R   R   R   R   R   R   R   s   final(   R   R   s   superR   R   R   R   (   R   R   R   R   R   R   R   R   R   R   R   R   R	   R   R   t   PseudoR   t   ClassR   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyR      s:          
(   R   R   t   pygments.lexerR    R   R   R   R   R   R   R   t   pygments.utilR   t   pygments.tokenR	   R
   R   R   R   R   R   R   R   t   __all__R   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/pygments/lexers/c_cpp.pyt   <module>
   s   :@