comparison vendor/vim-syntax/json.vim @ 589:7fbadf8bd22e

Update vendor Change whatever available from official vim
author nanaya <me@myconan.net>
date Thu, 07 Jul 2016 15:59:06 +0900
parents 6f57f959cc0b
children 0e72765944d4
comparison
equal deleted inserted replaced
588:152c020d7d8e 589:7fbadf8bd22e
1 " Vim syntax file 1 " Vim syntax file
2 " Language: JSON 2 " Language: JSON
3 " Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json 3 " Maintainer: Eli Parra <eli@elzr.com>
4 " Last Change: 2014-12-20 Load ftplugin/json.vim 4 " Last Change: 2014 Aug 23
5 5 " Version: 0.12
6 " Reload the definition of g:vim_json_syntax_conceal
7 " see https://github.com/elzr/vim-json/issues/42
8 runtime! ftplugin/json.vim
9 6
10 if !exists("main_syntax") 7 if !exists("main_syntax")
11 if version < 600 8 if version < 600
12 syntax clear 9 syntax clear
13 elseif exists("b:current_syntax") 10 elseif exists("b:current_syntax")
21 " NOTE that for the concealing to work your conceallevel should be set to 2 18 " NOTE that for the concealing to work your conceallevel should be set to 2
22 19
23 " Syntax: Strings 20 " Syntax: Strings
24 " Separated into a match and region because a region by itself is always greedy 21 " Separated into a match and region because a region by itself is always greedy
25 syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString 22 syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
26 if has('conceal') && g:vim_json_syntax_conceal == 1 23 if has('conceal')
27 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained 24 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
28 else 25 else
29 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained 26 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
30 endif 27 endif
31 28
33 syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ 30 syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
34 31
35 " Syntax: JSON Keywords 32 " Syntax: JSON Keywords
36 " Separated into a match and region because a region by itself is always greedy 33 " Separated into a match and region because a region by itself is always greedy
37 syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword 34 syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
38 if has('conceal') && g:vim_json_syntax_conceal == 1 35 if has('conceal')
39 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contains=jsonEscape contained 36 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained
40 else 37 else
41 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained 38 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
42 endif 39 endif
43 40
44 " Syntax: Escape sequences 41 " Syntax: Escape sequences
45 syn match jsonEscape "\\["\\/bfnrt]" contained 42 syn match jsonEscape "\\["\\/bfnrt]" contained
46 syn match jsonEscape "\\u\x\{4}" contained 43 syn match jsonEscape "\\u\x\{4}" contained
94 " Syntax: Braces 91 " Syntax: Braces
95 syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold 92 syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold
96 syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold 93 syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold
97 94
98 " Define the default highlighting. 95 " Define the default highlighting.
96 " For version 5.7 and earlier: only when not done already
97 " For version 5.8 and later: only when an item doesn't have highlighting yet
99 if version >= 508 || !exists("did_json_syn_inits") 98 if version >= 508 || !exists("did_json_syn_inits")
100 hi def link jsonPadding Operator 99 if version < 508
101 hi def link jsonString String 100 let did_json_syn_inits = 1
102 hi def link jsonTest Label 101 command -nargs=+ HiLink hi link <args>
103 hi def link jsonEscape Special 102 else
104 hi def link jsonNumber Delimiter 103 command -nargs=+ HiLink hi def link <args>
105 hi def link jsonBraces Delimiter 104 endif
106 hi def link jsonNull Function 105 HiLink jsonPadding Operator
107 hi def link jsonBoolean Delimiter 106 HiLink jsonString String
108 hi def link jsonKeyword Label 107 HiLink jsonTest Label
108 HiLink jsonEscape Special
109 HiLink jsonNumber Number
110 HiLink jsonBraces Delimiter
111 HiLink jsonNull Function
112 HiLink jsonBoolean Boolean
113 HiLink jsonKeyword Label
109 114
110 if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1) 115 if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
111 hi def link jsonNumError Error 116 HiLink jsonNumError Error
112 hi def link jsonCommentError Error 117 HiLink jsonCommentError Error
113 hi def link jsonSemicolonError Error 118 HiLink jsonSemicolonError Error
114 hi def link jsonTrailingCommaError Error 119 HiLink jsonTrailingCommaError Error
115 hi def link jsonMissingCommaError Error 120 HiLink jsonMissingCommaError Error
116 hi def link jsonStringSQError Error 121 HiLink jsonStringSQError Error
117 hi def link jsonNoQuotesError Error 122 HiLink jsonNoQuotesError Error
118 hi def link jsonTripleQuotesError Error 123 HiLink jsonTripleQuotesError Error
119 endif 124 endif
120 hi def link jsonQuote Quote 125 HiLink jsonQuote Quote
121 hi def link jsonNoise Noise 126 HiLink jsonNoise Noise
127 delcommand HiLink
122 endif 128 endif
123 129
124 let b:current_syntax = "json" 130 let b:current_syntax = "json"
125 if main_syntax == 'json' 131 if main_syntax == 'json'
126 unlet main_syntax 132 unlet main_syntax