
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	 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-2019 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 d e j f g
 d 6d e e j e  d f d e e j e j e j 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 d5 d6 e f d7 e j f e d d5 d6 e j f d? e j f e d dU dV d5 d6 e j f dW e j f dX e e j e
 e  f dY e f g dZ 6e d  d[ e e e	  e j  e e	  e e	  e  d\ f d] e e e	  e j  e e	  e e	  e  f e! d^  g d_ 6e d  e dZ  d` e f da e db f g d^ 6e d  e dZ  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 dk e e j e
 e j#  f dl e j f dm e j f dn e j db f do e j f dp e j f d
 e j db f g d 6dq e j dd f dr e j db f ds e j db f dt e f g d 6Z$ e% d  Z& e% d  Z' e% d  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|[\w\W]*?[^\\]\n)s   /(\\\n)?[*][\w\W]*?[*](\\\n)?/s   /(\\\n)?[*][\w\W]*t
   whitespaces   (L?)(")t   strings:   (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   asmt   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   \bs>   (bool|int|long|float|short|double|char|unsigned|signed|void)\bt   inlinet   _inlinet   __inlinet   nakedt   restrictt   threadt   typenames   (__m(128i|128d|128|64))\bt   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
   statementssB   ((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)t   functions@   ((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)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
   (include)(s	   )([^\n]+)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_tt	   clockid_tt	   cpu_set_tt	   cpumask_tt   dev_tt   gid_tt   id_tt   ino_tt   key_tt   mode_tt   nfds_tt   pid_tt   rlim_tt   sig_tt   sighandler_tt	   siginfo_tt   sigset_tt   sigval_tt	   socklen_tt   timer_tt   uid_tc         K   sS   t  | d t  |  _ t  | d t  |  _ t  | d t  |  _ t j |  |  d  S(   Nt   stdlibhighlightingt   c99highlightingt   platformhighlighting(   R   t   TrueR   R   R   R    t   __init__(   t   selft   options(    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyR      s    c         c   s   x t  j |  |  D] \ } } } | t k r |  j rR | |  j k rR t j } q |  j rv | |  j k rv t j } q |  j	 r | |  j
 k r t j } q n  | | | f Vq Wd  S(   N(   R    t   get_tokens_unprocessedR   R   t   stdlib_typesR   t   TypeR   t	   c99_typesR   t   linux_types(   R   t   textt   indext   tokent   value(    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyR      s    (   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   R+   R,   R-   R.   R/   R0   (   R2   R3   R4   R5   R6   R7   R8   (   R   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   (   RW   RX   RY   RF   RZ   R[   R\   R]   R^   R_   R`   Ra   Rb   Rc   Rd   Re   Rf   Rg   Rh   (   Ri   Rj   Rk   Rl   Rm   Rn   Ro   Rp   Rq   Rr   Rs   Rt   Ru   Rv   Rw   Rx   Ry   Rz   R{   R|   R}   R~   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (+   t   __name__t
   __module__t   __doc__t   _wst   _ws1R
   t   PreprocR   R   R   R	   t   Singlet	   MultilineR   t   Affixt   CharR   t   Floatt   Hext   Octt   IntegerR   R   R   R   R   R   t   ReservedR   t   Builtint   LabelR   t   FunctionR   t   Escapet   PreprocFilet   tokenst   setR   R   R   R   R   (    (    (    s4   lib/python2.7/site-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*#ifn?def (   t   ret   searcht	   MULTILINE(   R   (    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyt   analyse_text   s    (	   R   R   R   t   namet   aliasest	   filenamest	   mimetypest   priorityR   (    (    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyR      s   	c        &   B   sF  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 dO d7 d8 e	 f d9 e	 j
 f d: e e	 e  d; f d< e e j e e j e j e e j e  f d= e e j e  d> f e g d? 6e e dP dG dH d7 d8 e	 j f dI e	 j f g dJ 6dK e j dL f dM e dL f g d; 6Z dN   Z RS(Q   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?t   catcht
   const_castt   deletet   dynamic_castt   explicitt   exportt   friendt   mutablet	   namespacet   newt   operatort   privatet	   protectedt   publict   reinterpret_castR6   t   static_castt   templateR   t   throwt   throwsRD   t   typeidR8   R   t   virtualt	   constexprt   nullptrt   decltypet   thread_localt   alignast   alignoft   static_assertt   noexceptt   overridet   finalR1   s   \bs   char(16_t|32_t)\bs   (class)(\s+)t	   classnames/   (R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")s   (u8|u|U)(")R   RP   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   (    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyR      s    ($   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R6   R   R   R   R   R   RD   R   R8   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   R   R   R   R   R   R	   R   R   t	   DelimiterR   R   t   PseudoR   t   ClassR   R   (    (    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyR      sB          
(   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   (    (    (    s4   lib/python2.7/site-packages/pygments/lexers/c_cpp.pyt   <module>
   s   :@