aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_miniscript.lua
blob: afe0a2bf360a34356bfbac5e4305b83a7a744752 (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
91
92
93
94
95
96
97
98
99
100
101
102
-- mod-version:3
local syntax = require 'core.syntax'

syntax.add {
	name = "MiniScript",
	files = { "%.ms$" },
	comment = "//",
	patterns = {
		{ pattern = "//.*",                type = "comment"  },
		{ pattern = { '"', '"' },          type = "string"   },
		{ pattern = "[<>!=]=",             type = "operator" },
		{ pattern = "[%+%-%*%/%^@<>:]",    type = "operator" },
		{ pattern = "%d%.%d*[eE][-+]?%d+", type = "number"   },
		{ pattern = "%d%.%d*",             type = "number"   },
		{ pattern = "%.?%d*[eE][-+]?%d+",  type = "number"   },
		{ pattern = "%.?%d+",              type = "number"   },
		{ pattern = "[%a_][%w_]*",         type = "symbol"   },
	},
	symbols = {
		["if"]       = "keyword",
		["not"]      = "keyword",
		["and"]      = "keyword",
		["or"]       = "keyword",
		["else"]     = "keyword",
		["then"]     = "keyword",
		["for"]      = "keyword",
		["in"]       = "keyword",
		["while"]    = "keyword",
		["break"]    = "keyword",
		["continue"] = "keyword",
		["function"] = "keyword",
		["end"]      = "keyword",
		["return"]   = "keyword",
		["new"]      = "keyword",
		["isa"]      = "keyword",
		["self"]     = "keyword2",

		["true"]    = "literal",
		["false"]   = "literal",
		["null"]    = "literal",
		["globals"] = "literal",
		["locals"]  = "literal",
		["outer"]   = "literal",

		-- Built-in types's classes
		["number"]  = "literal",
		["string"]  = "literal",
		["list"]    = "literal",
		["map"]     = "literal",
		["funcRef"] = "literal",

		-- Intrinsic functions
		["abs"]      = "function",
		["acos"]     = "function",
		["asin"]     = "function",
		["atan"]     = "function",
		["bitAnd"]   = "function",
		["bitOr"]    = "function",
		["bitXor"]   = "function",
		["ceil"]     = "function",
		["char"]     = "function",
		["code"]     = "function",
		["cos"]      = "function",
		["floor"]    = "function",
		["hash"]     = "function",
		["hasIndex"] = "function",
		["indexes"]  = "function",
		["indexOf"]  = "function",
		["insert"]   = "function",
		["join"]     = "function",
		["len"]      = "function",
		["log"]      = "function",
		["lower"]    = "function",
		["pi"]       = "function",
		["pop"]      = "function",
		["print"]    = "function",
		["pull"]     = "function",
		["push"]     = "function",
		["range"]    = "function",
		["remove"]   = "function",
		["replace"]  = "function",
		["rnd"]      = "function",
		["round"]    = "function",
		["shuffle"]  = "function",
		["sign"]     = "function",
		["sin"]      = "function",
		["slice"]    = "function",
		["sort"]     = "function",
		["split"]    = "function",
		["sqrt"]     = "function",
		["str"]      = "function",
		["sum"]      = "function",
		["tan"]      = "function",
		["time"]     = "function",
		["upper"]    = "function",
		["val"]      = "function",
		["values"]   = "function",
		["version"]  = "function",
		["wait"]     = "function",
		["yield"]    = "function",
	},
}