1*2286304cSBram Moolenaar" Vim syntax file 2*2286304cSBram Moolenaar" Language: TOML 3*2286304cSBram Moolenaar" Homepage: https://github.com/cespare/vim-toml 4*2286304cSBram Moolenaar" Maintainer: Aman Verma 5*2286304cSBram Moolenaar" Previous Maintainer: Caleb Spare <[email protected]> 6*2286304cSBram Moolenaar" Last Change: Oct 8, 2021 7*2286304cSBram Moolenaar 8*2286304cSBram Moolenaarif exists('b:current_syntax') 9*2286304cSBram Moolenaar finish 10*2286304cSBram Moolenaarendif 11*2286304cSBram Moolenaar 12*2286304cSBram Moolenaarsyn match tomlEscape /\\[btnfr"/\\]/ display contained 13*2286304cSBram Moolenaarsyn match tomlEscape /\\u\x\{4}/ contained 14*2286304cSBram Moolenaarsyn match tomlEscape /\\U\x\{8}/ contained 15*2286304cSBram Moolenaarsyn match tomlLineEscape /\\$/ contained 16*2286304cSBram Moolenaar 17*2286304cSBram Moolenaar" Basic strings 18*2286304cSBram Moolenaarsyn region tomlString oneline start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=tomlEscape 19*2286304cSBram Moolenaar" Multi-line basic strings 20*2286304cSBram Moolenaarsyn region tomlString start=/"""/ end=/"""/ contains=tomlEscape,tomlLineEscape 21*2286304cSBram Moolenaar" Literal strings 22*2286304cSBram Moolenaarsyn region tomlString oneline start=/'/ end=/'/ 23*2286304cSBram Moolenaar" Multi-line literal strings 24*2286304cSBram Moolenaarsyn region tomlString start=/'''/ end=/'''/ 25*2286304cSBram Moolenaar 26*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<[1-9]\(_\=\d\)*\>/ display 27*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<0\>/ display 28*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<0x[[:xdigit:]]\(_\=[[:xdigit:]]\)*\>/ display 29*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<0o[0-7]\(_\=[0-7]\)*\>/ display 30*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<0b[01]\(_\=[01]\)*\>/ display 31*2286304cSBram Moolenaarsyn match tomlInteger /[+-]\=\<\(inf\|nan\)\>/ display 32*2286304cSBram Moolenaar 33*2286304cSBram Moolenaarsyn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\.\d\+\>/ display 34*2286304cSBram Moolenaarsyn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\(\.\d\(_\=\d\)*\)\=[eE][+-]\=\d\(_\=\d\)*\>/ display 35*2286304cSBram Moolenaar 36*2286304cSBram Moolenaarsyn match tomlBoolean /\<\%(true\|false\)\>/ display 37*2286304cSBram Moolenaar 38*2286304cSBram Moolenaar" https://tools.ietf.org/html/rfc3339 39*2286304cSBram Moolenaarsyn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}/ display 40*2286304cSBram Moolenaarsyn match tomlDate /\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?/ display 41*2286304cSBram Moolenaarsyn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}[T ]\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)\?/ display 42*2286304cSBram Moolenaar 43*2286304cSBram Moolenaarsyn match tomlDotInKey /\v[^.]+\zs\./ contained display 44*2286304cSBram Moolenaarsyn match tomlKey /\v(^|[{,])\s*\zs[[:alnum:]._-]+\ze\s*\=/ contains=tomlDotInKey display 45*2286304cSBram Moolenaarsyn region tomlKeyDq oneline start=/\v(^|[{,])\s*\zs"/ end=/"\ze\s*=/ contains=tomlEscape 46*2286304cSBram Moolenaarsyn region tomlKeySq oneline start=/\v(^|[{,])\s*\zs'/ end=/'\ze\s*=/ 47*2286304cSBram Moolenaar 48*2286304cSBram Moolenaarsyn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKey,tomlKeyDq,tomlKeySq,tomlDotInKey 49*2286304cSBram Moolenaar 50*2286304cSBram Moolenaarsyn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKey,tomlKeyDq,tomlKeySq,tomlDotInKey 51*2286304cSBram Moolenaar 52*2286304cSBram Moolenaarsyn region tomlKeyValueArray start=/=\s*\[\zs/ end=/\]/ contains=@tomlValue 53*2286304cSBram Moolenaar 54*2286304cSBram Moolenaarsyn region tomlArray start=/\[/ end=/\]/ contains=@tomlValue contained 55*2286304cSBram Moolenaar 56*2286304cSBram Moolenaarsyn cluster tomlValue contains=tomlArray,tomlString,tomlInteger,tomlFloat,tomlBoolean,tomlDate,tomlComment 57*2286304cSBram Moolenaar 58*2286304cSBram Moolenaarsyn keyword tomlTodo TODO FIXME XXX BUG contained 59*2286304cSBram Moolenaar 60*2286304cSBram Moolenaarsyn match tomlComment /#.*/ contains=@Spell,tomlTodo 61*2286304cSBram Moolenaar 62*2286304cSBram Moolenaarhi def link tomlComment Comment 63*2286304cSBram Moolenaarhi def link tomlTodo Todo 64*2286304cSBram Moolenaarhi def link tomlTableArray Title 65*2286304cSBram Moolenaarhi def link tomlTable Title 66*2286304cSBram Moolenaarhi def link tomlDotInKey Normal 67*2286304cSBram Moolenaarhi def link tomlKeySq Identifier 68*2286304cSBram Moolenaarhi def link tomlKeyDq Identifier 69*2286304cSBram Moolenaarhi def link tomlKey Identifier 70*2286304cSBram Moolenaarhi def link tomlDate Constant 71*2286304cSBram Moolenaarhi def link tomlBoolean Boolean 72*2286304cSBram Moolenaarhi def link tomlFloat Float 73*2286304cSBram Moolenaarhi def link tomlInteger Number 74*2286304cSBram Moolenaarhi def link tomlString String 75*2286304cSBram Moolenaarhi def link tomlLineEscape SpecialChar 76*2286304cSBram Moolenaarhi def link tomlEscape SpecialChar 77*2286304cSBram Moolenaar 78*2286304cSBram Moolenaarsyn sync minlines=500 79*2286304cSBram Moolenaarlet b:current_syntax = 'toml' 80*2286304cSBram Moolenaar 81*2286304cSBram Moolenaar" vim: et sw=2 sts=2 82