aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_cue.lua
blob: 50f01f3fc58b2544b24cf2afddde5ef8eb39f309 (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
33
34
35
36
37
38
39
40
41
-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
  name = "CUE",
  files = "%.cue$",
  comment = "//",
  patterns = {
    { pattern = "//.*",                      type = "comment" },
    { pattern = { '"', '"', '\\' },          type = "string" },
    { pattern = { "`", "`", '\\' },          type = "string" },
    { pattern = { "'", "'", '\\' },          type = "string" },
    { pattern = "0[oO_][0-7]+i?",            type = "number" },
    { pattern = "-?0x[%x_]+i?",              type = "number" },
    { pattern = "-?%d+_%di?",                type = "number" },
    { pattern = "-?%d+[%d%.eE]*f?i?",        type = "number" },
    { pattern = "-?%.?%d+f?i?",              type = "number" },
    { pattern = "[%a_][%w_]*%.",             type = "literal" },
    { pattern = "[%a_][%w_]*",               type = "symbol" },
    { pattern = "#[%a][%w_]*",               type = "keyword2" },
    -- operators
    { pattern = "[%+%-=/%*%^%%<>!~|&%?:%.]", type = "operator" },
  },
  symbols = {
    ["package"] = "keyword",
    ["import"]  = "keyword",
    ["let"]     = "keyword",
    ["for"]     = "keyword",
    ["true"]    = "literal",
    ["false"]   = "literal",
    ["string"]  = "keyword2",
    ["bool"]    = "keyword2",
    ["number"]  = "keyword2",
    ["uint32"]  = "keyword2",
    ["int32"]   = "keyword2",
    ["uint16"]  = "keyword2",
    ["int16"]   = "keyword2",
    ["uint8"]   = "keyword2",
    ["float"]   = "keyword2",
  }
}