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
|
export const propertiesLanguage = {
id: "properties",
extensions: [".properties"],
aliases: ["Properties", "properties"],
registerLanguage(monaco: typeof import("monaco-editor")) {
monaco.languages.register({ id: this.id })
monaco.languages.setMonarchTokensProvider(this.id, {
tokenPostfix: ".properties",
keywords: ["true", "True", "TRUE", "false", "False", "FALSE", "null", "Null", "Null", "~"],
numberInteger: /(?:0|[+-]?[0-9]+)/,
numberFloat: /(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,
numberOctal: /0o[0-7]+/,
numberHex: /0x[0-9a-fA-F]+/,
numberInfinity: /[+-]?\.(?:inf|Inf|INF)/,
numberNaN: /\.(?:nan|Nan|NAN)/,
numberDate: /\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/,
escapes: /\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,
tokenizer: {
root: [
{ include: "@whitespace" },
[/[#!].*$/, "comment"],
[/^([^\s=:]+)(\s*[=:]\s*)/, ["type", "operators"]],
[/\\$/, "keyword.control"],
[/@numberInteger(?![ \t]*\S+)/, "number"],
[/@numberFloat(?![ \t]*\S+)/, "number.float"],
[/@numberOctal(?![ \t]*\S+)/, "number.octal"],
[/@numberHex(?![ \t]*\S+)/, "number.hex"],
[/@numberInfinity(?![ \t]*\S+)/, "number.infinity"],
[/@numberNaN(?![ \t]*\S+)/, "number.nan"],
[/@numberDate(?![ \t]*\S+)/, "number.date"],
[
/.+?(?=(\s+#|$))/,
{
cases: {
"@keywords": "keyword",
"@default": "string",
},
},
],
],
whitespace: [[/[ \t\r\n]+/, "white"]],
},
})
monaco.languages.setLanguageConfiguration(this.id, {
comments: { lineComment: "#" },
brackets: [],
autoClosingPairs: [],
surroundingPairs: [],
folding: { offSide: false },
onEnterRules: [
{
beforeText: /#.*$/,
action: {
indentAction: monaco.languages.IndentAction.None,
appendText: "# ",
},
},
],
})
},
}
|