| 1 | { |
| 2 | "$schema" "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 | "_source" { |
| 4 | "description" "TOML TextMate grammar for syntax highlighting", |
| 5 | "origin" "https://github.com/tamasfe/taplo", |
| 6 | "file" "https://raw.githubusercontent.com/tamasfe/taplo/master/editors/vscode/toml.tmLanguage.json", |
| 7 | "license" "MIT", |
| 8 | "copyright" "Copyright (c) 2020 Ferenc Tamás", |
| 9 | "fetched" "2025-01-08", |
| 10 | "update_instructions" "To update this grammar, fetch the latest version from the origin URL above and preserve this _source block." |
| 11 | }, |
| 12 | "version" "1.0.0", |
| 13 | "name" "TOML", |
| 14 | "scopeName" "source.toml", |
| 15 | "uuid" "8b4e5008-c50d-11ea-a91b-54ee75aeeb97", |
| 16 | "information_for_contributors" [ |
| 17 | "Originally was maintained by aster (galaster@foxmail.com). This notice is only kept here for the record, please don't send e-mails about bugs and other issues." |
| 18 | ], |
| 19 | "patterns" [ |
| 20 | { |
| 21 | "include" "#commentDirective" |
| 22 | }, |
| 23 | { |
| 24 | "include" "#comment" |
| 25 | }, |
| 26 | { |
| 27 | "include" "#table" |
| 28 | }, |
| 29 | { |
| 30 | "include" "#entryBegin" |
| 31 | }, |
| 32 | { |
| 33 | "include" "#value" |
| 34 | } |
| 35 | ], |
| 36 | "repository" { |
| 37 | "comment" { |
| 38 | "captures" { |
| 39 | "1" { |
| 40 | "name" "comment.line.number-sign.toml" |
| 41 | }, |
| 42 | "2" { |
| 43 | "name" "punctuation.definition.comment.toml" |
| 44 | } |
| 45 | }, |
| 46 | "comment" "Comments", |
| 47 | "match" "\\s*((#).*)$" |
| 48 | }, |
| 49 | "commentDirective" { |
| 50 | "captures" { |
| 51 | "1" { |
| 52 | "name" "meta.preprocessor.toml" |
| 53 | }, |
| 54 | "2" { |
| 55 | "name" "punctuation.definition.meta.preprocessor.toml" |
| 56 | } |
| 57 | }, |
| 58 | "comment" "Comments", |
| 59 | "match" "\\s*((#):.*)$" |
| 60 | }, |
| 61 | "table" { |
| 62 | "patterns" [ |
| 63 | { |
| 64 | "name" "meta.table.toml", |
| 65 | "match" "^\\s*(\\[)\\s*((?:(?:(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+'))\\s*\\.?\\s*)+)\\s*(\\])", |
| 66 | "captures" { |
| 67 | "1" { |
| 68 | "name" "punctuation.definition.table.toml" |
| 69 | }, |
| 70 | "2" { |
| 71 | "patterns" [ |
| 72 | { |
| 73 | "match" "(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+')", |
| 74 | "name" "support.type.property-name.table.toml" |
| 75 | }, |
| 76 | { |
| 77 | "match" "\\.", |
| 78 | "name" "punctuation.separator.dot.toml" |
| 79 | } |
| 80 | ] |
| 81 | }, |
| 82 | "3" { |
| 83 | "name" "punctuation.definition.table.toml" |
| 84 | } |
| 85 | } |
| 86 | }, |
| 87 | { |
| 88 | "name" "meta.array.table.toml", |
| 89 | "match" "^\\s*(\\[\\[)\\s*((?:(?:(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+'))\\s*\\.?\\s*)+)\\s*(\\]\\])", |
| 90 | "captures" { |
| 91 | "1" { |
| 92 | "name" "punctuation.definition.array.table.toml" |
| 93 | }, |
| 94 | "2" { |
| 95 | "patterns" [ |
| 96 | { |
| 97 | "match" "(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+')", |
| 98 | "name" "support.type.property-name.array.toml" |
| 99 | }, |
| 100 | { |
| 101 | "match" "\\.", |
| 102 | "name" "punctuation.separator.dot.toml" |
| 103 | } |
| 104 | ] |
| 105 | }, |
| 106 | "3" { |
| 107 | "name" "punctuation.definition.array.table.toml" |
| 108 | } |
| 109 | } |
| 110 | }, |
| 111 | { |
| 112 | "begin" "(\\{)", |
| 113 | "end" "(\\})", |
| 114 | "name" "meta.table.inline.toml", |
| 115 | "beginCaptures" { |
| 116 | "1" { |
| 117 | "name" "punctuation.definition.table.inline.toml" |
| 118 | } |
| 119 | }, |
| 120 | "endCaptures" { |
| 121 | "1" { |
| 122 | "name" "punctuation.definition.table.inline.toml" |
| 123 | } |
| 124 | }, |
| 125 | "patterns" [ |
| 126 | { |
| 127 | "include" "#comment" |
| 128 | }, |
| 129 | { |
| 130 | "match" ",", |
| 131 | "name" "punctuation.separator.table.inline.toml" |
| 132 | }, |
| 133 | { |
| 134 | "include" "#entryBegin" |
| 135 | }, |
| 136 | { |
| 137 | "include" "#value" |
| 138 | } |
| 139 | ] |
| 140 | } |
| 141 | ] |
| 142 | }, |
| 143 | "entryBegin" { |
| 144 | "name" "meta.entry.toml", |
| 145 | "match" "\\s*((?:(?:(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+'))\\s*\\.?\\s*)+)\\s*(=)", |
| 146 | "captures" { |
| 147 | "1" { |
| 148 | "patterns" [ |
| 149 | { |
| 150 | "match" "(?:[A-Za-z0-9_+-]+)|(?:\"[^\"]+\")|(?:'[^']+')", |
| 151 | "name" "support.type.property-name.toml" |
| 152 | }, |
| 153 | { |
| 154 | "match" "\\.", |
| 155 | "name" "punctuation.separator.dot.toml" |
| 156 | } |
| 157 | ] |
| 158 | }, |
| 159 | "2" { |
| 160 | "name" "punctuation.eq.toml" |
| 161 | } |
| 162 | } |
| 163 | }, |
| 164 | "value" { |
| 165 | "patterns" [ |
| 166 | { |
| 167 | "name" "string.quoted.triple.basic.block.toml", |
| 168 | "begin" "\"\"\"", |
| 169 | "end" "\"\"\"", |
| 170 | "patterns" [ |
| 171 | { |
| 172 | "match" "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})", |
| 173 | "name" "constant.character.escape.toml" |
| 174 | }, |
| 175 | { |
| 176 | "match" "\\\\[^btnfr/\"\\\\\\n]", |
| 177 | "name" "invalid.illegal.escape.toml" |
| 178 | } |
| 179 | ] |
| 180 | }, |
| 181 | { |
| 182 | "name" "string.quoted.single.basic.line.toml", |
| 183 | "begin" "\"", |
| 184 | "end" "\"", |
| 185 | "patterns" [ |
| 186 | { |
| 187 | "match" "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})", |
| 188 | "name" "constant.character.escape.toml" |
| 189 | }, |
| 190 | { |
| 191 | "match" "\\\\[^btnfr/\"\\\\\\n]", |
| 192 | "name" "invalid.illegal.escape.toml" |
| 193 | } |
| 194 | ] |
| 195 | }, |
| 196 | { |
| 197 | "name" "string.quoted.triple.literal.block.toml", |
| 198 | "begin" "'''", |
| 199 | "end" "'''" |
| 200 | }, |
| 201 | { |
| 202 | "name" "string.quoted.single.literal.line.toml", |
| 203 | "begin" "'", |
| 204 | "end" "'" |
| 205 | }, |
| 206 | { |
| 207 | "captures" { |
| 208 | "1" { |
| 209 | "name" "constant.other.time.datetime.offset.toml" |
| 210 | } |
| 211 | }, |
| 212 | "match" "(?<!\\w)(\\d{4}\\-\\d{2}\\-\\d{2}[T| ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[\\+\\-]\\d{2}:\\d{2}))(?!\\w)" |
| 213 | }, |
| 214 | { |
| 215 | "captures" { |
| 216 | "1" { |
| 217 | "name" "constant.other.time.datetime.local.toml" |
| 218 | } |
| 219 | }, |
| 220 | "match" "(\\d{4}\\-\\d{2}\\-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?)" |
| 221 | }, |
| 222 | { |
| 223 | "name" "constant.other.time.date.toml", |
| 224 | "match" "\\d{4}\\-\\d{2}\\-\\d{2}" |
| 225 | }, |
| 226 | { |
| 227 | "name" "constant.other.time.time.toml", |
| 228 | "match" "\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?" |
| 229 | }, |
| 230 | { |
| 231 | "match" "(?<!\\w)(true|false)(?!\\w)", |
| 232 | "captures" { |
| 233 | "1" { |
| 234 | "name" "constant.language.boolean.toml" |
| 235 | } |
| 236 | } |
| 237 | }, |
| 238 | { |
| 239 | "match" "(?<!\\w)([\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))(?:(?:\\.([0-9]+))?[eE][\\+\\-]?[1-9]_?[0-9]*|(?:\\.[0-9_]*)))(?!\\w)", |
| 240 | "captures" { |
| 241 | "1" { |
| 242 | "name" "constant.numeric.float.toml" |
| 243 | } |
| 244 | } |
| 245 | }, |
| 246 | { |
| 247 | "match" "(?<!\\w)((?:[\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))))(?!\\w)", |
| 248 | "captures" { |
| 249 | "1" { |
| 250 | "name" "constant.numeric.integer.toml" |
| 251 | } |
| 252 | } |
| 253 | }, |
| 254 | { |
| 255 | "match" "(?<!\\w)([\\+\\-]?inf)(?!\\w)", |
| 256 | "captures" { |
| 257 | "1" { |
| 258 | "name" "constant.numeric.inf.toml" |
| 259 | } |
| 260 | } |
| 261 | }, |
| 262 | { |
| 263 | "match" "(?<!\\w)([\\+\\-]?nan)(?!\\w)", |
| 264 | "captures" { |
| 265 | "1" { |
| 266 | "name" "constant.numeric.nan.toml" |
| 267 | } |
| 268 | } |
| 269 | }, |
| 270 | { |
| 271 | "match" "(?<!\\w)((?:0x(([0-9a-fA-F](([0-9a-fA-F]|_[0-9a-fA-F])+)?))))(?!\\w)", |
| 272 | "captures" { |
| 273 | "1" { |
| 274 | "name" "constant.numeric.hex.toml" |
| 275 | } |
| 276 | } |
| 277 | }, |
| 278 | { |
| 279 | "match" "(?<!\\w)(0o[0-7](_?[0-7])*)(?!\\w)", |
| 280 | "captures" { |
| 281 | "1" { |
| 282 | "name" "constant.numeric.oct.toml" |
| 283 | } |
| 284 | } |
| 285 | }, |
| 286 | { |
| 287 | "match" "(?<!\\w)(0b[01](_?[01])*)(?!\\w)", |
| 288 | "captures" { |
| 289 | "1" { |
| 290 | "name" "constant.numeric.bin.toml" |
| 291 | } |
| 292 | } |
| 293 | }, |
| 294 | { |
| 295 | "name" "meta.array.toml", |
| 296 | "begin" "(?<!\\w)(\\[)\\s*", |
| 297 | "end" "\\s*(\\])(?!\\w)", |
| 298 | "beginCaptures" { |
| 299 | "1" { |
| 300 | "name" "punctuation.definition.array.toml" |
| 301 | } |
| 302 | }, |
| 303 | "endCaptures" { |
| 304 | "1" { |
| 305 | "name" "punctuation.definition.array.toml" |
| 306 | } |
| 307 | }, |
| 308 | "patterns" [ |
| 309 | { |
| 310 | "match" ",", |
| 311 | "name" "punctuation.separator.array.toml" |
| 312 | }, |
| 313 | { |
| 314 | "include" "#comment" |
| 315 | }, |
| 316 | { |
| 317 | "include" "#value" |
| 318 | } |
| 319 | ] |
| 320 | }, |
| 321 | { |
| 322 | "begin" "(\\{)", |
| 323 | "end" "(\\})", |
| 324 | "name" "meta.table.inline.toml", |
| 325 | "beginCaptures" { |
| 326 | "1" { |
| 327 | "name" "punctuation.definition.table.inline.toml" |
| 328 | } |
| 329 | }, |
| 330 | "endCaptures" { |
| 331 | "1" { |
| 332 | "name" "punctuation.definition.table.inline.toml" |
| 333 | } |
| 334 | }, |
| 335 | "patterns" [ |
| 336 | { |
| 337 | "include" "#comment" |
| 338 | }, |
| 339 | { |
| 340 | "match" ",", |
| 341 | "name" "punctuation.separator.table.inline.toml" |
| 342 | }, |
| 343 | { |
| 344 | "include" "#entryBegin" |
| 345 | }, |
| 346 | { |
| 347 | "include" "#value" |
| 348 | } |
| 349 | ] |
| 350 | } |
| 351 | ] |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |