1" Vim syntax file
2" Language: lilo configuration (lilo.conf)
3" Maintainer: Niels Horn <niels.horn@gmail.com>
4" Previous Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
5" Last Change: 2010-02-03
6
7" Setup
8if version >= 600
9  if exists("b:current_syntax")
10    finish
11  endif
12else
13  syntax clear
14endif
15
16if version >= 600
17  command -nargs=1 SetIsk setlocal iskeyword=<args>
18else
19  command -nargs=1 SetIsk set iskeyword=<args>
20endif
21SetIsk @,48-57,.,-,_
22delcommand SetIsk
23
24syn case ignore
25
26" Base constructs
27syn match liloError "\S\+"
28syn match liloComment "#.*$"
29syn match liloEnviron "\$\w\+" contained
30syn match liloEnviron "\${[^}]\+}" contained
31syn match liloDecNumber "\d\+" contained
32syn match liloHexNumber "0[xX]\x\+" contained
33syn match liloDecNumberP "\d\+p\=" contained
34syn match liloSpecial contained "\\\(\"\|\\\|$\)"
35syn region liloString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=liloSpecial,liloEnviron
36syn match liloLabel :[^ "]\+: contained contains=liloSpecial,liloEnviron
37syn region liloPath start=+[$/]+ skip=+\\\\\|\\ \|\\$"+ end=+ \|$+ contained contains=liloSpecial,liloEnviron
38syn match liloDecNumberList "\(\d\|,\)\+" contained contains=liloDecNumber
39syn match liloDecNumberPList "\(\d\|[,p]\)\+" contained contains=liloDecNumberP,liloDecNumber
40syn region liloAnything start=+[^[:space:]#]+ skip=+\\\\\|\\ \|\\$+ end=+ \|$+ contained contains=liloSpecial,liloEnviron,liloString
41
42" Path
43syn keyword liloOption backup bitmap boot disktab force-backup keytable map message nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
44syn keyword liloKernelOpt initrd root nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
45syn keyword liloImageOpt path loader table nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
46syn keyword liloDiskOpt partition nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
47
48" Other
49syn keyword liloOption menu-scheme raid-extra-boot serial install nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
50syn keyword liloOption bios-passes-dl nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
51syn keyword liloOption default label alias wmdefault nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty
52syn keyword liloKernelOpt ramdisk nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
53syn keyword liloImageOpt password range nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
54syn keyword liloDiskOpt set type nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
55
56" Symbolic
57syn keyword liloKernelOpt vga nextgroup=liloEqVga,liloEqVgaComment,liloError skipwhite skipempty
58
59" Number
60syn keyword liloOption delay timeout verbose nextgroup=liloEqDecNumber,liloEqDecNumberComment,liloError skipwhite skipempty
61syn keyword liloDiskOpt sectors heads cylinders start nextgroup=liloEqDecNumber,liloEqDecNumberComment,liloError skipwhite skipempty
62
63" String
64syn keyword liloOption menu-title nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
65syn keyword liloKernelOpt append addappend nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
66syn keyword liloImageOpt fallback literal nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
67
68" Hex number
69syn keyword liloImageOpt map-drive to boot-as nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty
70syn keyword liloDiskOpt bios normal hidden nextgroup=liloEqNumber,liloEqNumberComment,liloError skipwhite skipempty
71
72" Number list
73syn keyword liloOption bmp-colors nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty
74
75" Number list, some of the numbers followed by p
76syn keyword liloOption bmp-table bmp-timer nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty
77
78" Flag
79syn keyword liloOption compact fix-table geometric ignore-table lba32 linear mandatory nowarn prompt
80syn keyword liloOption bmp-retain el-torito-bootable-CD large-memory suppress-boot-time-BIOS-data
81syn keyword liloKernelOpt read-only read-write
82syn keyword liloImageOpt bypass lock mandatory optional restricted single-key unsafe
83syn keyword liloImageOpt master-boot wmwarn wmdisable
84syn keyword liloDiskOpt change activate deactivate inaccessible reset
85
86" Image
87syn keyword liloImage image other nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
88syn keyword liloDisk disk nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
89syn keyword liloChRules change-rules
90
91" Vga keywords
92syn keyword liloVgaKeyword ask ext extended normal contained
93
94" Comment followed by equal sign and ...
95syn match liloEqPathComment "#.*$" contained nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
96syn match liloEqVgaComment "#.*$" contained nextgroup=liloEqVga,liloEqVgaComment,liloError skipwhite skipempty
97syn match liloEqNumberComment "#.*$" contained nextgroup=liloEqNumber,liloEqNumberComment,liloError skipwhite skipempty
98syn match liloEqDecNumberComment "#.*$" contained nextgroup=liloEqDecNumber,liloEqDecNumberComment,liloError skipwhite skipempty
99syn match liloEqHexNumberComment "#.*$" contained nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty
100syn match liloEqStringComment "#.*$" contained nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
101syn match liloEqLabelStringComment "#.*$" contained nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty
102syn match liloEqNumberListComment "#.*$" contained nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty
103syn match liloEqDecNumberPListComment "#.*$" contained nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty
104syn match liloEqAnythingComment "#.*$" contained nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
105
106" Equal sign followed by ...
107syn match liloEqPath "=" contained nextgroup=liloPath,liloPathComment,liloError skipwhite skipempty
108syn match liloEqVga "=" contained nextgroup=liloVgaKeyword,liloHexNumber,liloDecNumber,liloVgaComment,liloError skipwhite skipempty
109syn match liloEqNumber "=" contained nextgroup=liloDecNumber,liloHexNumber,liloNumberComment,liloError skipwhite skipempty
110syn match liloEqDecNumber "=" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty
111syn match liloEqHexNumber "=" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty
112syn match liloEqString "=" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty
113syn match liloEqLabelString "=" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty
114syn match liloEqNumberList "=" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty
115syn match liloEqDecNumberPList "=" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty
116syn match liloEqAnything "=" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty
117
118" Comment followed by ...
119syn match liloPathComment "#.*$" contained nextgroup=liloPath,liloPathComment,liloError skipwhite skipempty
120syn match liloVgaComment "#.*$" contained nextgroup=liloVgaKeyword,liloHexNumber,liloVgaComment,liloError skipwhite skipempty
121syn match liloNumberComment "#.*$" contained nextgroup=liloDecNumber,liloHexNumber,liloNumberComment,liloError skipwhite skipempty
122syn match liloDecNumberComment "#.*$" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty
123syn match liloHexNumberComment "#.*$" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty
124syn match liloStringComment "#.*$" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty
125syn match liloLabelStringComment "#.*$" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty
126syn match liloDecNumberListComment "#.*$" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty
127syn match liloDecNumberPListComment "#.*$" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty
128syn match liloAnythingComment "#.*$" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty
129
130" Define the default highlighting
131if version >= 508 || !exists("did_lilo_syntax_inits")
132  if version < 508
133    let did_lilo_syntax_inits = 1
134    command -nargs=+ HiLink hi link <args>
135  else
136    command -nargs=+ HiLink hi def link <args>
137  endif
138
139  HiLink liloEqPath             liloEquals
140  HiLink liloEqWord             liloEquals
141  HiLink liloEqVga              liloEquals
142  HiLink liloEqDecNumber        liloEquals
143  HiLink liloEqHexNumber        liloEquals
144  HiLink liloEqNumber           liloEquals
145  HiLink liloEqString           liloEquals
146  HiLink liloEqAnything         liloEquals
147  HiLink liloEquals             Special
148
149  HiLink liloError              Error
150
151  HiLink liloEqPathComment      liloComment
152  HiLink liloEqVgaComment       liloComment
153  HiLink liloEqDecNumberComment liloComment
154  HiLink liloEqHexNumberComment liloComment
155  HiLink liloEqStringComment    liloComment
156  HiLink liloEqAnythingComment  liloComment
157  HiLink liloPathComment        liloComment
158  HiLink liloVgaComment         liloComment
159  HiLink liloDecNumberComment   liloComment
160  HiLink liloHexNumberComment   liloComment
161  HiLink liloNumberComment      liloComment
162  HiLink liloStringComment      liloComment
163  HiLink liloAnythingComment    liloComment
164  HiLink liloComment            Comment
165
166  HiLink liloDiskOpt            liloOption
167  HiLink liloKernelOpt          liloOption
168  HiLink liloImageOpt           liloOption
169  HiLink liloOption             Keyword
170
171  HiLink liloDecNumber          liloNumber
172  HiLink liloHexNumber          liloNumber
173  HiLink liloDecNumberP         liloNumber
174  HiLink liloNumber             Number
175  HiLink liloString             String
176  HiLink liloPath               Constant
177
178  HiLink liloSpecial            Special
179  HiLink liloLabel              Title
180  HiLink liloDecNumberList      Special
181  HiLink liloDecNumberPList     Special
182  HiLink liloAnything           Normal
183  HiLink liloEnviron            Identifier
184  HiLink liloVgaKeyword         Identifier
185  HiLink liloImage              Type
186  HiLink liloChRules            Preproc
187  HiLink liloDisk               Preproc
188
189  delcommand HiLink
190endif
191
192let b:current_syntax = "lilo"
193