Skip to content

Commit 4ce46f5

Browse files
committed
syn-plugin: update syntax coloring
- add mod to keywords - add simple string to syntax coloring - include true & false int syntax coloring - add : as operator
1 parent f21dae5 commit 4ce46f5

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed
Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,46 @@
11
{
22
"comments": {
3-
// symbol used for single line comment. Remove this entry if your language does not support line comments
43
"lineComment": "//",
5-
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6-
"blockComment": [ "/*", "*/" ]
4+
"blockComment": ["/*", "*/"]
75
},
8-
// symbols used as brackets
96
"brackets": [
107
["{", "}"],
118
["[", "]"],
129
["(", ")"]
1310
],
14-
// symbols that are auto closed when typing
15-
"autoClosingPairs": [
11+
"colorizedBracketPairs": [
1612
["{", "}"],
1713
["[", "]"],
18-
["(", ")"],
19-
["\"", "\""],
20-
["'", "'"]
14+
["(", ")"]
2115
],
22-
// symbols that can be used to surround a selection
16+
"autoClosingPairs": [
17+
{ "open": "{", "close": "}", "notIn": ["string"] },
18+
{ "open": "[", "close": "]", "notIn": ["string"] },
19+
{ "open": "(", "close": ")", "notIn": ["string"] },
20+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
21+
{ "open": "/*", "close": " */", "notIn": ["string"] },
22+
{ "open": "`", "close": "`", "notIn": ["string"] },
23+
{ "open": "```", "close": "```", "notIn": ["string"] }
24+
],
25+
"autoCloseBefore": ";:.,=}])> \n\t",
2326
"surroundingPairs": [
2427
["{", "}"],
2528
["[", "]"],
2629
["(", ")"],
30+
["<", ">"],
2731
["\"", "\""],
28-
["'", "'"]
29-
]
30-
}
32+
["'", "'"],
33+
["`", "`"],
34+
["```", "```"]
35+
],
36+
"indentationRules": {
37+
"increaseIndentPattern": "^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$",
38+
"decreaseIndentPattern": "^\\s*(\\s*\\/[*].*[*]\\/\\s*)*[})]"
39+
},
40+
"folding": {
41+
"markers": {
42+
"start": "^\\s*// region:\\b",
43+
"end": "^\\s*// endregion\\b"
44+
}
45+
}
46+
}
256 Bytes
Binary file not shown.

editors/vscode/syntaxes/microcad.tmLanguage.json

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,33 @@
77
"name": "comment.line.microcad"
88
},
99
{
10-
"match": "\\b(pub|part|use|fn|init|return|if|__builtin)\\b",
10+
"match": "\\b(pub|part|mod|use|fn|init|return|if|else|mat|__builtin)\\b",
1111
"name": "keyword.control.microcad"
1212
},
1313
{
14-
"match": "\\+|-|\\*|/|%|\\=|\\==|\\!=|\\<|\\>|\\<=|\\>=|\\&&|\\|\\|",
15-
"name": "keyword.operator.microcad"
16-
},
17-
{
18-
"match": "\\b(Integer|Scalar|String|Color|Length|Area|Volume|Angle|Weight|Bool)\\b",
14+
"match": "\\b(Integer|Scalar|String|Color|Length|Area|Volume|Angle|Weight|Density|Bool)\\b",
1915
"name": "storage.type.microcad"
2016
},
2117
{
2218
"match": "\\b([a-z_][a-zA-Z0-9_]*)\\s*(?=\\()",
2319
"name": "entity.name.function.microcad"
2420
},
2521
{
26-
"match": "\\b([0-9]+(\\.[0-9]+)?)(cm|mm|m|km)?\\b",
22+
"match": "\\+|-|\\*|/| %|\\=|\\==|\\!=|\\<|\\>|\\<=|\\>=|\\||:",
23+
"name": "keyword.operator.microcad"
24+
},
25+
{
26+
"match": "\\b(([0-9]+(\\.[0-9]+)?)(%|m|cm|mm|µm|in|ft|yd|deg|°|grad|turn|rad|g|kg|lb|oz|m²|cm²|mm²|µm²|in²|ft²|yd²|m³|cm³|mm³|µm³|in³|ft³|yd³|ml|cl|l|µl)?|true|false)\\b",
2727
"name": "constant.numeric.microcad"
2828
},
2929
{
3030
"match": "\\b([a-z_][a-zA-Z0-9_]*)\\b",
3131
"name": "variable.other.microcad"
3232
},
33+
{
34+
"match": "\"[^\"]*\"",
35+
"name": "string.quoted.single.microcad"
36+
},
3337
{
3438
"begin": "\\(",
3539
"end": "\\)",
@@ -63,6 +67,9 @@
6367
{
6468
"include": "#functions"
6569
},
70+
{
71+
"include": "#operators"
72+
},
6673
{
6774
"include": "#numbers"
6875
},
@@ -73,7 +80,7 @@
7380
"include": "#types"
7481
},
7582
{
76-
"include": "#operators"
83+
"include": "#strings"
7784
}
7885
]
7986
},
@@ -82,28 +89,32 @@
8289
"name": "comment.line.microcad"
8390
},
8491
"keywords": {
85-
"match": "\\b(pub|part|use|fn|init|assert|return|__builtin)\\b",
92+
"match": "\\b(pub|part|mod|use|fn|init|return|if|else|mat|__builtin)\\b",
8693
"name": "keyword.control.microcad"
8794
},
8895
"functions": {
8996
"match": "\\b([a-z_][a-zA-Z0-9_]*)\\s*(?=\\()",
9097
"name": "entity.name.function.microcad"
9198
},
99+
"operators": {
100+
"match": "\\+|-|\\*|/| %|\\=|\\==|\\!=|\\<|\\>|\\<=|\\>=|\\&&|\\||:",
101+
"name": "keyword.operator.microcad"
102+
},
92103
"numbers": {
93-
"match": "\\b([0-9]+(\\.[0-9]+)?)(cm|mm|m|km)?\\b",
104+
"match": "\\b(([0-9]+(\\.[0-9]+)?)(%|m|cm|mm|µm|in|ft|yd|deg|°|grad|turn|rad|g|kg|lb|oz|m²|cm²|mm²|µm²|in²|ft²|yd²|m³|cm³|mm³|µm³|in³|ft³|yd³|ml|cl|l|µl)?)|true|false\\b",
94105
"name": "constant.numeric.microcad"
95106
},
96107
"variables": {
97108
"match": "\\b([a-z_][a-zA-Z0-9_]*)\\b",
98109
"name": "variable.other.microcad"
99110
},
100-
"operators": {
101-
"match": "\\+|-|\\*|/|%|\\=|\\==|\\!=|\\<|\\>|\\<=|\\>=|\\&&|\\|\\|",
102-
"name": "keyword.operator.microcad"
103-
},
104111
"types": {
105-
"match": "\\b(Integer|Scalar|String|Color|Length|Area|Volume|Angle|Weight|Bool)\\b",
112+
"match": "\\b(Integer|Scalar|String|Color|Length|Area|Volume|Angle|Weight|Density|Bool)\\b",
106113
"name": "storage.type.microcad"
114+
},
115+
"strings": {
116+
"match": "\"[^\"]*\"",
117+
"name": "string.quoted.single.microcad"
107118
}
108119
}
109120
}

0 commit comments

Comments
 (0)