diff options
Diffstat (limited to 'runtime/syntax/udevrules.vim')
-rw-r--r-- | runtime/syntax/udevrules.vim | 86 |
1 files changed, 70 insertions, 16 deletions
diff --git a/runtime/syntax/udevrules.vim b/runtime/syntax/udevrules.vim index 2dca8787c..b04d72886 100644 --- a/runtime/syntax/udevrules.vim +++ b/runtime/syntax/udevrules.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: udev(8) rules file " Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Latest Revision: 2006-12-18 if exists("b:current_syntax") finish @@ -10,21 +10,26 @@ endif let s:cpo_save = &cpo set cpo&vim +" TODO: Line continuations. + syn keyword udevrulesTodo contained TODO FIXME XXX NOTE syn region udevrulesComment display oneline start='^\s*#' end='$' \ contains=udevrulesTodo,@Spell -syn keyword udevrulesRuleKey BUS KERNEL SUBSYSTEM DRIVER ID RESULT - \ nextgroup=udevrulesRuleEq +syn keyword udevrulesRuleKey ACTION DEVPATH KERNEL SUBSYSTEM KERNELS + \ SUBSYSTEMS DRIVERS RESULT + \ nextgroup=udevrulesRuleTest + \ skipwhite -syn keyword udevrulesRuleKey SYSFS nextgroup=udevrulesSysFSPath +syn keyword udevrulesRuleKey ATTRS nextgroup=udevrulesAttrsPath -syn region udevrulesSysFSPath display transparent +syn region udevrulesAttrsPath display transparent \ matchgroup=udevrulesDelimiter start='{' \ matchgroup=udevrulesDelimiter end='}' \ contains=udevrulesPath - \ nextgroup=udevrulesRuleEq + \ nextgroup=udevrulesRuleTest + \ skipwhite syn keyword udevrulesRuleKey ENV nextgroup=udevrulesEnvVar @@ -32,16 +37,42 @@ syn region udevrulesEnvVar display transparent \ matchgroup=udevrulesDelimiter start='{' \ matchgroup=udevrulesDelimiter end='}' \ contains=udevrulesVariable - \ nextgroup=udevrulesRuleEq + \ nextgroup=udevrulesRuleTest,udevrulesRuleEq + \ skipwhite -syn keyword udevrulesRuleKey PROGRAM - \ nextgroup=udevrulesEStringEq +syn keyword udevrulesRuleKey PROGRAM RESULT + \ nextgroup=udevrulesEStringTest,udevrulesEStringEq + \ skipwhite -syn keyword udevrulesAssignKey NAME SYMLINK OWNER GROUP +syn keyword udevrulesAssignKey NAME SYMLINK OWNER GROUP RUN \ nextgroup=udevrulesEStringEq + \ skipwhite + +syn keyword udevrulesAssignKey MODE LABEL GOTO WAIT_FOR_SYSFS + \ nextgroup=udevrulesRuleEq + \ skipwhite -syn keyword udevrulesAssignKey MODE +syn keyword udevrulesAssignKey ATTR nextgroup=udevrulesAttrsPath + +syn region udevrulesAttrKey display transparent + \ matchgroup=udevrulesDelimiter start='{' + \ matchgroup=udevrulesDelimiter end='}' + \ contains=udevrulesKey \ nextgroup=udevrulesRuleEq + \ skipwhite + +syn keyword udevrulesAssignKey IMPORT nextgroup=udevrulesImport, + \ udevrulesEStringEq + \ skipwhite + +syn region udevrulesImport display transparent + \ matchgroup=udevrulesDelimiter start='{' + \ matchgroup=udevrulesDelimiter end='}' + \ contains=udevrulesImportType + \ nextgroup=udevrulesEStringEq + \ skipwhite + +syn keyword udevrulesImportType program file parent syn keyword udevrulesAssignKey OPTIONS \ nextgroup=udevrulesOptionsEq @@ -50,28 +81,48 @@ syn match udevrulesPath contained display '[^}]\+' syn match udevrulesVariable contained display '[^}]\+' -syn match udevrulesRuleEq contained '[[:space:]=]' +syn match udevrulesRuleTest contained display '[=!:]=' \ nextgroup=udevrulesString skipwhite -syn match udevrulesEStringEq contained '[[:space:]=]' +syn match udevrulesEStringTest contained display '[=!+:]=' \ nextgroup=udevrulesEString skipwhite -syn match udevrulesOptionsEq contained '[[:space:]=]' +syn match udevrulesRuleEq contained display '+=\|=\ze[^=]' + \ nextgroup=udevrulesString skipwhite + +syn match udevrulesEStringEq contained '+=\|=\ze[^=]' + \ nextgroup=udevrulesEString skipwhite + +syn match udevrulesOptionsEq contained '+=\|=\ze[^=]' \ nextgroup=udevrulesOptions skipwhite syn region udevrulesEString contained display oneline start=+"+ end=+"+ - \ contains=udevrulesStrEscapes + \ contains=udevrulesStrEscapes,udevrulesStrVars -syn match udevrulesStrEscapes contained '%[nkpMmbcNPe%]' +syn match udevrulesStrEscapes contained '%[knpbMmcPrN%]' +" TODO: This can actually stand alone (without {…}), so add a nextgroup here. syn region udevrulesStrEscapes contained start='%c{' end='}' \ contains=udevrulesStrNumber syn region udevrulesStrEscapes contained start='%s{' end='}' \ contains=udevrulesPath +syn region udevrulesStrEscapes contained start='%E{' end='}' + \ contains=udevrulesVariable + syn match udevrulesStrNumber contained '\d\++\=' +syn match udevrulesStrVars contained display '$\%(kernel\|number\|devpath\|id\|major\|minor\|result\|parent\|root\|tempnode\)\>' + +syn region udevrulesStrVars contained start='$attr{' end='}' + \ contains=udevrulesPath + +syn region udevrulesStrVars contained start='$env{' end='}' + \ contains=udevrulesVariable + +syn match udevrulesStrVars contained display '\$\$' + syn region udevrulesString contained display oneline start=+"+ end=+"+ \ contains=udevrulesPattern @@ -96,6 +147,7 @@ hi def link udevrulesDelimiter Delimiter hi def link udevrulesAssignKey Identifier hi def link udevrulesPath Identifier hi def link udevrulesVariable Identifier +hi def link udevrulesAttrKey Identifier " XXX: setting this to Operator makes for extremely intense highlighting. hi def link udevrulesEq Normal hi def link udevrulesRuleEq udevrulesEq @@ -104,12 +156,14 @@ hi def link udevrulesOptionsEq udevrulesEq hi def link udevrulesEString udevrulesString hi def link udevrulesStrEscapes SpecialChar hi def link udevrulesStrNumber Number +hi def link udevrulesStrVars Identifier hi def link udevrulesString String hi def link udevrulesPattern SpecialChar hi def link udevrulesPatRange SpecialChar hi def link udevrulesOptions udevrulesString hi def link udevrulesOption Type hi def link udevrulesOptionSep Delimiter +hi def link udevrulesImportType Type let b:current_syntax = "udevrules" |