aboutsummaryrefslogtreecommitdiff
path: root/vim/syntax/paludis-repositories-conf.vim
blob: 44cf990b8854e118ecf7f3c50e47fd6f63cc8b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
" Vim syntax file
" Language:     Paludis repositories/*.conf files
" Author:       Ciaran McCreesh
" Copyright:    Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
" Licence:      You may redistribute this under the same terms as Vim itself
"
" Syntax highlighting for Paludis repositories/*.conf files.
"

if &compatible || v:version < 700
    finish
endif

if exists("b:current_syntax")
  finish
endif

syn region PaludisRepositoriesConfComment start=/^\s*#/ end=/$/

syn region PaludisRepositoriesConfKey start=/^\(\s*[^#]\)\@=/ end=/=\@=/
            \ contains=PaludisRepositoriesConfKnownKey,PaludisRepositoriesConfBadKey

syn match PaludisRepositoriesConfEquals /=/ skipwhite
            \ nextgroup=PaludisRepositoriesConfValue

syn region PaludisRepositoriesConfValue contained start=// end=/$/
            \ contains=PaludisRepositoriesConfString,PaludisRepositoriesConfUnquoted,
            \    PaludisRepositoriesConfContinuation,PaludisRepositoriesConfVariable,
            \    PaludisRepositoriesConfEnvVariable,
            \    PaludisRepositoriesConfBadTemplateVariable,PaludisRepositoriesConfMacro,
            \    PaludisRepositoriesConfBadMacro,PaludisRepositoriesConfKnownValue
            \ skipwhite

syn match PaludisRepositoriesConfContinuation contained /\\$/
            \ skipnl

syn match PaludisRepositoriesConfUnquoted contained /[^ \t$%"'\\]\+/ skipwhite

syn region PaludisRepositoriesConfString contained start=/"/ end=/"/
            \ contains=PaludisRepositoriesConfVariable,PaludisRepositoriesConfEnvVariable,
            \    PaludisRepositoriesConfBadTemplateVariable,
            \    PaludisRepositoriesConfMacro,PaludisRepositoriesConfBadMacro
            \ skipwhite

syn keyword PaludisRepositoriesConfKnownKey contained
            \ location distdir format builddir library sync root yaml_uri
            \ master_repository profiles pkgdir setsdir securitydir newsdir
            \ names_cache sync sync_options eclassdirs cache write_cache
            \ provides_cache importance layout use_manifest
            \ binary_uri_prefix binary_keywords_filter binary_destination binary_distdir
            \ eapi_when_unspecified eapi_when_unknown profile_eapi_when_unspecified
            \ name handler config_template config_filename

syn keyword PaludisRepositoriesConfBadKey contained
            \ world

syn keyword PaludisRepositoriesConfKnownValue contained
            \ use require ignore

syn match PaludisRepositoriesConfVariable contained
            \ /\$\({\(repository_template\)\@![^{}]\+}\|\(repository_template\|ENV{\)\@![a-zA-Z0-9_]\+\)/ skipwhite

syn match PaludisRepositoriesConfEnvVariable contained
            \ /\$\({ENV{[^{}]\+}}\|ENV{[a-zA-Z0-9_]\+}\)/ skipwhite

syn match PaludisRepositoriesConfBadTemplateVariable contained
            \ /\$\({repository_template[^}]*}\|repository_template[a-zA-Z0-9_]*\)/ skipwhite

syn match PaludisRepositoriesConfMacro contained
            \ /%\({repository_template[^}]*}\|repository_template[a-zA-Z0-9_]\*\)/ skipwhite

syn match PaludisRepositoriesConfBadMacro contained
            \ /%\({\(repository_template\)\@![^}]\+}\|\(repository_template\)\@![a-zA-Z0-9_]\+\)/ skipwhite

hi def link PaludisRepositoriesConfKnownKey                    Keyword
hi def link PaludisRepositoriesConfBadKey                      Error
hi def link PaludisRepositoriesConfKnownValue                  Keyword
hi def link PaludisRepositoriesConfString                      String
hi def link PaludisRepositoriesConfUnquoted                    Constant
hi def link PaludisRepositoriesConfVariable                    Identifier
hi def link PaludisRepositoriesConfEnvVariable                 Statement
hi def link PaludisRepositoriesConfBadTemplateVariable         Error
hi def link PaludisRepositoriesConfMacro                       Macro
hi def link PaludisRepositoriesConfBadMacro                    Error
hi def link PaludisRepositoriesConfContinuation                Preproc
hi def link PaludisRepositoriesConfComment                     Comment

let b:current_syntax = "paludis-repositories-conf"