Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | " Language: SysV-compatible init process control file `inittab' |
Bram Moolenaar | 403f3eb | 2019-11-20 22:31:13 +0100 | [diff] [blame] | 3 | " Maintainer: Donovan Keohane <donovan.keohane@gmail.com> |
| 4 | " Previous Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz> |
| 5 | " Last Change: 2019-11-19 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
| 7 | " Setup |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 8 | " quit when a syntax file was already loaded |
| 9 | if exists("b:current_syntax") |
| 10 | finish |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 11 | endif |
| 12 | |
| 13 | syn case match |
| 14 | |
| 15 | " Base constructs |
| 16 | syn match inittabError "[^:]\+:"me=e-1 contained |
| 17 | syn match inittabError "[^:]\+$" contained |
| 18 | syn match inittabComment "^[#:].*$" contains=inittabFixme |
| 19 | syn match inittabComment "#.*$" contained contains=inittabFixme |
| 20 | syn keyword inittabFixme FIXME TODO XXX NOT |
| 21 | |
| 22 | " Shell |
| 23 | syn region inittabShString start=+"+ end=+"+ skip=+\\\\\|\\\"+ contained |
| 24 | syn region inittabShString start=+'+ end=+'+ contained |
| 25 | syn match inittabShOption "\s[-+][[:alnum:]]\+"ms=s+1 contained |
| 26 | syn match inittabShOption "\s--[:alnum:][-[:alnum:]]*"ms=s+1 contained |
Bram Moolenaar | 403f3eb | 2019-11-20 22:31:13 +0100 | [diff] [blame] | 27 | syn match inittabShCommand "\S\+" contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | syn cluster inittabSh add=inittabShOption,inittabShString,inittabShCommand |
| 29 | |
| 30 | " Keywords |
| 31 | syn keyword inittabActionName respawn wait once boot bootwait off ondemand sysinit powerwait powerfail powerokwait powerfailnow ctrlaltdel kbrequest initdefault contained |
| 32 | |
| 33 | " Line parser |
| 34 | syn match inittabId "^[[:alnum:]~]\{1,4}" nextgroup=inittabColonRunLevels,inittabError |
| 35 | syn match inittabColonRunLevels ":" contained nextgroup=inittabRunLevels,inittabColonAction,inittabError |
| 36 | syn match inittabRunLevels "[0-6A-Ca-cSs]\+" contained nextgroup=inittabColonAction,inittabError |
| 37 | syn match inittabColonAction ":" contained nextgroup=inittabAction,inittabError |
| 38 | syn match inittabAction "\w\+" contained nextgroup=inittabColonProcess,inittabError contains=inittabActionName |
| 39 | syn match inittabColonProcess ":" contained nextgroup=inittabProcessPlus,inittabProcess,inittabError |
| 40 | syn match inittabProcessPlus "+" contained nextgroup=inittabProcess,inittabError |
Bram Moolenaar | 403f3eb | 2019-11-20 22:31:13 +0100 | [diff] [blame] | 41 | syn region inittabProcess start="\S" end="$" transparent oneline contained contains=@inittabSh,inittabComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | |
| 43 | " Define the default highlighting |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 44 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 45 | hi def link inittabComment Comment |
| 46 | hi def link inittabFixme Todo |
| 47 | hi def link inittabActionName Type |
| 48 | hi def link inittabError Error |
| 49 | hi def link inittabId Identifier |
| 50 | hi def link inittabRunLevels Special |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 51 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 52 | hi def link inittabColonProcess inittabColon |
| 53 | hi def link inittabColonAction inittabColon |
| 54 | hi def link inittabColonRunLevels inittabColon |
| 55 | hi def link inittabColon PreProc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 57 | hi def link inittabShString String |
| 58 | hi def link inittabShOption Special |
| 59 | hi def link inittabShCommand Statement |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 60 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 61 | |
| 62 | let b:current_syntax = "inittab" |