389
|
1 " Vim syntax file
|
11062
|
2 " Language: udev(8) rules file
|
|
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
|
4 " Latest Revision: 2006-12-18
|
389
|
5
|
|
6 if exists("b:current_syntax")
|
|
7 finish
|
|
8 endif
|
|
9
|
|
10 let s:cpo_save = &cpo
|
|
11 set cpo&vim
|
|
12
|
1213
|
13 " TODO: Line continuations.
|
|
14
|
389
|
15 syn keyword udevrulesTodo contained TODO FIXME XXX NOTE
|
|
16
|
|
17 syn region udevrulesComment display oneline start='^\s*#' end='$'
|
|
18 \ contains=udevrulesTodo,@Spell
|
|
19
|
1213
|
20 syn keyword udevrulesRuleKey ACTION DEVPATH KERNEL SUBSYSTEM KERNELS
|
|
21 \ SUBSYSTEMS DRIVERS RESULT
|
|
22 \ nextgroup=udevrulesRuleTest
|
|
23 \ skipwhite
|
389
|
24
|
1213
|
25 syn keyword udevrulesRuleKey ATTRS nextgroup=udevrulesAttrsPath
|
389
|
26
|
1213
|
27 syn region udevrulesAttrsPath display transparent
|
389
|
28 \ matchgroup=udevrulesDelimiter start='{'
|
|
29 \ matchgroup=udevrulesDelimiter end='}'
|
|
30 \ contains=udevrulesPath
|
1213
|
31 \ nextgroup=udevrulesRuleTest
|
|
32 \ skipwhite
|
389
|
33
|
|
34 syn keyword udevrulesRuleKey ENV nextgroup=udevrulesEnvVar
|
|
35
|
|
36 syn region udevrulesEnvVar display transparent
|
|
37 \ matchgroup=udevrulesDelimiter start='{'
|
|
38 \ matchgroup=udevrulesDelimiter end='}'
|
|
39 \ contains=udevrulesVariable
|
1213
|
40 \ nextgroup=udevrulesRuleTest,udevrulesRuleEq
|
|
41 \ skipwhite
|
|
42
|
|
43 syn keyword udevrulesRuleKey PROGRAM RESULT
|
|
44 \ nextgroup=udevrulesEStringTest,udevrulesEStringEq
|
|
45 \ skipwhite
|
389
|
46
|
1213
|
47 syn keyword udevrulesAssignKey NAME SYMLINK OWNER GROUP RUN
|
389
|
48 \ nextgroup=udevrulesEStringEq
|
1213
|
49 \ skipwhite
|
|
50
|
|
51 syn keyword udevrulesAssignKey MODE LABEL GOTO WAIT_FOR_SYSFS
|
|
52 \ nextgroup=udevrulesRuleEq
|
|
53 \ skipwhite
|
|
54
|
|
55 syn keyword udevrulesAssignKey ATTR nextgroup=udevrulesAttrsPath
|
389
|
56
|
1213
|
57 syn region udevrulesAttrKey display transparent
|
|
58 \ matchgroup=udevrulesDelimiter start='{'
|
|
59 \ matchgroup=udevrulesDelimiter end='}'
|
|
60 \ contains=udevrulesKey
|
|
61 \ nextgroup=udevrulesRuleEq
|
|
62 \ skipwhite
|
389
|
63
|
1213
|
64 syn keyword udevrulesAssignKey IMPORT nextgroup=udevrulesImport,
|
|
65 \ udevrulesEStringEq
|
|
66 \ skipwhite
|
|
67
|
|
68 syn region udevrulesImport display transparent
|
|
69 \ matchgroup=udevrulesDelimiter start='{'
|
|
70 \ matchgroup=udevrulesDelimiter end='}'
|
|
71 \ contains=udevrulesImportType
|
|
72 \ nextgroup=udevrulesEStringEq
|
|
73 \ skipwhite
|
|
74
|
|
75 syn keyword udevrulesImportType program file parent
|
389
|
76
|
|
77 syn keyword udevrulesAssignKey OPTIONS
|
|
78 \ nextgroup=udevrulesOptionsEq
|
|
79
|
|
80 syn match udevrulesPath contained display '[^}]\+'
|
|
81
|
|
82 syn match udevrulesVariable contained display '[^}]\+'
|
|
83
|
1213
|
84 syn match udevrulesRuleTest contained display '[=!:]='
|
389
|
85 \ nextgroup=udevrulesString skipwhite
|
|
86
|
1213
|
87 syn match udevrulesEStringTest contained display '[=!+:]='
|
389
|
88 \ nextgroup=udevrulesEString skipwhite
|
|
89
|
1213
|
90 syn match udevrulesRuleEq contained display '+=\|=\ze[^=]'
|
|
91 \ nextgroup=udevrulesString skipwhite
|
|
92
|
|
93 syn match udevrulesEStringEq contained '+=\|=\ze[^=]'
|
|
94 \ nextgroup=udevrulesEString skipwhite
|
|
95
|
|
96 syn match udevrulesOptionsEq contained '+=\|=\ze[^=]'
|
389
|
97 \ nextgroup=udevrulesOptions skipwhite
|
|
98
|
|
99 syn region udevrulesEString contained display oneline start=+"+ end=+"+
|
1213
|
100 \ contains=udevrulesStrEscapes,udevrulesStrVars
|
389
|
101
|
1213
|
102 syn match udevrulesStrEscapes contained '%[knpbMmcPrN%]'
|
389
|
103
|
1213
|
104 " TODO: This can actually stand alone (without {…}), so add a nextgroup here.
|
389
|
105 syn region udevrulesStrEscapes contained start='%c{' end='}'
|
|
106 \ contains=udevrulesStrNumber
|
|
107
|
|
108 syn region udevrulesStrEscapes contained start='%s{' end='}'
|
|
109 \ contains=udevrulesPath
|
|
110
|
1213
|
111 syn region udevrulesStrEscapes contained start='%E{' end='}'
|
|
112 \ contains=udevrulesVariable
|
|
113
|
389
|
114 syn match udevrulesStrNumber contained '\d\++\='
|
|
115
|
1213
|
116 syn match udevrulesStrVars contained display '$\%(kernel\|number\|devpath\|id\|major\|minor\|result\|parent\|root\|tempnode\)\>'
|
|
117
|
|
118 syn region udevrulesStrVars contained start='$attr{' end='}'
|
|
119 \ contains=udevrulesPath
|
|
120
|
|
121 syn region udevrulesStrVars contained start='$env{' end='}'
|
|
122 \ contains=udevrulesVariable
|
|
123
|
|
124 syn match udevrulesStrVars contained display '\$\$'
|
|
125
|
389
|
126 syn region udevrulesString contained display oneline start=+"+ end=+"+
|
|
127 \ contains=udevrulesPattern
|
|
128
|
|
129 syn match udevrulesPattern contained '[*?]'
|
|
130 syn region udevrulesPattern contained start='\[!\=' end='\]'
|
|
131 \ contains=udevrulesPatRange
|
|
132
|
|
133 syn match udevrulesPatRange contained '[^[-]-[^]-]'
|
|
134
|
|
135 syn region udevrulesOptions contained display oneline start=+"+ end=+"+
|
|
136 \ contains=udevrulesOption,udevrulesOptionSep
|
|
137
|
|
138 syn keyword udevrulesOption contained last_rule ignore_device ignore_remove
|
|
139 \ all_partitions
|
|
140
|
|
141 syn match udevrulesOptionSep contained ','
|
|
142
|
|
143 hi def link udevrulesTodo Todo
|
|
144 hi def link udevrulesComment Comment
|
|
145 hi def link udevrulesRuleKey Keyword
|
|
146 hi def link udevrulesDelimiter Delimiter
|
|
147 hi def link udevrulesAssignKey Identifier
|
|
148 hi def link udevrulesPath Identifier
|
|
149 hi def link udevrulesVariable Identifier
|
1213
|
150 hi def link udevrulesAttrKey Identifier
|
389
|
151 " XXX: setting this to Operator makes for extremely intense highlighting.
|
|
152 hi def link udevrulesEq Normal
|
|
153 hi def link udevrulesRuleEq udevrulesEq
|
|
154 hi def link udevrulesEStringEq udevrulesEq
|
|
155 hi def link udevrulesOptionsEq udevrulesEq
|
|
156 hi def link udevrulesEString udevrulesString
|
|
157 hi def link udevrulesStrEscapes SpecialChar
|
|
158 hi def link udevrulesStrNumber Number
|
1213
|
159 hi def link udevrulesStrVars Identifier
|
389
|
160 hi def link udevrulesString String
|
|
161 hi def link udevrulesPattern SpecialChar
|
|
162 hi def link udevrulesPatRange SpecialChar
|
|
163 hi def link udevrulesOptions udevrulesString
|
|
164 hi def link udevrulesOption Type
|
|
165 hi def link udevrulesOptionSep Delimiter
|
1213
|
166 hi def link udevrulesImportType Type
|
389
|
167
|
|
168 let b:current_syntax = "udevrules"
|
|
169
|
|
170 let &cpo = s:cpo_save
|
|
171 unlet s:cpo_save
|