Skip to content

Commit

Permalink
Version 0.4
Browse files Browse the repository at this point in the history
Fixed some syntax highlighting for numbers.
Small improvements and fixes.
  • Loading branch information
ashemedai authored and vim-scripts committed Oct 18, 2010
1 parent 3c6600e commit 3c602d4
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions syntax/json.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: JSON
" Maintainer: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
" Last Change: 2007-07-11
" Version: 0.3
" Last Change: 2009-06-16
" Version: 0.4
" {{{1

" Syntax setup {{{2
Expand All @@ -27,24 +27,23 @@ syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+
syn match jsonEscape "\\["\\/bfnrt]" contained
syn match jsonEscape "\\u\x\{4}" contained

" Syntax: Strings should always be enclosed with quotes.
syn match jsonNoQuotes "\<\a\+\>"

" Syntax: Numbers {{{2
syn match jsonInteger "-\=\<[1-9]\d*\>"
syn match jsonFraction "-\=\<\([1-9]\d*\|0\)\.\d\+\>"
syn match jsonExponent "-\=\<[1-9]\d*[eE][+-]\=\d\+\>"
syn match jsonFracExp "-\=\<\([1-9]\d*\|0\)\.\d\+[eE][+-]\=\d\+\>"
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"

" Syntax: An integer part of 0 followed by other digits is not allowed.
syn match jsonNumError "-\=\<0\d.*\>"
syn match jsonNumError "-\=\<0\d\.\d*\>"

" Syntax: Boolean {{{2
syn keyword jsonBoolean true false

" Syntax: Null {{{2
syn keyword jsonNull null

" Syntax: Braces and Parentheses {{{2
" Syntax: Braces {{{2
syn match jsonBraces "[{}\[\]]"
syn match jsonParens "[()]"

" Define the default highlighting. {{{1
" For version 5.7 and earlier: only when not done already
Expand All @@ -58,16 +57,14 @@ if version >= 508 || !exists("did_json_syn_inits")
endif
HiLink jsonString String
HiLink jsonEscape Special
HiLink jsonInteger Number
HiLink jsonFraction Number
HiLink jsonExponent Number
HiLink jsonFracExp Number
HiLink jsonNumber Number
HiLink jsonBraces Operator
HiLink jsonNull Function
HiLink jsonBoolean Boolean

HiLink jsonNumError Error
HiLink jsonStringSQ Error
HiLink jsonNoQuotes Error
delcommand HiLink
endif

Expand Down

0 comments on commit 3c602d4

Please sign in to comment.