Skip to content

Commit a59ea2b

Browse files
committed
Some other miscellaneous fixes:
* Try to use the correct/detailed scopes for each syntax element * Add some of the core built-in types (e.g. List, String, ...) * Add "undefined" and "the empty <x>" as language constants
1 parent 28e1b13 commit a59ea2b

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

grammars/lcb.cson

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
}
2525
{
2626
'match': '\\s*(next|end)\\s*repeat\\b'
27-
'name': 'keyword.control.lcb'
27+
'name': 'keyword.control.repeat.lcb'
2828
}
2929
{
3030
'include': '#end-block'
@@ -54,10 +54,10 @@
5454
'include': '#brackets'
5555
}
5656
{
57-
'match': '\\b(true|false|nothing|any)\\b'
57+
'match': '\\b(true|false|nothing|undefined|any|the\\s*empty\\s*(array|list|string|data))\\b'
5858
'captures':
5959
'1':
60-
'name': 'constant.language.lcb'
60+
'name': 'constant.language.core.lcb'
6161
}
6262
{
6363
'match': '\\b([tpskmxr][A-Z]\\w*)\\b'
@@ -69,7 +69,13 @@
6969
'match': '\\b(returns)\\b'
7070
'captures':
7171
'1':
72-
'name': 'keyword.control.lcb'
72+
'name': 'storage.modifier.returns.lcb'
73+
}
74+
{
75+
'match': '\\b(Number|Integer|Real|Boolean|String|List|Array)\\b'
76+
'captures':
77+
'1':
78+
'name': 'support.type.core.lcb'
7379
}
7480
]
7581

@@ -106,7 +112,7 @@
106112
'begin': '^\\s*(else\\s*if|if|else)\\b'
107113
'captures':
108114
'1':
109-
'name': 'keyword.control.lcb'
115+
'name': 'keyword.control.if.lcb'
110116
'end': '\\b(then)\\b'
111117
'patterns': [
112118
{
@@ -116,32 +122,32 @@
116122

117123
'end-block':
118124
'match': '^\\s*(end(?:\\s*(?:module|library|widget|handler|if|repeat))?)'
119-
'name': 'keyword.control.lcb'
125+
'name': 'keyword.control.end.lcb'
120126

121127
'repeat-block':
122128
'match': '^\\s*(repeat)\\b'
123-
'name': 'keyword.control.lcb'
129+
'name': 'keyword.control.repeat.lcb'
124130

125131
'define-module':
126132
'match': '^\\s*(module|library|widget|use)(\\s+(?:\\w|[._])*)?\\b'
127133
'captures':
128134
'1':
129135
'name':
130-
'keyword.control.lcb'
136+
'keyword.other.module.lcb'
131137
'2':
132138
'name':
133-
'entity.name.section.module.lcb'
139+
'entity.name.module.lcb'
134140

135141
'define-constant':
136142
'begin': '^\\s*constant\\b'
137143
'end': '\\bis\\b'
138144
'captures':
139145
'0':
140-
'name': 'keyword.control.lcb'
146+
'name': 'storage.type.constant.lcb'
141147
'patterns': [
142148
{
143149
'match': '\\b\\w+\\b'
144-
'name': 'variable.constant.lcb'
150+
'name': 'variable.other.constant.lcb'
145151
}
146152
]
147153

@@ -150,7 +156,7 @@
150156
'end': '\\bis\\b'
151157
'captures':
152158
'0':
153-
'name': 'keyword.control.lcb'
159+
'name': 'storage.type.metadata.lcb'
154160
'patterns': [
155161
{
156162
'match': '\\b\\w+\\b'
@@ -162,30 +168,32 @@
162168
'match': '^\\s*(property)(\\s*\\w*)?'
163169
'captures':
164170
'1':
165-
'name': 'keyword.control.lcb'
171+
'name': 'storage.type.property.lcb'
166172
'2':
167173
'name': 'entity.name.property.lcb'
168174

169175
'define-variable':
170176
'match': '^\\s*((?:public|private)\\s+)?(variable)(?:\\s+(\\w*)(?:\\s+(as(?:\\soptional)?)(?:\\s+(\\w*))?)?)?'
171177
'captures':
172178
'1':
173-
'name': 'storage.modifier.lcb'
179+
'name': 'storage.modifier.access.lcb'
174180
'2':
175-
'name': 'storage.type.lcb'
181+
'name': 'storage.type.variable.lcb'
176182
'3':
177183
'name': 'variable.lcb'
178184
'4':
179-
'name': 'keyword.control.lcb'
185+
'name': 'keyword.other.as.lcb'
180186
'5':
181187
'name': 'storage.type.lcb'
182188

183189
'define-handler':
184-
'match': '^\\s*((?:(?:public|private)\\s+)?handler)(?:\\s+(\\w+))\\b'
190+
'match': '^\\s*((?:public|private)\\s+)?(handler)(?:\\s+(\\w+))\\b'
185191
'captures':
186192
'1':
187-
'name': 'keyword.control.lcb'
193+
'name': 'storage.modifier.access.lcb'
188194
'2':
195+
'name': 'storage.type.function.lcb'
196+
'3':
189197
'name': 'entity.name.function.lcb'
190198

191199
'handler-return':

0 commit comments

Comments
 (0)