1" Vim syntax file
2" Language:   TableGen
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
12" May be changed if you have a really slow machine
13syntax sync minlines=100
14
15syn case match
16
17syn keyword tgKeyword   def let in code dag field include defm foreach
18syn keyword tgType      class int string list bit bits multiclass
19
20syn match   tgNumber    /\<\d\+\>/
21syn match   tgNumber    /\<\d\+\.\d*\>/
22syn match   tgNumber    /\<0b[01]\+\>/
23syn match   tgNumber    /\<0x[0-9a-fA-F]\+\>/
24syn region  tgString    start=/"/ skip=/\\"/ end=/"/    oneline
25
26syn region  tgCode      start=/\[{/ end=/}\]/
27
28syn keyword tgTodo             contained TODO FIXME
29syn match   tgComment   /\/\/.*$/         contains=tgTodo
30" Handle correctly imbricated comment
31syn region  tgComment2 matchgroup=tgComment2  start=+/\*+ end=+\*/+ contains=tgTodo,tgComment2
32
33if version >= 508 || !exists("did_c_syn_inits")
34  if version < 508
35    let did_c_syn_inits = 1
36    command -nargs=+ HiLink hi link <args>
37  else
38    command -nargs=+ HiLink hi def link <args>
39  endif
40
41  HiLink tgKeyword Statement
42  HiLink tgType Type
43  HiLink tgNumber Number
44  HiLink tgComment Comment
45  HiLink tgComment2 Comment
46  HiLink tgString String
47  " May find a better Hilight group...
48  HiLink tgCode Special
49  HiLink tgTodo Todo
50
51  delcommand HiLink
52endif
53
54let b:current_syntax = "tablegen"
55