30547
|
1 " Vim syntax file
|
|
2 " Language: GYP
|
|
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
|
|
4 " Filenames: *.gyp,*.gypi
|
|
5 " Last Change: 2022 Sep 27
|
|
6
|
|
7 if !exists('g:main_syntax')
|
|
8 if exists('b:current_syntax') && b:current_syntax ==# 'gyp'
|
|
9 finish
|
|
10 endif
|
|
11 let g:main_syntax = 'gyp'
|
|
12 endif
|
|
13
|
|
14 " Based on JSON syntax
|
|
15 runtime! syntax/json.vim
|
|
16
|
|
17 " Single quotes are allowed
|
|
18 syn clear jsonStringSQError
|
|
19
|
|
20 syn match jsonKeywordMatch /'\([^']\|\\\'\)\+'[[:blank:]\r\n]*\:/ contains=jsonKeyword
|
|
21 if has('conceal') && (!exists('g:vim_json_conceal') || g:vim_json_conceal==1)
|
|
22 syn region jsonKeyword matchgroup=jsonQuote start=/'/ end=/'\ze[[:blank:]\r\n]*\:/ concealends contained
|
|
23 else
|
|
24 syn region jsonKeyword matchgroup=jsonQuote start=/'/ end=/'\ze[[:blank:]\r\n]*\:/ contained
|
|
25 endif
|
|
26
|
|
27 syn match jsonStringMatch /'\([^']\|\\\'\)\+'\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
|
|
28 if has('conceal') && (!exists('g:vim_json_conceal') || g:vim_json_conceal==1)
|
|
29 syn region jsonString oneline matchgroup=jsonQuote start=/'/ skip=/\\\\\|\\'/ end=/'/ concealends contains=jsonEscape contained
|
|
30 else
|
|
31 syn region jsonString oneline matchgroup=jsonQuote start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=jsonEscape contained
|
|
32 endif
|
|
33
|
|
34 " Trailing commas are allowed
|
|
35 if !exists('g:vim_json_warnings') || g:vim_json_warnings==1
|
|
36 syn clear jsonTrailingCommaError
|
|
37 endif
|
|
38
|
|
39 " Python-style comments are allowed
|
|
40 syn match jsonComment /#.*$/ contains=jsonTodo,@Spell
|
|
41 syn keyword jsonTodo FIXME NOTE TODO XXX TBD contained
|
|
42
|
|
43 hi def link jsonComment Comment
|
|
44 hi def link jsonTodo Todo
|
|
45
|
|
46 let b:current_syntax = 'gyp'
|
|
47 if g:main_syntax ==# 'gyp'
|
|
48 unlet g:main_syntax
|
|
49 endif
|