annotate runtime/syntax/toml.vim @ 27978:442ca2007bec v8.2.4514

patch 8.2.4514: Vim9: some flow commands can be shortened Commit: https://github.com/vim/vim/commit/b2175220dafc28349b275ac7f3080f89cce78a57 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 5 20:24:41 2022 +0000 patch 8.2.4514: Vim9: some flow commands can be shortened Problem: Vim9: some flow commands can be shortened. Solution: Also require using the full name for ":return", ":enddef", ":continue", ":export" and ":import".
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Mar 2022 21:30:03 +0100
parents 3b34837f4538
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: TOML
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Homepage: https://github.com/cespare/vim-toml
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Maintainer: Aman Verma
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Previous Maintainer: Caleb Spare <cespare@gmail.com>
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Last Change: Oct 8, 2021
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 if exists('b:current_syntax')
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 finish
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 endif
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 syn match tomlEscape /\\[btnfr"/\\]/ display contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 syn match tomlEscape /\\u\x\{4}/ contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 syn match tomlEscape /\\U\x\{8}/ contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 syn match tomlLineEscape /\\$/ contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " Basic strings
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 syn region tomlString oneline start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=tomlEscape
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " Multi-line basic strings
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 syn region tomlString start=/"""/ end=/"""/ contains=tomlEscape,tomlLineEscape
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 " Literal strings
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 syn region tomlString oneline start=/'/ end=/'/
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 " Multi-line literal strings
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 syn region tomlString start=/'''/ end=/'''/
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 syn match tomlInteger /[+-]\=\<[1-9]\(_\=\d\)*\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 syn match tomlInteger /[+-]\=\<0\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 syn match tomlInteger /[+-]\=\<0x[[:xdigit:]]\(_\=[[:xdigit:]]\)*\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 syn match tomlInteger /[+-]\=\<0o[0-7]\(_\=[0-7]\)*\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 syn match tomlInteger /[+-]\=\<0b[01]\(_\=[01]\)*\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 syn match tomlInteger /[+-]\=\<\(inf\|nan\)\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\.\d\+\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\(\.\d\(_\=\d\)*\)\=[eE][+-]\=\d\(_\=\d\)*\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn match tomlBoolean /\<\%(true\|false\)\>/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " https://tools.ietf.org/html/rfc3339
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 syn match tomlDate /\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}[T ]\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)\?/ display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn match tomlDotInKey /\v[^.]+\zs\./ contained display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match tomlKey /\v(^|[{,])\s*\zs[[:alnum:]._-]+\ze\s*\=/ contains=tomlDotInKey display
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 syn region tomlKeyDq oneline start=/\v(^|[{,])\s*\zs"/ end=/"\ze\s*=/ contains=tomlEscape
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 syn region tomlKeySq oneline start=/\v(^|[{,])\s*\zs'/ end=/'\ze\s*=/
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKey,tomlKeyDq,tomlKeySq,tomlDotInKey
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKey,tomlKeyDq,tomlKeySq,tomlDotInKey
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 syn region tomlKeyValueArray start=/=\s*\[\zs/ end=/\]/ contains=@tomlValue
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 syn region tomlArray start=/\[/ end=/\]/ contains=@tomlValue contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 syn cluster tomlValue contains=tomlArray,tomlString,tomlInteger,tomlFloat,tomlBoolean,tomlDate,tomlComment
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 syn keyword tomlTodo TODO FIXME XXX BUG contained
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 syn match tomlComment /#.*/ contains=@Spell,tomlTodo
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 hi def link tomlComment Comment
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 hi def link tomlTodo Todo
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 hi def link tomlTableArray Title
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 hi def link tomlTable Title
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 hi def link tomlDotInKey Normal
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 hi def link tomlKeySq Identifier
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 hi def link tomlKeyDq Identifier
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 hi def link tomlKey Identifier
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 hi def link tomlDate Constant
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 hi def link tomlBoolean Boolean
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 hi def link tomlFloat Float
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 hi def link tomlInteger Number
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 hi def link tomlString String
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 hi def link tomlLineEscape SpecialChar
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 hi def link tomlEscape SpecialChar
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 syn sync minlines=500
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 let b:current_syntax = 'toml'
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 " vim: et sw=2 sts=2