2
" Language: PlainBox Unit Definition
3
" Maintainer: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
4
" Last Change: 2014 Mar 04
5
" URL: https://launchpad.net/checkbox
7
" This file is part of Checkbox.
9
" Copyright 2012 Canonical Ltd.
11
" Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
13
" Checkbox is free software: you can redistribute it and/or modify
14
" it under the terms of the GNU General Public License version 3,
15
" as published by the Free Software Foundation.
17
" Checkbox is distributed in the hope that it will be useful,
18
" but WITHOUT ANY WARRANTY; without even the implied warranty of
19
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
" GNU General Public License for more details.
22
" You should have received a copy of the GNU General Public License
23
" along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
25
" Standard syntax initialization
28
elseif exists("b:current_syntax")
32
" Should match case except for the keys of each field
35
" Everything that is not explicitly matched by the rules below
36
syn match pxuElse "^.*$"
39
syn match pxuComma ", *"
40
syn match pxuSpace " "
42
" Define some common expressions we can use later on
43
syn match pxuPlugin contained "\%(shell\|manual\|local\|resource\|attachment\|user-interact\|user-verify\|user-interact-verify\)"
44
syn match pxuFlags contained "\%(preserve-locale\|expected-failure\|legacy-remote\|multi-node\)"
45
syn match pxuId contained "[a-z0-9][a-z0-9+./:-]\+"
46
syn match pxuVariable contained "\${.\{-}}"
47
syn match pxuSpecialVariable contained "\%(\$PLAINBOX_SESSION_SHARE\|\$PLAINBOX_PROVIDER_DATA\)"
48
syn match pxuDeprecatedVariable contained "\%(\$CHECKBOX_SHARE\|\$CHECKBOX_DATA\)"
49
syn match pxuEstimatedDuration contained "\<\d+(\.\d+)?\>"
50
syn match pxuColonColon contained "::"
53
syn match pxuComment "^#.*$" contains=@Spell
57
" leading dot in multi-line fields
58
syn match pxuLeadingDot contained "^\s+\."
60
" List of all legal keys
61
syn match pxuKey contained "^\%(id\|plugin\|_?summary\|_?description\|requires\|depends\|estimated_duration\|command\|user\|environ\|flags\): *"
63
syn match pxuDeprecatedKey contained "^\%(name\): *"
65
" Fields for which we do strict syntax checking
66
syn region pxuStrictField start="^id" end="$" contains=pxuKey,pxuId,pxuSpace oneline
67
syn region pxuStrictField start="^plugin" end="$" contains=pxuKey,pxuPlugin,pxuSpace oneline
68
syn region pxuStrictField start="^flags" end="$" contains=pxuKey,pxuFlags,pxuSpace oneline
69
syn region pxuStrictField start="^estimated_duration" end="$" contains=pxuKey,pxuEstimatedDuration,pxuSpace oneline
71
" Catch-all for the other legal fields
72
syn region pxuField start="^\%(id\|plugin\|_?summary\|_?description\|requires\|depends\|estimated_duration\|command\|user\|environ\):" end="$" contains=pxuKey,pxuDeprecatedKey,pxuVariable,pxuColonColon,pxuId oneline
73
syn region pxuMultiField start="^\%(command\|depends\|requires\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=pxuKey,pxuDeprecatedkey,pxuVariable,pxuSpecialVariable,pxuDeprecatedVariable,pxuId,pxuComment,pxuLeadingDot
74
syn region pxuMultiFieldSpell start="^_?\%(description\|summary\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=pxuKey,pxuDeprecatedKey,pxuComment,pxuLeadingDot,@Spell
76
" Associate our matches and regions with pretty colours
77
if version >= 508 || !exists("did_pxu_syn_inits")
79
let did_pxu_syn_inits = 1
80
command -nargs=+ HiLink hi link <args>
82
command -nargs=+ HiLink hi def link <args>
85
HiLink pxuPlugin Keyword
87
HiLink pxuField Normal
88
HiLink pxuStrictField Error
89
HiLink pxuDeprecatedKey Error
90
HiLink pxuDeprecatedVariable Error
91
HiLink pxuEstimatedDuratin Float
92
HiLink pxuMultiField Normal
93
HiLink pxuMultiFieldSpell Normal
94
HiLink pxuId Identifier
95
HiLink pxuFlags Identifier
96
HiLink pxuVariable Identifier
97
HiLink pxuSpecialVariable Identifier
98
HiLink pxuComment Comment
99
HiLink pxuElse Special
100
HiLink pxuLeadingDot Error
101
HiLink pxuColonColon Keyword
106
let b:current_syntax = "pxu"