aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_blueprint.lua
blob: 98d6b06ace6b50cfaede6ab144b88e86353e3d6d (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
  name = "Blueprint",
  files = { "%.blp$", },
  comment = "//",
  block_comment = {"/*", "*/"},
  patterns = {

    -- Comments
    { pattern = "//.*", type = "comment" },
    { pattern = { "/%*", "%*/" }, type = "comment" },

    -- Strings
    { pattern = { "'", "'", "\\"}, type = "string" },
    { pattern = { '"', '"', "\\" }, type = "string" },

    -- Numbers
    { pattern = "%.?%d+", type = "number" },

    -- Child type
    { pattern = "%[.*%]", type = "literal" },

    -- Operators
    { pattern = "%$", type = "operator" },
    { pattern = "=>%s*%$().*()%(%)", type = { "operator", "function", "normal" } },

    -- Properties
    { pattern = "[%w-_]+()%s*:", type = { "keyword", "normal" } },

    -- Classes
    { pattern = "[%w_-%.]+%s*(){", type = { "keyword2", "normal"} },
    { pattern = "[%w_-%.]+%s*()[%w_-]+%s*{", type = { "keyword2", "normal"} },

    -- Symbols
    { pattern = "[%w-_]+", type = "symbol" },

  },
  symbols = {
    ["true"] = "literal",
    ["false"] = "literal",
    ["null"] = "literal",

    -- Import statements
    ["using"] = "keyword",

    -- Keywords
    ["after"] = "keyword",
    ["bidirectional"] = "keyword",
    ["bind-property"] = "keyword",
    ["bind"] = "keyword",
    ["default"] = "keyword",
    ["destructive"] = "keyword",
    ["disabled"] = "keyword",
    ["inverted"] = "keyword",
    ["no-sync-create"] = "keyword",
    ["suggested"] = "keyword",
    ["swapped"] = "keyword",
    ["sync-create"] = "keyword",
    ["template"] = "keyword",

    -- Menus
    ["menu"] = "keyword",
    ["submenu"] = "keyword",
    ["section"] = "keyword",

    -- Nested blocks
    ["responses"] = "keyword2",
    ["items"] = "keyword2",
    ["mime-types"] = "keyword2",
    ["patterns"] = "keyword2",
    ["suffixes"] = "keyword2",
    ["marks"] = "keyword2",
    ["widgets"] = "keyword2",
    ["strings"] = "keyword2",
    ["styles"] = "keyword2",
    ["accessibility"] = "keyword2",
    ["setters"] = "keyword2",
    ["layout"] = "keyword2",
    ["item"] = "keyword2",
    ["condition"] = "keyword2",
    ["mark"] = "keyword2",

    -- Translated strings
    ["_"] = "operator",
    ["C_"] = "operator",
  }
}