aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_toml.lua
blob: 9de31f916bd341c03d499f88e05986860d96fd6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- lite-xl 1.16

local syntax = require "core.syntax"

syntax.add {
  files = { "%.toml$" },
  comment = '#',
  patterns = {
    { pattern = "#.-\n", type = "comment" },
    { pattern = { '"""', '"""', '\\' }, type = "string" },
    { pattern = { '"', '"', '\\' }, type = "string" },
    { pattern = { "'''", "'''" }, type = "string" },
    { pattern = { "'", "'" }, type = "string" },
    { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" },
    { pattern = "%[[A-Za-z0-9_%.%- ]+%]", type = "keyword" },
    { pattern = "%[%[[A-Za-z0-9_%.%- ]+%]%]", type = "keyword" },
    { pattern = "[%-+]?[0-9_]+%.[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
    { pattern = "[%-+]?[0-9_]+%.[0-9_]+", type = "number" },
    { pattern = "[%-+]?[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
    { pattern = "[%-+]?[0-9_]+", type = "number" },
    { pattern = "[%-+]?0x[0-9a-fA-F_]+", type = "number" },
    { pattern = "[%-+]?0o[0-7_]+", type = "number" },
    { pattern = "[%-+]?0b[01_]+", type = "number" },
    { pattern = "[%-+]?nan", type = "number" },
    { pattern = "[%-+]?inf", type = "number" },
    { pattern = "[a-z]+", type = "symbol" },
  },
  symbols = {
    ["true"] = "literal",
    ["false"] = "literal",
  },
}