Merged from the latest developing branch.
[MacVim/jjgod.git] / runtime / syntax / udevrules.vim
blobb04d728865dc6cd82ed1f6594d5e01c8957db81e
1 " Vim syntax file
2 " Language:         udev(8) rules file
3 " Maintainer:       Nikolai Weibull <now@bitwi.se>
4 " Latest Revision:  2006-12-18
6 if exists("b:current_syntax")
7   finish
8 endif
10 let s:cpo_save = &cpo
11 set cpo&vim
13 " TODO: Line continuations.
15 syn keyword udevrulesTodo       contained TODO FIXME XXX NOTE
17 syn region  udevrulesComment    display oneline start='^\s*#' end='$'
18                                 \ contains=udevrulesTodo,@Spell
20 syn keyword udevrulesRuleKey    ACTION DEVPATH KERNEL SUBSYSTEM KERNELS
21                                 \ SUBSYSTEMS DRIVERS RESULT
22                                 \ nextgroup=udevrulesRuleTest
23                                 \ skipwhite
25 syn keyword udevrulesRuleKey    ATTRS nextgroup=udevrulesAttrsPath
27 syn region  udevrulesAttrsPath  display transparent
28                                 \ matchgroup=udevrulesDelimiter start='{'
29                                 \ matchgroup=udevrulesDelimiter end='}'
30                                 \ contains=udevrulesPath
31                                 \ nextgroup=udevrulesRuleTest
32                                 \ skipwhite
34 syn keyword udevrulesRuleKey    ENV nextgroup=udevrulesEnvVar
36 syn region  udevrulesEnvVar     display transparent
37                                 \ matchgroup=udevrulesDelimiter start='{'
38                                 \ matchgroup=udevrulesDelimiter end='}'
39                                 \ contains=udevrulesVariable
40                                 \ nextgroup=udevrulesRuleTest,udevrulesRuleEq
41                                 \ skipwhite
43 syn keyword udevrulesRuleKey    PROGRAM RESULT
44                                 \ nextgroup=udevrulesEStringTest,udevrulesEStringEq
45                                 \ skipwhite
47 syn keyword udevrulesAssignKey  NAME SYMLINK OWNER GROUP RUN
48                                 \ nextgroup=udevrulesEStringEq
49                                 \ skipwhite
51 syn keyword udevrulesAssignKey  MODE LABEL GOTO WAIT_FOR_SYSFS
52                                 \ nextgroup=udevrulesRuleEq
53                                 \ skipwhite
55 syn keyword udevrulesAssignKey  ATTR nextgroup=udevrulesAttrsPath
57 syn region  udevrulesAttrKey    display transparent
58                                 \ matchgroup=udevrulesDelimiter start='{'
59                                 \ matchgroup=udevrulesDelimiter end='}'
60                                 \ contains=udevrulesKey
61                                 \ nextgroup=udevrulesRuleEq
62                                 \ skipwhite
64 syn keyword udevrulesAssignKey  IMPORT nextgroup=udevrulesImport,
65                                 \ udevrulesEStringEq
66                                 \ skipwhite
68 syn region  udevrulesImport     display transparent
69                                 \ matchgroup=udevrulesDelimiter start='{'
70                                 \ matchgroup=udevrulesDelimiter end='}'
71                                 \ contains=udevrulesImportType
72                                 \ nextgroup=udevrulesEStringEq
73                                 \ skipwhite
75 syn keyword udevrulesImportType program file parent
77 syn keyword udevrulesAssignKey  OPTIONS
78                                 \ nextgroup=udevrulesOptionsEq
80 syn match   udevrulesPath       contained display '[^}]\+'
82 syn match   udevrulesVariable   contained display '[^}]\+'
84 syn match   udevrulesRuleTest   contained display '[=!:]='
85                                 \ nextgroup=udevrulesString skipwhite
87 syn match   udevrulesEStringTest contained display '[=!+:]='
88                                 \ nextgroup=udevrulesEString skipwhite
90 syn match   udevrulesRuleEq     contained display '+=\|=\ze[^=]'
91                                 \ nextgroup=udevrulesString skipwhite
93 syn match   udevrulesEStringEq  contained '+=\|=\ze[^=]'
94                                 \ nextgroup=udevrulesEString skipwhite
96 syn match   udevrulesOptionsEq  contained '+=\|=\ze[^=]'
97                                 \ nextgroup=udevrulesOptions skipwhite
99 syn region  udevrulesEString    contained display oneline start=+"+ end=+"+
100                                 \ contains=udevrulesStrEscapes,udevrulesStrVars
102 syn match   udevrulesStrEscapes contained '%[knpbMmcPrN%]'
104 " TODO: This can actually stand alone (without {…}), so add a nextgroup here.
105 syn region  udevrulesStrEscapes contained start='%c{' end='}'
106                                 \ contains=udevrulesStrNumber
108 syn region  udevrulesStrEscapes contained start='%s{' end='}'
109                                 \ contains=udevrulesPath
111 syn region  udevrulesStrEscapes contained start='%E{' end='}'
112                                 \ contains=udevrulesVariable
114 syn match   udevrulesStrNumber  contained '\d\++\='
116 syn match   udevrulesStrVars    contained display '$\%(kernel\|number\|devpath\|id\|major\|minor\|result\|parent\|root\|tempnode\)\>'
118 syn region  udevrulesStrVars    contained start='$attr{' end='}'
119                                 \ contains=udevrulesPath
121 syn region  udevrulesStrVars    contained start='$env{' end='}'
122                                 \ contains=udevrulesVariable
124 syn match   udevrulesStrVars    contained display '\$\$'
126 syn region  udevrulesString     contained display oneline start=+"+ end=+"+
127                                 \ contains=udevrulesPattern
129 syn match   udevrulesPattern    contained '[*?]'
130 syn region  udevrulesPattern    contained start='\[!\=' end='\]'
131                                 \ contains=udevrulesPatRange
133 syn match   udevrulesPatRange   contained '[^[-]-[^]-]'
135 syn region  udevrulesOptions    contained display oneline start=+"+ end=+"+
136                                 \ contains=udevrulesOption,udevrulesOptionSep
138 syn keyword udevrulesOption     contained last_rule ignore_device ignore_remove
139                                 \ all_partitions
141 syn match   udevrulesOptionSep  contained ','
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
150 hi def link udevrulesAttrKey    Identifier
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
159 hi def link udevrulesStrVars    Identifier
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
166 hi def link udevrulesImportType Type
168 let b:current_syntax = "udevrules"
170 let &cpo = s:cpo_save
171 unlet s:cpo_save