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