diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-12-19 22:46:22 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-12-19 22:46:22 +0000 |
commit | 1cd871b5341bf43ee99e136844e3131014880f92 (patch) | |
tree | 6bd9573dbc14de3c4ec85e424cbec9c8d1ee0ed8 /runtime/syntax | |
parent | 46c9c73de8def79baf8f0a34a12549f6c14944f3 (diff) | |
download | vim-git-1cd871b5341bf43ee99e136844e3131014880f92.tar.gz |
updated for version 7.0023v7.0023
Diffstat (limited to 'runtime/syntax')
-rw-r--r-- | runtime/syntax/2html.vim | 24 | ||||
-rw-r--r-- | runtime/syntax/iss.vim | 102 | ||||
-rw-r--r-- | runtime/syntax/netrc.vim | 55 | ||||
-rw-r--r-- | runtime/syntax/sudoers.vim | 290 |
4 files changed, 418 insertions, 53 deletions
diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index 008221400..2a7a2b133 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2004 Oct 15 +" Last Change: 2004 Dec 14 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>) " (XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>) @@ -211,7 +211,11 @@ let s:old_magic = &magic set magic if exists("use_xhtml") - exe "normal! a<?xml version=\"1.0\"?>\n\e" + if s:html_encoding != "" + exe "normal! a<?xml version=\"1.0\" encoding=\"" . s:html_encoding . "\"?>\n\e" + else + exe "normal! a<?xml version=\"1.0\"?>\n\e" + endif let s:tag_close = '/>' else let s:tag_close = '>' @@ -230,8 +234,8 @@ endif " HTML header, with the title and generator ;-). Left free space for the CSS, " to be filled at the end. -exe "normal! a<html>\n<head>\n<title>\e" -exe "normal! a" . expand("%:p:~") . "</title>\n\e" +exe "normal! a<html>\n\e" +exe "normal! a<head>\n<title>" . expand("%:p:~") . "</title>\n\e" exe "normal! a<meta name=\"Generator\" content=\"Vim/" . v:version/100 . "." . v:version %100 . '"' . s:tag_close . "\n\e" if s:html_encoding != "" exe "normal! a<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:html_encoding . '"' . s:tag_close . "\n\e" @@ -477,11 +481,19 @@ while s:idlist != "" endwhile " Add hyperlinks -%s+\(http://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\|"\)+<A HREF="\1">\1</A>\2+ge +%s+\(https\=://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\|"\)+<a href="\1">\1</a>\2+ge " The DTD if exists("html_use_css") - exe "normal! gg0i<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n\e" + if exists("use_xhtml") + exe "normal! gg$a\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\e" + else + exe "normal! gg0i<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n\e" + endif +endif + +if exists("use_xhtml") + exe "normal! gg/<html/e\na xmlns=\"http://www.w3.org/1999/xhtml\"\e" endif " Cleanup diff --git a/runtime/syntax/iss.vim b/runtime/syntax/iss.vim index f94c7cdf0..26d9150b5 100644 --- a/runtime/syntax/iss.vim +++ b/runtime/syntax/iss.vim @@ -2,7 +2,12 @@ " Language: Inno Setup File (iss file) and My InnoSetup extension " Maintainer: Jason Mills (jmills@cs.mun.ca) " Previous Maintainer: Dominique Stéphan (dominique@mggen.com) -" Last Change: 2004 Jul 13 +" Last Change: 2004 Dec 14 +" +" Todo: +" - The paramter String: is matched as flag string (because of case ignore). +" - Pascal scripting syntax is not recognized. +" - Embedded double quotes confuse string matches. e.g. "asfd""asfa" " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -19,36 +24,37 @@ syn case ignore syn region issPreProc start="^\s*#" end="$" " Section -syn region issHeader start="\[" end="\]" +syn region issSection start="\[" end="\]" " Label in the [Setup] Section -syn match issLabel "^[^=]\+=" +syn match issDirective "^[^=]\+=" " URL -syn match issURL "http[s]\=:\/\/.*$" - -" syn match issName "[^: ]\+:" -syn match issName "Name:" -syn match issName "MinVersion:\|OnlyBelowVersion:\|Languages:" -syn match issName "Source:\|DestDir:\|DestName:\|CopyMode:" -syn match issName "Attribs:\|Permissions:\|FontInstall:\|Flags:" -syn match issName "FileName:\|Parameters:\|WorkingDir:\|HotKey:\|Comment:" -syn match issName "IconFilename:\|IconIndex:" -syn match issName "Section:\|Key:\|String:" -syn match issName "Root:\|SubKey:\|ValueType:\|ValueName:\|ValueData:" -syn match issName "RunOnceId:" -syn match issName "Type:" -syn match issName "Components:\|Description:\|GroupDescription:\|Types:\|ExtraDiskSpaceRequired:" -syn match issName "StatusMsg:\|RunOnceId:\|Tasks:" -syn match issName "MessagesFile:\|LicenseFile:\|InfoBeforeFile:\|InfoAfterFile:" - -syn match issComment "^;.*$" +syn match issURL "http[s]\=:\/\/.*$" + +" Parameters used for any section. +" syn match issParam"[^: ]\+:" +syn match issParam "Name:" +syn match issParam "MinVersion:\|OnlyBelowVersion:\|Languages:" +syn match issParam "Source:\|DestDir:\|DestName:\|CopyMode:" +syn match issParam "Attribs:\|Permissions:\|FontInstall:\|Flags:" +syn match issParam "FileName:\|Parameters:\|WorkingDir:\|HotKey:\|Comment:" +syn match issParam "IconFilename:\|IconIndex:" +syn match issParam "Section:\|Key:\|String:" +syn match issParam "Root:\|SubKey:\|ValueType:\|ValueName:\|ValueData:" +syn match issParam "RunOnceId:" +syn match issParam "Type:\|Excludes:" +syn match issParam "Components:\|Description:\|GroupDescription:\|Types:\|ExtraDiskSpaceRequired:" +syn match issParam "StatusMsg:\|RunOnceId:\|Tasks:" +syn match issParam "MessagesFile:\|LicenseFile:\|InfoBeforeFile:\|InfoAfterFile:" + +syn match issComment "^\s*;.*$" " folder constant -syn match issFolder "{[^{]*}" +syn match issFolder "{[^{]*}" " string -syn region issString start=+"+ end=+"+ contains=issFolder +syn region issString start=+"+ end=+"+ contains=issFolder " [Dirs] syn keyword issDirsFlags deleteafterinstall uninsalwaysuninstall uninsneveruninstall @@ -63,6 +69,8 @@ syn keyword issFilesFlags isreadme onlyifdestfileexists onlyifdoesntexist overwr syn keyword issFilesFlags promptifolder recursesubdirs regserver regtypelib restartreplace syn keyword issFilesFlags sharedfile skipifsourcedoesntexist sortfilesbyextension touch syn keyword issFilesFlags uninsremovereadonly uninsrestartdelete uninsneveruninstall +syn keyword issFilesFlags replacesameversion nocompression noencryption noregerror + " [Icons] syn keyword issIconsFlags closeonexit createonlyiffileexists dontcloseonexit @@ -108,30 +116,30 @@ if version >= 508 || !exists("did_iss_syntax_inits") endif " The default methods for highlighting. Can be overridden later - HiLink issHeader Special - HiLink issComment Comment - HiLink issLabel Type - HiLink issName Type - HiLink issFolder Special - HiLink issString String - HiLink issValue String - HiLink issURL Include - HiLink issPreProc PreProc - - HiLink issDirsFlags Keyword - HiLink issFilesCopyMode Keyword - HiLink issFilesAttribs Keyword - HiLink issFilesFlags Keyword - HiLink issIconsFlags Keyword - HiLink issINIFlags Keyword - HiLink issRegRootKey Keyword - HiLink issRegValueType Keyword - HiLink issRegFlags Keyword - HiLink issRunFlags Keyword - HiLink issTypesFlags Keyword - HiLink issComponentsFlags Keyword - HiLink issInstallDeleteType Keyword - HiLink issTasksFlags Keyword + HiLink issSection Special + HiLink issComment Comment + HiLink issDirective Type + HiLink issParam Type + HiLink issFolder Special + HiLink issString String + HiLink issURL Include + HiLink issPreProc PreProc + + HiLink issDirsFlags Keyword + HiLink issFilesCopyMode Keyword + HiLink issFilesAttribs Keyword + HiLink issFilesPermissions Keyword + HiLink issFilesFlags Keyword + HiLink issIconsFlags Keyword + HiLink issINIFlags Keyword + HiLink issRegRootKey Keyword + HiLink issRegValueType Keyword + HiLink issRegFlags Keyword + HiLink issRunFlags Keyword + HiLink issTypesFlags Keyword + HiLink issComponentsFlags Keyword + HiLink issInstallDeleteType Keyword + HiLink issTasksFlags Keyword delcommand HiLink endif diff --git a/runtime/syntax/netrc.vim b/runtime/syntax/netrc.vim new file mode 100644 index 000000000..83940eb9d --- /dev/null +++ b/runtime/syntax/netrc.vim @@ -0,0 +1,55 @@ +" Vim syntax file +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/ +" Latest Revision: 2004-12-16 +" arch-tag: 4f6ecb37-d10c-4eca-add0-77991559414a + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Keywords +syn keyword netrcKeyword machine password nextgroup=netrcName skipwhite skipnl +syn keyword netrcKeyword login nextgroup=netrcName,netrcSpecial skipwhite skipnl +syn keyword netrcKeyword default +syn keyword netrcKeyword macdef nextgroup=netrcInit,netrcMacroName skipwhite skipnl +syn region netrcMacro contained start='.' end='^$' + +" Names +syn match netrcName contained display '\S\+' +syn match netrcName contained display '"[^\\"]*\(\\.[^\\"]*\)*' +syn match netrcMacroName contained display '\S\+' nextgroup=netrcMacro skipwhite skipnl +syn match netrcMacroName contained display '"[^\\"]*\(\\.[^\\"]*\)*' nextgroup=netrcMacro skipwhite skipnl + +" Special +syn keyword netrcSpecial contained anonymous +syn match netrcInit contained '\<init$' nextgroup=netrcMacro skipwhite skipnl + +syn sync fromstart + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_netrc_syn_inits") + if version < 508 + let did_netrc_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink netrcKeyword Keyword + HiLink netrcMacro PreProc + HiLink netrcName String + HiLink netrcMacroName String + HiLink netrcSpecial Special + HiLink netrcInit Special + + delcommand HiLink +endif + +let b:current_syntax = "netrc" + +" vim: set sts=2 sw=2: diff --git a/runtime/syntax/sudoers.vim b/runtime/syntax/sudoers.vim new file mode 100644 index 000000000..72a7890be --- /dev/null +++ b/runtime/syntax/sudoers.vim @@ -0,0 +1,290 @@ +" Vim syntax file +" Language: sudoers(5) configuration files. +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/ +" Latest Revision: 2004-12-17 +" arch-tag: 02fc3bc8-4308-466f-b83e-718a7487b198 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" TODO: instead of 'skipnl', we would like to match a specific group that would +" match \\$ and then continue with the nextgroup, actually, the skipnl doesn't +" work... +" TODO: treat 'ALL' like a special (yay, a bundle of new rules!!!) + +" User Specs +syn match sudoersUserSpec '^' nextgroup=@sudoersUserInSpec skipwhite + +syn match sudoersSpecEquals contained '=' nextgroup=@sudoersCmndSpecList skipwhite + +syn cluster sudoersCmndSpecList contains=sudoersUserRunasBegin,sudoersPASSWD,@sudoersCmndInSpec + +" Todo +syn keyword sudoersTodo contained TODO FIXME XXX NOTE + +" Comments +syn region sudoersComment matchgroup=sudoersComment start='#' end='$' contains=sudoersTodo + +" Aliases +syn keyword sudoersAlias User_Alias Runas_Alias nextgroup=sudoersUserAlias skipwhite skipnl +syn keyword sudoersAlias Host_Alias nextgroup=sudoersHostAlias skipwhite skipnl +syn keyword sudoersAlias Cmnd_Alias nextgroup=sudoersCmndAlias skipwhite skipnl + +" Names +syn match sudoersUserAlias contained '\<\u[A-Z0-9_]*\>' nextgroup=sudoersUserAliasEquals skipwhite skipnl +syn match sudoersUserNameInList contained '\<\l\+\>' nextgroup=@sudoersUserList skipwhite skipnl +syn match sudoersUIDInList contained '#\d\+\>' nextgroup=@sudoersUserList skipwhite skipnl +syn match sudoersGroupInList contained '%\l\+\>' nextgroup=@sudoersUserList skipwhite skipnl +syn match sudoersUserNetgroupInList contained '+\l\+\>' nextgroup=@sudoersUserList skipwhite skipnl +syn match sudoersUserAliasInList contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersUserList skipwhite skipnl + +syn match sudoersUserName contained '\<\l\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersUID contained '#\d\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersGroup contained '%\l\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersUserNetgroup contained '+\l\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersUserAliasRef contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersParameter skipwhite skipnl + +syn match sudoersUserNameInSpec contained '\<\l\+\>' nextgroup=@sudoersUserSpec skipwhite skipnl +syn match sudoersUIDInSpec contained '#\d\+\>' nextgroup=@sudoersUserSpec skipwhite skipnl +syn match sudoersGroupInSpec contained '%\l\+\>' nextgroup=@sudoersUserSpec skipwhite skipnl +syn match sudoersUserNetgroupInSpec contained '+\l\+\>' nextgroup=@sudoersUserSpec skipwhite skipnl +syn match sudoersUserAliasInSpec contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersUserSpec skipwhite skipnl + +syn match sudoersUserNameInRunas contained '\<\l\+\>' nextgroup=@sudoersUserRunas skipwhite skipnl +syn match sudoersUIDInRunas contained '#\d\+\>' nextgroup=@sudoersUserRunas skipwhite skipnl +syn match sudoersGroupInRunas contained '%\l\+\>' nextgroup=@sudoersUserRunas skipwhite skipnl +syn match sudoersUserNetgroupInRunas contained '+\l\+\>' nextgroup=@sudoersUserRunas skipwhite skipnl +syn match sudoersUserAliasInRunas contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersUserRunas skipwhite skipnl + +syn match sudoersHostAlias contained '\<\u[A-Z0-9_]*\>' nextgroup=sudoersHostAliasEquals skipwhite skipnl +syn match sudoersHostNameInList contained '\<\l\+\>' nextgroup=@sudoersHostList skipwhite skipnl +syn match sudoersIPAddrInList contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}' nextgroup=@sudoersHostList skipwhite skipnl +syn match sudoersNetworkInList contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}\%(/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\)\=' nextgroup=@sudoersHostList skipwhite skipnl +syn match sudoersHostNetgroupInList contained '+\l\+\>' nextgroup=@sudoersHostList skipwhite skipnl +syn match sudoersHostAliasInList contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersHostList skipwhite skipnl + +syn match sudoersHostName contained '\<\l\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersIPAddr contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersNetwork contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}\%(/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\)\=' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersHostNetgroup contained '+\l\+\>' nextgroup=@sudoersParameter skipwhite skipnl +syn match sudoersHostAliasRef contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersParameter skipwhite skipnl + +syn match sudoersHostNameInSpec contained '\<\l\+\>' nextgroup=@sudoersHostSpec skipwhite skipnl +syn match sudoersIPAddrInSpec contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}' nextgroup=@sudoersHostSpec skipwhite skipnl +syn match sudoersNetworkInSpec contained '\%(\d\{1,3}\.\)\{3}\d\{1,3}\%(/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\)\=' nextgroup=@sudoersHostSpec skipwhite skipnl +syn match sudoersHostNetgroupInSpec contained '+\l\+\>' nextgroup=@sudoersHostSpec skipwhite skipnl +syn match sudoersHostAliasInSpec contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersHostSpec skipwhite skipnl + +syn match sudoersCmndAlias contained '\<\u[A-Z0-9_]*\>' nextgroup=sudoersCmndAliasEquals skipwhite skipnl +syn match sudoersCmndNameInList contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=@sudoersCmndList,sudoersCommandEmpty,sudoersCommandArgs skipwhite +syn match sudoersCmndAliasInList contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersCmndList skipwhite skipnl + +syn match sudoersCmndNameInSpec contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=@sudoersCmndSpec,sudoersCommandEmptyInSpec,sudoersCommandArgsInSpec skipwhite +syn match sudoersCmndAliasInSpec contained '\<\u[A-Z0-9_]*\>' nextgroup=@sudoersCmndSpec skipwhite skipnl + +" Delimiters +syn match sudoersUserAliasEquals contained '=' nextgroup=@sudoersUserInList skipwhite skipnl +syn match sudoersUserListComma contained ',' nextgroup=@sudoersUserInList skipwhite skipnl +syn match sudoersUserListColon contained ':' nextgroup=sudoersUserAlias skipwhite skipnl +syn cluster sudoersUserList contains=sudoersUserListComma,sudoersUserListColon + +syn match sudoersUserSpecComma contained ',' nextgroup=@sudoersUserInSpec skipwhite skipnl +syn cluster sudoersUserSpec contains=sudoersUserSpecComma,@sudoersHostInSpec + +syn match sudoersUserRunasBegin contained '(' nextgroup=@sudoersUserInRunas skipwhite skipnl +syn match sudoersUserRunasComma contained ',' nextgroup=@sudoersUserInRunas skipwhite skipnl +syn match sudoersUserRunasEnd contained ')' nextgroup=sudoersPASSWD,@sudoersCmndInSpec skipwhite skipnl +syn cluster sudoersUserRunas contains=sudoersUserRunasComma,@sudoersUserInRunas,sudoersUserRunasEnd + + +syn match sudoersHostAliasEquals contained '=' nextgroup=@sudoersHostInList skipwhite skipnl +syn match sudoersHostListComma contained ',' nextgroup=@sudoersHostInList skipwhite skipnl +syn match sudoersHostListColon contained ':' nextgroup=sudoersHostAlias skipwhite skipnl +syn cluster sudoersHostList contains=sudoersHostListComma,sudoersHostListColon + +syn match sudoersHostSpecComma contained ',' nextgroup=@sudoersHostInSpec skipwhite skipnl +syn cluster sudoersHostSpec contains=sudoersHostSpecComma,sudoersSpecEquals + + +syn match sudoersCmndAliasEquals contained '=' nextgroup=@sudoersCmndInList skipwhite skipnl +syn match sudoersCmndListComma contained ',' nextgroup=@sudoersCmndInList skipwhite skipnl +syn match sudoersCmndListColon contained ':' nextgroup=sudoersCmndAlias skipwhite skipnl +syn cluster sudoersCmndList contains=sudoersCmndListComma,sudoersCmndListColon + +syn match sudoersCmndSpecComma contained ',' nextgroup=@sudoersCmndSpecList skipwhite skipnl +syn match sudoersCmndSpecColon contained ':' nextgroup=@sudoersUserInSpec skipwhite skipnl +syn cluster sudoersCmndSpec contains=sudoersCmndSpecComma,sudoersCmndSpecColon + +" Lists +syn cluster sudoersUserInList contains=sudoersUserNegationInList,sudoersUserNameInList,sudoersUIDInList,sudoersGroupInList,sudoersUserNetgroupInList,sudoersUserAliasInList +syn cluster sudoersHostInList contains=sudoersHostNegationInList,sudoersHostNameInList,sudoersIPAddrInList,sudoersNetworkInList,sudoersHostNetgroupInList,sudoersHostAliasInList +syn cluster sudoersCmndInList contains=sudoersCmndNegationInList,sudoersCmndNameInList,sudoersCmndAliasInList + +syn cluster sudoersUser contains=sudoersUserNegation,sudoersUserName,sudoersUID,sudoersGroup,sudoersUserNetgroup,sudoersUserAliasRef +syn cluster sudoersHost contains=sudoersHostNegation,sudoersHostName,sudoersIPAddr,sudoersNetwork,sudoersHostNetgroup,sudoersHostAliasRef + +syn cluster sudoersUserInSpec contains=sudoersUserNegationInSpec,sudoersUserNameInSpec,sudoersUIDInSpec,sudoersGroupInSpec,sudoersUserNetgroupInSpec,sudoersUserAliasInSpec +syn cluster sudoersHostInSpec contains=sudoersHostNegationInSpec,sudoersHostNameInSpec,sudoersIPAddrInSpec,sudoersNetworkInSpec,sudoersHostNetgroupInSpec,sudoersHostAliasInSpec +syn cluster sudoersUserInRunas contains=sudoersUserNegationInRunas,sudoersUserNameInRunas,sudoersUIDInRunas,sudoersGroupInRunas,sudoersUserNetgroupInRunas,sudoersUserAliasInRunas +syn cluster sudoersCmndInSpec contains=sudoersCmndNegationInSpec,sudoersCmndNameInSpec,sudoersCmndAliasInSpec + +" Operators +syn match sudoersUserNegationInList contained '!\+' nextgroup=@sudoersUserInList skipwhite skipnl +syn match sudoersHostNegationInList contained '!\+' nextgroup=@sudoersHostInList skipwhite skipnl +syn match sudoersCmndNegationInList contained '!\+' nextgroup=@sudoersCmndInList skipwhite skipnl + +syn match sudoersUserNegation contained '!\+' nextgroup=@sudoersUser skipwhite skipnl +syn match sudoersHostNegation contained '!\+' nextgroup=@sudoersHost skipwhite skipnl + +syn match sudoersUserNegationInSpec contained '!\+' nextgroup=@sudoersUserInSpec skipwhite skipnl +syn match sudoersHostNegationInSpec contained '!\+' nextgroup=@sudoersHostInSpec skipwhite skipnl +syn match sudoersUserNegationInRunas contained '!\+' nextgroup=@sudoersUserInRunas skipwhite skipnl +syn match sudoersCmndNegationInSpec contained '!\+' nextgroup=@sudoersCmndInSpec skipwhite skipnl + +" Arguments +syn match sudoersCommandArgs contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersCommandArgs,@sudoersCmndList skipwhite +syn match sudoersCommandEmpty contained '""' nextgroup=@sudoersCmndList skipwhite skipnl + +syn match sudoersCommandArgsInSpec contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersCommandArgsInSpec,@sudoersCmndSpec skipwhite +syn match sudoersCommandEmptyInSpec contained '""' nextgroup=@sudoersCmndSpec skipwhite skipnl + +" Default Entries +syn keyword sudoersDefaultEntry Defaults nextgroup=sudoersDefaultTypeAt,sudoersDefaultTypeColon,sudoersDefaultTypeGreaterThan,@sudoersParameter skipwhite skipnl +syn match sudoersDefaultTypeAt contained '@' nextgroup=@sudoersHost skipwhite skipnl +syn match sudoersDefaultTypeColon contained ':' nextgroup=@sudoersUser skipwhite skipnl +syn match sudoersDefaultTypeGreaterThan contained '>' nextgroup=@sudoersUser skipwhite skipnl + +" TODO: could also deal with special characters here +syn keyword sudoersBooleanParameter contained long_opt_prompt ignore_dot mail_always mail_badpass mail_no_user mail_no_perms tty_tickets lecture authenticate root_sudo log_host log_year shell_noargs set_home always_set_home path_info preserve_groups fqdn insults requiretty env_editor rootpw runaspw targetpw set_logname stay_setuid env_reset use_loginclass nextgroup=sudoersParameterListComma skipwhite skipnl +syn keyword sudoersIntegerParameter contained passwd_tries loglinelen timestamp_timeout passwd_timeout umask nextgroup=sudoersIntegerParameterEquals skipwhite skipnl +syn keyword sudoersStringParameter contained mailsub badpass_message timestampdir timestampowner passprompt runas_default syslog_goodpri syslog_badpri editor logfile syslog mailerpath mailerflags mailto exempt_group verifypw listpw nextgroup=sudoersStringParameterEquals skipwhite skipnl +syn keyword sudoersListParameter contained env_check env_delete env_keep nextgroup=sudoersListParameterEquals skipwhite skipnl + +syn match sudoersParameterListComma contained ',' nextgroup=@sudoersParameter skipwhite skipnl + +syn cluster sudoersParameter contains=sudoersBooleanParameter,sudoersIntegerParameterEquals,sudoersStringParameter,sudoersListParameter + +syn match sudoersIntegerParameterEquals contained '[+-]\==' nextgroup=sudoersIntegerValue skipwhite skipnl +syn match sudoersStringParameterEquals contained '[+-]\==' nextgroup=sudoersStringValue skipwhite skipnl +syn match sudoersListParameterEquals contained '[+-]\==' nextgroup=sudoersListValue skipwhite skipnl + +syn match sudoersIntegerValue contained '\d\+' nextgroup=sudoersParameterListComma skipwhite skipnl +syn match sudoersStringValue contained '[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl +syn region sudoersStringValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl +syn match sudoersListValue contained '[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl +syn region sudoersListValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl + +" Special for specs +syn match sudoersPASSWD contained '\%(NO\)\=PASSWD:' nextgroup=@sudoersCmndInSpec skipwhite + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_sudoers_syn_inits") + if version < 508 + let did_sudoers_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink sudoersSpecEquals Operator + HiLink sudoersTodo Todo + HiLink sudoersComment Comment + HiLink sudoersAlias Keyword + HiLink sudoersUserAlias Identifier + HiLink sudoersUserNameInList String + HiLink sudoersUIDInList Number + HiLink sudoersGroupInList PreProc + HiLink sudoersUserNetgroupInList PreProc + HiLink sudoersUserAliasInList PreProc + HiLink sudoersUserName String + HiLink sudoersUID Number + HiLink sudoersGroup PreProc + HiLink sudoersUserNetgroup PreProc + HiLink sudoersUserAliasRef PreProc + HiLink sudoersUserNameInSpec String + HiLink sudoersUIDInSpec Number + HiLink sudoersGroupInSpec PreProc + HiLink sudoersUserNetgroupInSpec PreProc + HiLink sudoersUserAliasInSpec PreProc + HiLink sudoersUserNameInRunas String + HiLink sudoersUIDInRunas Number + HiLink sudoersGroupInRunas PreProc + HiLink sudoersUserNetgroupInRunas PreProc + HiLink sudoersUserAliasInRunas PreProc + HiLink sudoersHostAlias Identifier + HiLink sudoersHostNameInList String + HiLink sudoersIPAddrInList Number + HiLink sudoersNetworkInList Number + HiLink sudoersHostNetgroupInList PreProc + HiLink sudoersHostAliasInList PreProc + HiLink sudoersHostName String + HiLink sudoersIPAddr Number + HiLink sudoersNetwork Number + HiLink sudoersHostNetgroup PreProc + HiLink sudoersHostAliasRef PreProc + HiLink sudoersHostNameInSpec String + HiLink sudoersIPAddrInSpec Number + HiLink sudoersNetworkInSpec Number + HiLink sudoersHostNetgroupInSpec PreProc + HiLink sudoersHostAliasInSpec PreProc + HiLink sudoersCmndAlias Identifier + HiLink sudoersCmndNameInList String + HiLink sudoersCmndAliasInList PreProc + HiLink sudoersCmndNameInSpec String + HiLink sudoersCmndAliasInSpec PreProc + HiLink sudoersUserAliasEquals Operator + HiLink sudoersUserListComma Delimiter + HiLink sudoersUserListColon Delimiter + HiLink sudoersUserSpecComma Delimiter + HiLink sudoersUserRunasBegin Delimiter + HiLink sudoersUserRunasComma Delimiter + HiLink sudoersUserRunasEnd Delimiter + HiLink sudoersHostAliasEquals Operator + HiLink sudoersHostListComma Delimiter + HiLink sudoersHostListColon Delimiter + HiLink sudoersHostSpecComma Delimiter + HiLink sudoersCmndAliasEquals Operator + HiLink sudoersCmndListComma Delimiter + HiLink sudoersCmndListColon Delimiter + HiLink sudoersCmndSpecComma Delimiter + HiLink sudoersCmndSpecColon Delimiter + HiLink sudoersUserNegationInList Operator + HiLink sudoersHostNegationInList Operator + HiLink sudoersCmndNegationInList Operator + HiLink sudoersUserNegation Operator + HiLink sudoersHostNegation Operator + HiLink sudoersUserNegationInSpec Operator + HiLink sudoersHostNegationInSpec Operator + HiLink sudoersUserNegationInRunas Operator + HiLink sudoersCmndNegationInSpec Operator + HiLink sudoersCommandArgs String + HiLink sudoersCommandEmpty Special + HiLink sudoersDefaultEntry Keyword + HiLink sudoersDefaultTypeAt Special + HiLink sudoersDefaultTypeColon Special + HiLink sudoersDefaultTypeGreaterThan Special + HiLink sudoersBooleanParameter Identifier + HiLink sudoersIntegerParameter Identifier + HiLink sudoersStringParameter Identifier + HiLink sudoersListParameter Identifier + HiLink sudoersParameterListComma Delimiter + HiLink sudoersIntegerParameterEquals Operator + HiLink sudoersStringParameterEquals Operator + HiLink sudoersListParameterEquals Operator + HiLink sudoersIntegerValue Number + HiLink sudoersStringValue String + HiLink sudoersListValue String + HiLink sudoersPASSWD Special + + delcommand HiLink +endif + +let b:current_syntax = "sudoers" + +" vim: set sts=2 sw=2: |