aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_blade.lua
blob: 0b82387570784b9c10b6a3de8b7f6dcd24b56cbd (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
  name = "Blade",
  files = { "%.b$" },
  comment = "#",
  patterns = {
    { pattern = "#.*",                      type = "comment"  },
    { pattern = { "/%*", "%*/" },           type = "comment"  },
    { pattern = { '"', '"', '\\' },         type = "string"   },
    { pattern = { "'", "'", '\\' },         type = "string"   },
    { pattern = "%d+%.%d+",                 type = "number"   },
    { pattern = "0x%x+",                    type = "number"   },
    { pattern = "0c[0-8]+",                 type = "number"   },
    { pattern = "0c[01]+",                  type = "number"   },
    { pattern = "%d+",                      type = "number"   },
    { pattern = "[%+%-=/%*%^%%<>!~|&]",     type = "operator" },
    { pattern = "[%a_][%w_]*%f[(]",         type = "function" },
    { pattern = "%a[%w_]+",                 type = "symbol"   },
  },
  -- https://bladelang.com/tutorial/reserved.html#reserved-words
  symbols = {
    ["and"]       = "keyword",
    ["continue"]  = "keyword",
    ["else"]      = "keyword",
    ["in"]        = "keyword",
    ["self"]      = "keyword2",
    ["when"]      = "keyword",
    ["as"]        = "keyword",
    ["def"]       = "keyword",
    ["iter"]      = "keyword",
    ["static"]    = "keyword",
    ["while"]     = "keyword",
    ["assert"]    = "keyword",
    ["default"]   = "keyword",
    ["finally"]   = "keyword",
    ["break"]     = "keyword",
    ["die"]       = "keyword",
    ["for"]       = "keyword",
    ["or"]        = "keyword",
    ["try"]       = "keyword",
    ["catch"]     = "keyword",
    ["do"]        = "keyword",
    ["if"]        = "keyword",
    ["parent"]    = "keyword",
    ["using"]     = "keyword",
    ["class"]     = "keyword",
    ["echo"]      = "function",
    ["import"]    = "keyword",
    ["return"]    = "keyword",
    ["var"]       = "keyword",
    ["true"]      = "literal",
    ["false"]     = "literal",
    ["nil"]       = "literal",
  },
}