1" Vim syntax file
2" Language:   mir
3" Maintainer: The LLVM team, http://llvm.org/
4" Version:      $Revision$
5
6if version < 600
7  syntax clear
8elseif exists("b:current_syntax")
9  finish
10endif
11
12syn case match
13
14" MIR is embedded in a yaml container, so we load all of the yaml syntax.
15runtime! syntax/yaml.vim
16unlet 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.
20syntax include @LLVM syntax/llvm.vim
21" FIXME: This should only be allowed for the first document of the file
22syntax region llvm start=/\(^---\s*|\)\@<=/ end=/\(^\.\.\.\)\@=/ contains=@LLVM
23
24" The `body:` field of a document contains the MIR dump of the function
25syntax include @MIR syntax/machine-ir.vim
26syntax region mir start=/\(^body:\s*|\)\@<=/ end=/\(^[^[:space:]]\)\@=/ contains=@MIR
27
28" Syntax-highlight lit test commands and bug numbers.
29syn match  mirSpecialComment /#\s*PR\d*\s*$/
30syn match  mirSpecialComment /#\s*REQUIRES:.*$/
31syn match  mirSpecialComment /#\s*RUN:.*$/
32syn match  mirSpecialComment /#\s*ALLOW_RETRIES:.*$/
33syn match  mirSpecialComment /#\s*CHECK:.*$/
34syn match  mirSpecialComment "\v#\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$"
35syn match  mirSpecialComment /#\s*XFAIL:.*$/
36
37if 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
46endif
47
48let b:current_syntax = "mir"
49