Home | History | Annotate | Download | only in vim
      1 " Vim syntax file
      2 " Language:   llvm
      3 " Maintainer: The LLVM team, http://llvm.org/
      4 " Version:      $Revision$
      5 
      6 if version < 600
      7   syntax clear
      8 elseif exists("b:current_syntax")
      9   finish
     10 endif
     11 
     12 syn case match
     13 
     14 " Types.
     15 " Types also include struct, array, vector, etc. but these don't
     16 " benefit as much from having dedicated highlighting rules.
     17 syn keyword llvmType void half float double x86_fp80 fp128 ppc_fp128
     18 syn keyword llvmType label metadata x86_mmx
     19 syn keyword llvmType type label opaque
     20 syn match   llvmType /\<i\d\+\>/
     21 
     22 " Instructions.
     23 " The true and false tokens can be used for comparison opcodes, but it's
     24 " much more common for these tokens to be used for boolean constants.
     25 syn keyword llvmStatement add alloca and arcp ashr atomicrmw bitcast br call
     26 syn keyword llvmStatement cmpxchg eq exact extractelement extractvalue fadd fast
     27 syn keyword llvmStatement fcmp fdiv fence fmul fpext fptosi fptoui fptrunc free
     28 syn keyword llvmStatement frem fsub getelementptr icmp inbounds indirectbr
     29 syn keyword llvmStatement insertelement insertvalue inttoptr invoke landingpad
     30 syn keyword llvmStatement load lshr malloc max min mul nand ne ninf nnan nsw nsz
     31 syn keyword llvmStatement nuw oeq oge ogt ole olt one or ord phi ptrtoint resume
     32 syn keyword llvmStatement ret sdiv select sext sge sgt shl shufflevector sitofp
     33 syn keyword llvmStatement sle slt srem store sub switch trunc udiv ueq uge ugt
     34 syn keyword llvmStatement uitofp ule ult umax umin une uno unreachable unwind
     35 syn keyword llvmStatement urem va_arg xchg xor zext
     36 
     37 " Keywords.
     38 syn keyword llvmKeyword acq_rel acquire sanitize_address addrspace alias align
     39 syn keyword llvmKeyword alignstack alwaysinline appending arm_aapcs_vfpcc
     40 syn keyword llvmKeyword arm_aapcscc arm_apcscc asm atomic available_externally
     41 syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common
     42 syn keyword llvmKeyword constant datalayout declare default define deplibs
     43 syn keyword llvmKeyword dllexport dllimport except extern_weak external fastcc
     44 syn keyword llvmKeyword filter gc global hidden initialexec inlinehint inreg
     45 syn keyword llvmKeyword intel_ocl_bicc inteldialect internal linker_private
     46 syn keyword llvmKeyword linker_private_weak linker_private_weak_def_auto
     47 syn keyword llvmKeyword linkonce linkonce_odr linkonce_odr_auto_hide
     48 syn keyword llvmKeyword localdynamic localexec minsize module monotonic
     49 syn keyword llvmKeyword msp430_intrcc naked nest noalias nocapture
     50 syn keyword llvmKeyword noimplicitfloat noinline nonlazybind noredzone noreturn
     51 syn keyword llvmKeyword nounwind optsize personality private protected
     52 syn keyword llvmKeyword ptx_device ptx_kernel readnone readonly release
     53 syn keyword llvmKeyword returns_twice sanitize_thread sanitize_memory
     54 syn keyword llvmKeyword section seq_cst sideeffect signext singlethread
     55 syn keyword llvmKeyword spir_func spir_kernel sret ssp sspreq sspstrong
     56 syn keyword llvmKeyword tail target thread_local to triple unnamed_addr
     57 syn keyword llvmKeyword unordered uwtable volatile weak weak_odr
     58 syn keyword llvmKeyword x86_fastcallcc x86_stdcallcc x86_thiscallcc x86_64_sysvcc
     59 syn keyword llvmKeyword x86_64_win64cc zeroext
     60 
     61 " Obsolete keywords.
     62 syn keyword llvmError  getresult begin end
     63 
     64 " Misc syntax.
     65 syn match   llvmNoName /[%@]\d\+\>/
     66 syn match   llvmNumber /-\?\<\d\+\>/
     67 syn match   llvmFloat  /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/
     68 syn match   llvmFloat  /\<0x\x\+\>/
     69 syn keyword llvmBoolean true false
     70 syn keyword llvmConstant zeroinitializer undef null
     71 syn match   llvmComment /;.*$/
     72 syn region  llvmString start=/"/ skip=/\\"/ end=/"/
     73 syn match   llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/
     74 syn match   llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/
     75 
     76 " Syntax-highlight dejagnu test commands.
     77 syn match  llvmSpecialComment /;\s*RUN:.*$/
     78 syn match  llvmSpecialComment /;\s*PR\d*\s*$/
     79 syn match  llvmSpecialComment /;\s*END\.\s*$/
     80 syn match  llvmSpecialComment /;\s*XFAIL:.*$/
     81 
     82 if version >= 508 || !exists("did_c_syn_inits")
     83   if version < 508
     84     let did_c_syn_inits = 1
     85     command -nargs=+ HiLink hi link <args>
     86   else
     87     command -nargs=+ HiLink hi def link <args>
     88   endif
     89 
     90   HiLink llvmType Type
     91   HiLink llvmStatement Statement
     92   HiLink llvmNumber Number
     93   HiLink llvmComment Comment
     94   HiLink llvmString String
     95   HiLink llvmLabel Label
     96   HiLink llvmKeyword Keyword
     97   HiLink llvmBoolean Boolean
     98   HiLink llvmFloat Float
     99   HiLink llvmNoName Identifier
    100   HiLink llvmConstant Constant
    101   HiLink llvmSpecialComment SpecialComment
    102   HiLink llvmError Error
    103   HiLink llvmIdentifier Identifier
    104 
    105   delcommand HiLink
    106 endif
    107 
    108 let b:current_syntax = "llvm"
    109