-
Notifications
You must be signed in to change notification settings - Fork 0
/
KPL Kernel Programming Language.JSON-tmLanguage
181 lines (180 loc) · 6 KB
/
KPL Kernel Programming Language.JSON-tmLanguage
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
"fileTypes": [
"c",
"h"
],
"name": "KPL Kernel Programming Language",
"repository": {
"string_escaped_char": {
"patterns": [
{
"name": "constant.character.escape.kpl",
"match": "\\\\(\\\\|[abefnprtv'\"?]|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8})"
},
{
"name": "invalid.illegal.unknown-escape.kpl",
"match": "\\\\."
}
]
},
"entity_name_function": {
"patterns": [
{
"include": "#generic_names"
}
]
},
"generic_names": {
"match": "[A-Za-z_][A-Za-z0-9_]*"
}
},
"patterns": [
{
"begin": "^\\s*(function|method)\\s+([A-Za-z_][A-Za-z0-9_]*\\s*)",
"beginCaptures": {
"1": {
"name": "storage.type.function.kpl"
},
"2": {
"name": "entity.name.function.kpl"
}
},
"end": "(\\()",
"name": "meta.function.kpl",
"comment": "Matches function names"
},
{
"begin": "^\\s*(class|behavior)\\s+([A-Za-z_][A-Za-z0-9_]*\\s*)",
"beginCaptures": {
"1": {
"name": "storage.type.function.kpl"
},
"2": {
"name": "entity.name.function.kpl"
}
},
"end": "$",
"name": "meta.function.kpl",
"comment": "Matches function names"
},
{
"match": "(?<=new|of|ptr to|asPtrTo)\\s+(?!new)(\\w+)",
"name": "storage.type.kpl",
"comment": "Ensures that user defined data types are highlighted"
},
{
"match": "\\b(true|false|null)\\b",
"name": "constant.language.kpl",
"comment": "Constants"
},
{
"match": "\\b(array|bool|char|double|float|int|long|signed|void)\\b",
"name": "storage.type.kpl",
"comment": "Native data types"
},
{
"begin": "^\\s*(superclass)\\s+([A-Za-z_][A-Za-z0-9_]*\\s*)",
"beginCaptures": {
"1": {
"name": "keyword.kpl"
},
"2": {
"name": "storage.type.kpl"
}
},
"end": "$",
"name": "meta.function.kpl",
"comment": "Matches function names"
},
{
"match": "\\b(alloc|anyType|array|arraySize|asInteger|asPtrTo|behavior|bool|break|by|case|catch|char|class|code|const|continue|debug|default|do|else|elseIf|endBehavior|endClass|endCode|endFor|endFunction|endHeader|endIf|endInterface|endMethod|endRecord|endSwitch|endTry|endWhile|enum|errors|extends|external|false|fields|for|free|function|header|if|implements|infix|int|interface|isInstanceOf|isKindOf|messages|method|methods|new|null|of|prefix|ptr|record|renaming|return|returns|self|sizeOf|suer|superclass|switch|throw|to|true|try|type|typeOfNull|until|uses|var|void|while)\\b",
"name": "keyword.source.kpl",
"comment": "All the keywords in the language"
},
{
"match": "--.*$",
"name": "comment.kpl",
"comment": "Single line comments"
},
{
"begin": "/\\*",
"end": "\\*/",
"name": "comment.kpl",
"comment": "Multi-line comments",
"patterns": [
{
"include": "#string_escaped_char"
}
]
},
{
"begin": "\"",
"end": "\"",
"name": "string.kpl",
"comment": "Double quoted strings",
"patterns": [
{
"include": "#string_escaped_char"
}
]
},
{
"begin": "'",
"end": "'",
"name": "string.kpl",
"comment": "Single quoted strings",
"patterns": [
{
"include": "#string_escaped_char"
}
]
},
{
"match": "\\b(?i:(0x\\h*))",
"name": "constant.numeric.integer.hexadecimal.kpl",
"comment": "Various number. I grabbed this from the kpl files so I don't know if it'll cause any weird issues, but it seems to work so far"
},
{
"match": "\\b(0[0-7]+)",
"name": "constant.numeric.integer.octal.kpl"
},
{
"match": "\\b(?i:(((\\d+(\\.(?=[^a-zA-Z_])\\d*)?|(?<=[^0-9a-zA-Z_])\\.\\d+)(e[\\-\\+]?\\d+)?))J)",
"name": "constant.numeric.complex.kpl"
},
{
"match": "\\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))(?=[^a-zA-Z_])",
"name": "constant.numeric.float.kpl"
},
{
"match": "(?<=[^0-9a-zA-Z_])(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))",
"name": "constant.numeric.float.kpl"
},
{
"match": "\\b(?i:(\\d+e[\\-\\+]?\\d+))",
"name": "constant.numeric.float.kpl"
},
{
"match": "\\b([1-9]+[0-9]*|0)",
"name": "constant.numeric.integer.decimal.kpl"
},
{
"match": "(==|!=|<=|>=|<>|<|>)",
"name": "keyword.operator.comparison.kpl"
},
{
"match": "(=)",
"name": "keyword.operator.assignment.kpl"
},
{
"match": "(\\-|\\+|\\*|\\/|%)",
"name": "keyword.operator.arithmetic.kpl"
},
{
"match": "(!|&&|\\|\\|)",
"name": "keyword.operator.logical.kpl"
}
],
"scopeName": "source.kpl",
"uuid": "16e882cc-c040-4150-a096-c175197698ff"
}