1 " Vim syntax file 2 " Language: llvm 3 " Maintainer: The LLVM team, http://llvm.org/ 4 " Version: $Revision: 137806 $ 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 float double 18 syn keyword llvmType x86_fp80 fp128 ppc_fp128 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 fadd sub fsub mul fmul 26 syn keyword llvmStatement sdiv udiv fdiv srem urem frem 27 syn keyword llvmStatement and or xor 28 syn keyword llvmStatement icmp fcmp 29 syn keyword llvmStatement eq ne ugt uge ult ule sgt sge slt sle 30 syn keyword llvmStatement oeq ogt oge olt ole one ord ueq ugt uge 31 syn keyword llvmStatement ult ule une uno 32 syn keyword llvmStatement nuw nsw exact inbounds 33 syn keyword llvmStatement phi call select shl lshr ashr va_arg 34 syn keyword llvmStatement trunc zext sext 35 syn keyword llvmStatement fptrunc fpext fptoui fptosi uitofp sitofp 36 syn keyword llvmStatement ptrtoint inttoptr bitcast 37 syn keyword llvmStatement ret br indirectbr switch invoke unwind unreachable 38 syn keyword llvmStatement malloc alloca free load store getelementptr 39 syn keyword llvmStatement extractelement insertelement shufflevector 40 syn keyword llvmStatement extractvalue insertvalue 41 42 " Keywords. 43 syn keyword llvmKeyword define declare global constant 44 syn keyword llvmKeyword internal external private 45 syn keyword llvmKeyword linkonce linkonce_odr weak weak_odr appending 46 syn keyword llvmKeyword common extern_weak 47 syn keyword llvmKeyword thread_local dllimport dllexport 48 syn keyword llvmKeyword hidden protected default 49 syn keyword llvmKeyword except deplibs 50 syn keyword llvmKeyword volatile fastcc coldcc cc ccc 51 syn keyword llvmKeyword x86_stdcallcc x86_fastcallcc 52 syn keyword llvmKeyword ptx_kernel ptx_device 53 syn keyword llvmKeyword signext zeroext inreg sret nounwind noreturn 54 syn keyword llvmKeyword nocapture byval nest readnone readonly noalias uwtable 55 syn keyword llvmKeyword inlinehint noinline alwaysinline optsize ssp sspreq 56 syn keyword llvmKeyword noredzone noimplicitfloat naked alignstack 57 syn keyword llvmKeyword module asm align tail to 58 syn keyword llvmKeyword addrspace section alias sideeffect c gc 59 syn keyword llvmKeyword target datalayout triple 60 syn keyword llvmKeyword blockaddress 61 62 " Obsolete keywords. 63 syn keyword llvmError getresult begin end 64 65 " Misc syntax. 66 syn match llvmNoName /[%@]\d\+\>/ 67 syn match llvmNumber /-\?\<\d\+\>/ 68 syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ 69 syn match llvmFloat /\<0x\x\+\>/ 70 syn keyword llvmBoolean true false 71 syn keyword llvmConstant zeroinitializer undef null 72 syn match llvmComment /;.*$/ 73 syn region llvmString start=/"/ skip=/\\"/ end=/"/ 74 syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ 75 syn match llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/ 76 77 " Syntax-highlight dejagnu test commands. 78 syn match llvmSpecialComment /;\s*RUN:.*$/ 79 syn match llvmSpecialComment /;\s*PR\d*\s*$/ 80 syn match llvmSpecialComment /;\s*END\.\s*$/ 81 syn match llvmSpecialComment /;\s*XFAIL:.*$/ 82 syn match llvmSpecialComment /;\s*XTARGET:.*$/ 83 84 if version >= 508 || !exists("did_c_syn_inits") 85 if version < 508 86 let did_c_syn_inits = 1 87 command -nargs=+ HiLink hi link <args> 88 else 89 command -nargs=+ HiLink hi def link <args> 90 endif 91 92 HiLink llvmType Type 93 HiLink llvmStatement Statement 94 HiLink llvmNumber Number 95 HiLink llvmComment Comment 96 HiLink llvmString String 97 HiLink llvmLabel Label 98 HiLink llvmKeyword Keyword 99 HiLink llvmBoolean Boolean 100 HiLink llvmFloat Float 101 HiLink llvmNoName Identifier 102 HiLink llvmConstant Constant 103 HiLink llvmSpecialComment SpecialComment 104 HiLink llvmError Error 105 HiLink llvmIdentifier Identifier 106 107 delcommand HiLink 108 endif 109 110 let b:current_syntax = "llvm" 111