Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 214641f | 2017-03-05 17:04:09 +0100 | [diff] [blame] | 2 | " Language: pam(8) configuration file |
| 3 | " Previous Maintainer: Nikolai Weibull <now@bitwi.se> |
Christian Brabandt | 807fff1 | 2024-03-31 18:04:21 +0200 | [diff] [blame] | 4 | " Latest Change: 2024/03/31 |
Bram Moolenaar | e7b1ea0 | 2020-08-07 19:54:59 +0200 | [diff] [blame] | 5 | " Changes By: Haochen Tong |
Christian Brabandt | 807fff1 | 2024-03-31 18:04:21 +0200 | [diff] [blame] | 6 | " Vim Project for the @include syntax |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 7 | |
| 8 | if exists("b:current_syntax") |
| 9 | finish |
| 10 | endif |
| 11 | |
| 12 | let s:cpo_save = &cpo |
| 13 | set cpo&vim |
| 14 | |
Bram Moolenaar | e7b1ea0 | 2020-08-07 19:54:59 +0200 | [diff] [blame] | 15 | let s:has_service_field = exists("b:pamconf_has_service_field") |
| 16 | \ ? b:pamconf_has_service_field |
| 17 | \ : expand('%:t') == 'pam.conf' ? 1 : 0 |
| 18 | |
| 19 | syn match pamconfType '-\?[[:alpha:]]\+' |
| 20 | \ contains=pamconfTypeKeyword |
| 21 | \ nextgroup=pamconfControl, |
| 22 | \ pamconfTypeLineCont skipwhite |
| 23 | |
| 24 | syn keyword pamconfTypeKeyword contained account auth password session |
| 25 | |
Christian Brabandt | 807fff1 | 2024-03-31 18:04:21 +0200 | [diff] [blame] | 26 | " The @include syntax is Debian specific |
| 27 | syn match pamconfInclude '^@include' |
| 28 | \ nextgroup=pamconfIncludeFile |
| 29 | \ skipwhite |
| 30 | |
| 31 | syn match pamconfIncludeFile '\f\+$' |
| 32 | |
Bram Moolenaar | e7b1ea0 | 2020-08-07 19:54:59 +0200 | [diff] [blame] | 33 | if s:has_service_field |
| 34 | syn match pamconfService '^[[:graph:]]\+' |
| 35 | \ nextgroup=pamconfType, |
| 36 | \ pamconfServiceLineCont skipwhite |
| 37 | |
| 38 | syn match pamconfServiceLineCont contained '\\$' |
| 39 | \ nextgroup=pamconfType, |
| 40 | \ pamconfServiceLineCont skipwhite skipnl |
| 41 | endif |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 42 | |
| 43 | syn keyword pamconfTodo contained TODO FIXME XXX NOTE |
| 44 | |
| 45 | syn region pamconfComment display oneline start='#' end='$' |
| 46 | \ contains=pamconfTodo,@Spell |
| 47 | |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 48 | syn match pamconfTypeLineCont contained '\\$' |
| 49 | \ nextgroup=pamconfControl, |
| 50 | \ pamconfTypeLineCont skipwhite skipnl |
| 51 | |
| 52 | syn keyword pamconfControl contained requisite required sufficient |
Bram Moolenaar | 5302d9e | 2011-09-14 17:55:08 +0200 | [diff] [blame] | 53 | \ optional include substack |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 54 | \ nextgroup=pamconfMPath, |
| 55 | \ pamconfControlLineContH skipwhite |
| 56 | |
| 57 | syn match pamconfControlBegin '\[' nextgroup=pamconfControlValues, |
| 58 | \ pamconfControlLineCont skipwhite |
| 59 | |
| 60 | syn match pamconfControlLineCont contained '\\$' |
| 61 | \ nextgroup=pamconfControlValues, |
| 62 | \ pamconfControlLineCont skipwhite skipnl |
| 63 | |
| 64 | syn keyword pamconfControlValues contained success open_err symbol_err |
| 65 | \ service_err system_err buf_err |
| 66 | \ perm_denied auth_err cred_insufficient |
| 67 | \ authinfo_unavail user_unknown maxtries |
| 68 | \ new_authtok_reqd acct_expired session_err |
| 69 | \ cred_unavail cred_expired cred_err |
| 70 | \ no_module_data conv_err authtok_err |
| 71 | \ authtok_recover_err authtok_lock_busy |
| 72 | \ authtok_disable_aging try_again ignore |
| 73 | \ abort authtok_expired module_unknown |
| 74 | \ bad_item and default |
| 75 | \ nextgroup=pamconfControlValueEq |
| 76 | |
Bram Moolenaar | 5302d9e | 2011-09-14 17:55:08 +0200 | [diff] [blame] | 77 | syn match pamconfControlValueEq contained '=' |
| 78 | \ nextgroup=pamconfControlActionN, |
| 79 | \ pamconfControlAction |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 80 | |
| 81 | syn match pamconfControlActionN contained '\d\+\>' |
| 82 | \ nextgroup=pamconfControlValues, |
| 83 | \ pamconfControlLineCont,pamconfControlEnd |
| 84 | \ skipwhite |
| 85 | syn keyword pamconfControlAction contained ignore bad die ok done reset |
| 86 | \ nextgroup=pamconfControlValues, |
| 87 | \ pamconfControlLineCont,pamconfControlEnd |
| 88 | \ skipwhite |
| 89 | |
| 90 | syn match pamconfControlEnd contained '\]' |
| 91 | \ nextgroup=pamconfMPath, |
| 92 | \ pamconfControlLineContH skipwhite |
| 93 | |
| 94 | syn match pamconfControlLineContH contained '\\$' |
| 95 | \ nextgroup=pamconfMPath, |
| 96 | \ pamconfControlLineContH skipwhite skipnl |
| 97 | |
| 98 | syn match pamconfMPath contained '\S\+' |
| 99 | \ nextgroup=pamconfMPathLineCont, |
| 100 | \ pamconfArgs skipwhite |
| 101 | |
| 102 | syn match pamconfArgs contained '\S\+' |
| 103 | \ nextgroup=pamconfArgsLineCont, |
| 104 | \ pamconfArgs skipwhite |
| 105 | |
| 106 | syn match pamconfMPathLineCont contained '\\$' |
| 107 | \ nextgroup=pamconfMPathLineCont, |
| 108 | \ pamconfArgs skipwhite skipnl |
| 109 | |
| 110 | syn match pamconfArgsLineCont contained '\\$' |
| 111 | \ nextgroup=pamconfArgsLineCont, |
| 112 | \ pamconfArgs skipwhite skipnl |
| 113 | |
| 114 | hi def link pamconfTodo Todo |
| 115 | hi def link pamconfComment Comment |
| 116 | hi def link pamconfService Statement |
| 117 | hi def link pamconfServiceLineCont Special |
Bram Moolenaar | e7b1ea0 | 2020-08-07 19:54:59 +0200 | [diff] [blame] | 118 | hi def link pamconfType Special |
| 119 | hi def link pamconfTypeKeyword Type |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 120 | hi def link pamconfTypeLineCont pamconfServiceLineCont |
| 121 | hi def link pamconfControl Macro |
| 122 | hi def link pamconfControlBegin Delimiter |
| 123 | hi def link pamconfControlLineContH pamconfServiceLineCont |
| 124 | hi def link pamconfControlLineCont pamconfServiceLineCont |
| 125 | hi def link pamconfControlValues Identifier |
| 126 | hi def link pamconfControlValueEq Operator |
| 127 | hi def link pamconfControlActionN Number |
| 128 | hi def link pamconfControlAction Identifier |
| 129 | hi def link pamconfControlEnd Delimiter |
| 130 | hi def link pamconfMPath String |
| 131 | hi def link pamconfMPathLineCont pamconfServiceLineCont |
| 132 | hi def link pamconfArgs Normal |
| 133 | hi def link pamconfArgsLineCont pamconfServiceLineCont |
Christian Brabandt | 807fff1 | 2024-03-31 18:04:21 +0200 | [diff] [blame] | 134 | hi def link pamconfInclude Include |
| 135 | hi def link pamconfIncludeFile Include |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 136 | |
| 137 | let b:current_syntax = "pamconf" |
| 138 | |
| 139 | let &cpo = s:cpo_save |
| 140 | unlet s:cpo_save |