Mercurial > vim
comparison runtime/syntax/json.vim @ 17372:b9bc47742df6
Update runtime files
commit https://github.com/vim/vim/commit/396e829fa355ebc92a618ef18266a3fed71b7042
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 13 23:04:31 2019 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jul 2019 23:15:05 +0200 |
parents | 46763b01cd9a |
children | 1e5672da6a69 |
comparison
equal
deleted
inserted
replaced
17371:1062026cb98c | 17372:b9bc47742df6 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: JSON | 2 " Language: JSON |
3 " Maintainer: Eli Parra <eli@elzr.com> | 3 " Maintainer: vacancy |
4 " Last Change: 2014 Aug 23 | 4 " Previous Maintainer: Eli Parra <eli@elzr.com> |
5 " Last Change: 2019 Jul 08 | |
5 " Version: 0.12 | 6 " Version: 0.12 |
6 | 7 |
7 if !exists("main_syntax") | 8 if !exists("main_syntax") |
8 " quit when a syntax file was already loaded | 9 " quit when a syntax file was already loaded |
9 if exists("b:current_syntax") | 10 if exists("b:current_syntax") |
14 | 15 |
15 syntax match jsonNoise /\%(:\|,\)/ | 16 syntax match jsonNoise /\%(:\|,\)/ |
16 | 17 |
17 " 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 |
18 | 19 |
20 " Syntax: JSON Keywords | |
21 " Separated into a match and region because a region by itself is always greedy | |
22 syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword | |
23 if has('conceal') | |
24 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained | |
25 else | |
26 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained | |
27 endif | |
28 | |
19 " Syntax: Strings | 29 " Syntax: Strings |
20 " Separated into a match and region because a region by itself is always greedy | 30 " Separated into a match and region because a region by itself is always greedy |
31 " Needs to come after keywords or else a json encoded string will break the | |
32 " syntax | |
21 syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString | 33 syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString |
22 if has('conceal') | 34 if has('conceal') |
23 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained | 35 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained |
24 else | 36 else |
25 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained | 37 syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained |
26 endif | 38 endif |
27 | 39 |
28 " Syntax: JSON does not allow strings with single quotes, unlike JavaScript. | 40 " Syntax: JSON does not allow strings with single quotes, unlike JavaScript. |
29 syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ | 41 syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ |
30 | 42 |
31 " Syntax: JSON Keywords | |
32 " Separated into a match and region because a region by itself is always greedy | |
33 syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword | |
34 if has('conceal') | |
35 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained | |
36 else | |
37 syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained | |
38 endif | |
39 | 43 |
40 " Syntax: Escape sequences | 44 " Syntax: Escape sequences |
41 syn match jsonEscape "\\["\\/bfnrt]" contained | 45 syn match jsonEscape "\\["\\/bfnrt]" contained |
42 syn match jsonEscape "\\u\x\{4}" contained | 46 syn match jsonEscape "\\u\x\{4}" contained |
43 | 47 |