diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-30 12:13:50 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-30 12:13:50 +0100 | 
| commit | 8af4f8e6c04b163d39de4327fca7f69cce78c0ab (patch) | |
| tree | 23f7dff144bd3cfe95d298245b5017ebadd2c30c /syntax | |
| parent | e5668602cc89f3298a1ab936b082e82519aa6a50 (diff) | |
| download | vim-polyglot-8af4f8e6c04b163d39de4327fca7f69cce78c0ab.tar.gz vim-polyglot-8af4f8e6c04b163d39de4327fca7f69cce78c0ab.zip | |
Add jsonc, closes #635
Diffstat (limited to '')
| -rw-r--r-- | syntax/jsonc.vim | 61 | 
1 files changed, 61 insertions, 0 deletions
| diff --git a/syntax/jsonc.vim b/syntax/jsonc.vim new file mode 100644 index 00000000..49c14bcc --- /dev/null +++ b/syntax/jsonc.vim @@ -0,0 +1,61 @@ +if has_key(g:polyglot_is_disabled, 'jsonc') +  finish +endif + +" Syntax setup {{{1 +if exists('b:current_syntax') && b:current_syntax == 'jsonc' +  finish +endif + +" Syntax: Strings {{{1 +syn region  jsoncString    start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=jsoncEscape +syn region  jsoncString    start=+'+  skip=+\\\\\|\\'+  end=+'+  contains=jsoncEscape + +" Syntax: JSON Keywords {{{1 +" Separated into a match and region because a region by itself is always greedy +syn match  jsoncKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword + +" Syntax: Escape sequences +syn match   jsoncEscape    "\\["\\/bfnrt]" contained +syn match   jsoncEscape    "\\u\x\{4}" contained + +" Syntax: Numbers {{{1 +syn match   jsoncNumber    "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" +syn keyword jsoncNumber    Infinity -Infinity + +" Syntax: An integer part of 0 followed by other digits is not allowed. +syn match   jsoncNumError  "-\=\<0\d\.\d*\>" + +" Syntax: Boolean {{{1 +syn keyword jsoncBoolean   true false + +" Syntax: Null {{{1 +syn keyword jsoncNull      null + +" Syntax: Braces {{{1 +syn match   jsoncBraces	   "[{}\[\]]" +syn match   jsoncObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ + +" Syntax: Comment {{{1 +syn region  jsoncLineComment    start=+\/\/+ end=+$+ keepend +syn region  jsoncLineComment    start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold +syn region  jsoncComment        start="/\*"  end="\*/" fold + +" Define the default highlighting. {{{1 +hi def link jsoncString             String +hi def link jsoncObjAssign          Identifier +hi def link jsoncEscape             Special +hi def link jsoncNumber             Number +hi def link jsoncBraces             Operator +hi def link jsoncNull               Function +hi def link jsoncBoolean            Boolean +hi def link jsoncLineComment        Comment +hi def link jsoncComment            Comment +hi def link jsoncNumError           Error +hi def link jsoncKeywordMatch       Label + +if !exists('b:current_syntax') +  let b:current_syntax = 'jsonc' +endif + +" vim: fdm=marker | 
