| 1 |
" Vim syntax file |
| 2 |
" Language: mir |
| 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 |
" MIR is embedded in a yaml container, so we load all of the yaml syntax. |
| 15 |
runtime! syntax/yaml.vim |
| 16 |
unlet b:current_syntax |
| 17 |
|
| 18 |
" The first document of a file is allowed to contain an LLVM IR module inside |
| 19 |
" a top-level yaml block string. |
| 20 |
syntax include @LLVM syntax/llvm.vim |
| 21 |
" FIXME: This should only be allowed for the first document of the file |
| 22 |
syntax region llvm start=/\(^---\s*|\)\@<=/ end=/\(^\.\.\.\)\@=/ contains=@LLVM |
| 23 |
|
| 24 |
" The `body:` field of a document contains the MIR dump of the function |
| 25 |
syntax include @MIR syntax/machine-ir.vim |
| 26 |
syntax region mir start=/\(^body:\s*|\)\@<=/ end=/\(^[^[:space:]]\)\@=/ contains=@MIR |
| 27 |
|
| 28 |
" Syntax-highlight lit test commands and bug numbers. |
| 29 |
syn match mirSpecialComment /#\s*PR\d*\s*$/ |
| 30 |
syn match mirSpecialComment /#\s*REQUIRES:.*$/ |
| 31 |
syn match mirSpecialComment /#\s*RUN:.*$/ |
| 32 |
syn match mirSpecialComment /#\s*ALLOW_RETRIES:.*$/ |
| 33 |
syn match mirSpecialComment /#\s*CHECK:.*$/ |
| 34 |
syn match mirSpecialComment "\v#\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$" |
| 35 |
syn match mirSpecialComment /#\s*XFAIL:.*$/ |
| 36 |
|
| 37 |
if version >= 508 || !exists("did_c_syn_inits") |
| 38 |
if version < 508 |
| 39 |
let did_c_syn_inits = 1 |
| 40 |
command -nargs=+ HiLink hi link <args> |
| 41 |
else |
| 42 |
command -nargs=+ HiLink hi def link <args> |
| 43 |
endif |
| 44 |
|
| 45 |
HiLink mirSpecialComment SpecialComment |
| 46 |
|
| 47 |
delcommand HiLink |
| 48 |
endif |
| 49 |
|
| 50 |
let b:current_syntax = "mir" |