ó
~i[Tc        	   @   s”  d  Z  d d l Z d d l m Z m Z m Z m Z m Z d d l 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 d	 d
 d d d d d g	 Z d e f d „  ƒ  YZ d „  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 S(   sÉ   
    pygments.lexers.asm
    ~~~~~~~~~~~~~~~~~~~

    Lexers for assembly languages.

    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iÿÿÿÿN(   t
   RegexLexert   includet   bygroupst   usingt   DelegatingLexer(   t   CppLexert   CLexer(   t   DLexer(	   t   Textt   Namet   Numbert   Stringt   Commentt   Punctuationt   Othert   Keywordt   Operatort   GasLexert   ObjdumpLexert   DObjdumpLexert   CppObjdumpLexert   CObjdumpLexert	   LlvmLexert	   NasmLexert   NasmObjdumpLexert	   Ca65Lexerc           B   s/  e  Z d  Z d Z d d g Z d d g Z d g Z d Z d Z d	 e d
 e d Z	 d Z
 i e d ƒ e	 d e j f d e	 e j d f d e j f e	 e j d f d e f g d 6e	 e j f e e f d e	 e j f e
 e j f d e d f d e d f e d ƒ e d ƒ g d 6d e	 d e e j e e e j e ƒ f d e	 d e
 d e e j e e e j e e j e ƒ f e	 e j f e
 e j f d e	 e j f d e
 e j f d e j f d e d f d e d f e d ƒ e d ƒ g d 6d e f d  e f d! e f g d 6d" e f g d 6Z d# „  Z RS($   s'   
    For Gas (AT&T) assembly code.
    t   GASt   gast   asms   *.ss   *.Ss
   text/x-gass   "(\\"|[^"])*"s   [\w$.@-]s   (?:[a-zA-Z$_]s   *|\.s   +)s   (?:0[xX][a-zA-Z0-9]+|\d+)t
   whitespacet   :s   \.s   directive-argss   lock|rep(n?z)?|data\d+s   instruction-argss   [\r\n]+t   roott   @s   #pops   #.*?$t   punctuations   ([a-z0-9]+)( )(<)(s   )(>)s   )([-+])(t   %t   $s
   $'(.|\\')'s   \ns   \s+s   #.*?\ns
   [-*,.():]+c         C   s<   t  j d |  t  j ƒ r t St  j d |  t  j ƒ r8 d Sd  S(   Ns   ^\.(text|data|section)s   ^\.\w+gš™™™™™¹?(   t   ret   matcht   Mt   True(   t   text(    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyt   analyse_text^   s    (   t   __name__t
   __module__t   __doc__t   namet   aliasest	   filenamest	   mimetypest   stringt   chart
   identifiert   numberR   R	   t   Labelt	   Attributet   FunctionR   t   ConstantR   R
   t   IntegerR   R   t   HexR   t   Variablet   Chart   tokensR)   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR      sX   								c         C   sÈ  d } i d t  t j t t t ƒ f d t  t t j t ƒ f d | d t  t j t t t j t t j t ƒ f d | d t  t j t t t j t ƒ f d | d | | d	 t  t t j t t j t t	 |  ƒ ƒ f d | d | | d
 t  t t j t t j t t ƒ f d | d | | d t  t t j t t j ƒ f d t f d | d | d t  t t j t t j
 t t j t t j ƒ f d | d t  t t j t t j
 t t j ƒ f d t f g d 6S(   s;   
    Common objdump lexer tokens to wrap an ASM lexer.
    s   [0-9A-Za-z]s   (.*?)(:)( +file format )(.*?)$s"   (Disassembly of section )(.*?)(:)$t   (s+   +)( )(<)(.*?)([-+])(0[xX][A-Za-z0-9]+)(>:)$s   +)( )(<)(.*?)(>:)$s   ( *)(s   +:)(\t)((?:s    )+)( *	)([a-zA-Z].*?)$s    )+)( *)(.*?)$s    )+)$s	   \t\.\.\.$s	   (\t\t\t)(s    +:)( )([^\t]+)(\t)(.*?)([-+])(0xs   +)$s   +:)( )([^\t]+)(\t)(.*?)$s   [^\n]+\nR   (   R   R	   R5   R   R   R   R
   R:   R7   R   t   PropertyR8   R   (   t	   asm_lexert   hex_re(    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyt   _objdump_lexer_tokense   s6    	!	c           B   s;   e  Z d  Z d Z d g Z d g Z d g Z e e ƒ Z	 RS(   s)   
    For the output of 'objdump -dr'
    t   objdumps	   *.objdumps   text/x-objdump(
   R*   R+   R,   R-   R.   R/   R0   RB   R   R=   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   –   s   			c           B   s8   e  Z d  Z d Z d g Z d g Z d g Z d „  Z RS(   s=   
    For the output of 'objdump -Sr on compiled D files'
    s	   d-objdumps   *.d-objdumps   text/x-d-objdumpc         K   s    t  t |  ƒ j t t |  d  S(   N(   t   superR   t   __init__R   R   (   t   selft   options(    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyRE   «   s    (   R*   R+   R,   R-   R.   R/   R0   RE   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   ¢   s   			c           B   sD   e  Z d  Z d Z d d d g Z d d d g Z d g Z d „  Z RS(	   s?   
    For the output of 'objdump -Sr on compiled C++ files'
    s   cpp-objdumps   c++-objdumbs   cxx-objdumps   *.cpp-objdumps   *.c++-objdumps   *.cxx-objdumps   text/x-cpp-objdumpc         K   s    t  t |  ƒ j t t |  d  S(   N(   RD   R   RE   R   R   (   RF   RG   (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyRE   ¸   s    (   R*   R+   R,   R-   R.   R/   R0   RE   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   ¯   s   	c           B   s8   e  Z d  Z d Z d g Z d g Z d g Z d „  Z RS(   s=   
    For the output of 'objdump -Sr on compiled C files'
    s	   c-objdumps   *.c-objdumps   text/x-c-objdumpc         K   s    t  t |  ƒ j t t |  d  S(   N(   RD   R   RE   R   R   (   RF   RG   (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyRE   Å   s    (   R*   R+   R,   R-   R.   R/   R0   RE   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   ¼   s   			c           B   sG  e  Z d  Z d Z d g Z d g Z d g Z d Z d e d Z i e	 d ƒ e d	 e
 j f e	 d
 ƒ d e e
 j f d e e
 j j f d e
 j j f d e
 j j f d e
 j j f d e e
 j f d e
 j j f d e e f d e f d e f d e f g d 6d e f d e f g d 6d e f d e j f d e f g d
 6Z RS(   s!   
    For LLVM assembly code.
    t   LLVMt   llvms   *.lls   text/x-llvms   "[^"]*?"s   ([-a-zA-Z$._][\w\-$.]*|t   )R   s   \s*:t   keywordR"   R    s   %\d+s   @\d+s   #\d+t   !s   !\d+s   c?s   0[xX][a-fA-F0-9]+s,   -?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?s   [=<>{}\[\]()*.,!]|x\bR   s   (\n|\s)+s   ;.*?\nsª  (begin|end|true|false|declare|define|global|constant|private|linker_private|internal|available_externally|linkonce|linkonce_odr|weak|weak_odr|appending|dllimport|dllexport|common|default|hidden|protected|extern_weak|external|thread_local|zeroinitializer|undef|null|to|tail|target|triple|datalayout|volatile|nuw|nsw|nnan|ninf|nsz|arcp|fast|exact|inbounds|align|addrspace|section|alias|module|asm|sideeffect|gc|dbg|linker_private_weak|attributes|blockaddress|initialexec|localdynamic|localexec|prefix|unnamed_addr|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc|arm_aapcscc|arm_aapcs_vfpcc|ptx_device|ptx_kernel|intel_ocl_bicc|msp430_intrcc|spir_func|spir_kernel|x86_64_sysvcc|x86_64_win64cc|x86_thiscallcc|cc|c|signext|zeroext|inreg|sret|nounwind|noreturn|noalias|nocapture|byval|nest|readnone|readonly|inlinehint|noinline|alwaysinline|optsize|ssp|sspreq|noredzone|noimplicitfloat|naked|builtin|cold|nobuiltin|noduplicate|nonlazybind|optnone|returns_twice|sanitize_address|sanitize_memory|sanitize_thread|sspstrong|uwtable|returned|type|opaque|eq|ne|slt|sgt|sle|sge|ult|ugt|ule|uge|oeq|one|olt|ogt|ole|oge|ord|uno|ueq|une|x|acq_rel|acquire|alignstack|atomic|catch|cleanup|filter|inteldialect|max|min|monotonic|nand|personality|release|seq_cst|singlethread|umax|umin|unordered|xchg|add|fadd|sub|fsub|mul|fmul|udiv|sdiv|fdiv|urem|srem|frem|shl|lshr|ashr|and|or|xor|icmp|fcmp|phi|call|trunc|zext|sext|fptrunc|fpext|uitofp|sitofp|fptoui|fptosi|inttoptr|ptrtoint|bitcast|select|va_arg|ret|br|switch|invoke|unwind|unreachable|indirectbr|landingpad|resume|malloc|alloca|free|load|store|getelementptr|extractelement|insertelement|shufflevector|getresult|extractvalue|insertvalue|atomicrmw|cmpxchg|fence)\bs>   void|half|float|double|x86_fp80|fp128|ppc_fp128|label|metadatas	   i[1-9]\d*(   R*   R+   R,   R-   R.   R/   R0   R1   R3   R   R	   R5   R;   t   Globalt	   AnonymousR   R
   R   R   R   R   t   TypeR=   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   É   s:   								9	c           B   s<  e  Z d  Z d Z d g Z d d g Z d g Z d Z d Z d Z	 d	 Z
 d
 Z e d e Z d d d Z d Z d Z d Z d Z d Z e j e j BZ i d e j d f e d ƒ e d e j f d e e e j e j e j ƒ d f e e d f e e j d f e e j  d f d e! f g d 6e e" f e e# j$ f e	 e# j% f e
 e# j& f e e# j' f e e# j( f e d ƒ e e j) f e e j* f d e! d f e d ƒ g d 6d e j f d e j+ d f d  e j d f g d 6d  e! f d! e! f d" e j+ f g d 6d# e, f d$ e- f d% e j f e e- j. f e e j/ f g d 6Z0 RS(&   s)   
    For Nasm (Intel) assembly code.
    t   NASMt   nasms   *.asms   *.ASMs   text/x-nasms   [a-z$._?][\w$.?#@~]*s,   (?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)s   [0-7]+qs   [01]+bs   [0-9]+s   \.e?s   "(\\"|[^"\n])*"|s   '(\\'|[^'\n])*'|s   `(\\`|[^`\n])*`s   (?:res|d)[bwdqt]|timesso   r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]s   seg|wrt|stricts   byte|[dq]?wordsˆ   BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULEs   ^\s*%t   preprocR   R   s   (%s)(\s+)(equ)s   instruction-argss   [\r\n]+R   R!   s   #pops   [^;\n]+s   ;.*?\ns   \ns   [ \t]+s   ;.*s   [,():\[\]]+s   [&|^<>+*/%~-]+s   [$]+(1   R*   R+   R,   R-   R.   R/   R0   R3   t   hexnt   octnt   binnt   decnt   floatnR1   t   declkwt   registert   wordopt   typet
   directivesR$   t
   IGNORECASEt	   MULTILINEt   flagsR   t   PreprocR   R	   R5   R   R8   R   t   DeclarationR7   R   R   R
   R:   t   Octt   Bint   FloatR9   t   BuiltinR;   t   SingleR   R   t   WordRO   R=   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR   8  sf   									c           B   s;   e  Z d  Z d Z d g Z d g Z d g Z e e ƒ Z	 RS(   sM   
    For the output of 'objdump -d -M intel'.

    .. versionadded:: 2.0
    s   objdump-nasms   *.objdump-intels   text/x-nasm-objdump(
   R*   R+   R,   R-   R.   R/   R0   RB   R   R=   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR     s   			c           B   sÏ   e  Z d  Z d Z d g Z d g Z e j Z i d e	 j
 f d e f d e j f d e f d e j f d	 e f d
 e f d e j f d e j f d e j f d e j f d e f d e f g d 6Z d „  Z RS(   s@   
    For ca65 assembler sources.

    .. versionadded:: 1.6
    s   ca65 assemblert   ca65s   *.ss   ;.*s   \s+s   [a-z_.@$][\w.@$]*:s·   ((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor|bit)\bs   \.\w+s   [-+~*/^&|!<>=]s	   "[^"\n]*.s	   '[^'\n]*.s   \$[0-9a-f]+|[0-9a-f]+h\bs   \d+s   %[01]+s   [#,.:()=\[\]]s   [a-z_.@$][\w.@$]*R   c         C   s    t  j d | t  j ƒ r d Sd  S(   Ns   ^\s*;gÍÌÌÌÌÌì?(   R$   R%   R^   (   RF   R(   (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR)   °  s    (   R*   R+   R,   R-   R.   R/   R$   R]   R_   R   Rf   R   R	   R5   R   t   PseudoR   R   R<   R
   R:   R9   Rc   R   R=   R)   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyR     s*   							("   R,   R$   t   pygments.lexerR    R   R   R   R   t   pygments.lexers.c_cppR   R   t   pygments.lexers.dR   t   pygments.tokenR   R	   R
   R   R   R   R   R   R   t   __all__R   RB   R   R   R   R   R   R   R   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/pygments/lexers/asm.pyt   <module>
   s$   (@	L	1oI