codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: JSON53" Maintainer: Mazunki Hoksaas rolferen@gmail.com4" Previous Maintainer: Guten Ye <ywzhaifei@gmail.com>5" Last Change: 2019 Apr 16" Version: vim9.0-17" URL: https://github.com/json5/json58 9" Syntax setup10if exists('b:current_syntax') && b:current_syntax == 'json5'11 finish12endif13 14" Numbers15syn match json5Number "[-+]\=\%(0\|[1-9]\d*\)\%(\.\d*\)\=\%([eE][-+]\=\d\+\)\="16syn match json5Number "[-+]\=\%(\.\d\+\)\%([eE][-+]\=\d\+\)\="17syn match json5Number "[-+]\=0[xX]\x*"18syn match json5Number "[-+]\=Infinity\|NaN"19 20" An integer part of 0 followed by other digits is not allowed21syn match json5NumError "[-+]\=0\d\(\d\|\.\)*"22 23" A hexadecimal number cannot have a fractional part24syn match json5NumError "[-+]\=0x\x*\.\x*"25 26" Strings27syn region json5String start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=json5Escape,@Spell28syn region json5String start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=json5Escape,@Spell29 30" Escape sequences31syn match json5Escape "\\['\"\\bfnrtv]" contained32syn match json5Escape "\\u\x\{4}" contained33 34" Boolean35syn keyword json5Boolean true false36 37" Null38syn keyword json5Null null39 40" Delimiters and Operators41syn match json5Delimiter ","42syn match json5Operator ":"43 44" Braces45syn match json5Braces "[{}\[\]]"46 47" Keys48syn match json5Key /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@Spell49syn match json5Key /"\([^"]\|\\"\)\{-}"\ze\s*:/ contains=json5Escape,@Spell50 51" Comment52syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell,json5Todo53syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell,json5Todo54syn region json5Comment start="/\*" end="\*/" fold contains=@Spell,json5Todo55 56syn keyword json5Todo contained TODO FIXME XXX57 58" Define the default highlighting59hi def link json5String String60hi def link json5Key Identifier61hi def link json5Escape Special62hi def link json5Number Number63hi def link json5Delimiter Delimiter64hi def link json5Operator Operator65hi def link json5Braces Delimiter66hi def link json5Null Keyword67hi def link json5Boolean Boolean68hi def link json5LineComment Comment69hi def link json5Comment Comment70hi def link json5NumError Error71hi def link json5Todo Todo72 73if !exists('b:current_syntax')74 let b:current_syntax = 'json5'75endif76 77 