Mercurial > ec-dotfiles
comparison vendor/vim-syntax/json.vim @ 636:8812b9230a68
Merge
| author | nanaya <me@nanaya.pro> |
|---|---|
| date | Tue, 14 Jan 2020 11:09:50 +0900 |
| parents | 035b23bb15da |
| children | 78469331407e |
comparison
equal
deleted
inserted
replaced
| 635:5d3ce722285a | 636:8812b9230a68 |
|---|---|
| 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 Sep 17 | |
| 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') && (!exists("g:vim_json_conceal") || g:vim_json_conceal==1) | |
| 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') && (!exists("g:vim_json_conceal") || g:vim_json_conceal==1) |
| 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 |
