-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathsource.powerbuilder.js
321 lines (319 loc) · 15.1 KB
/
source.powerbuilder.js
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/micha4w/PowerBuilder.tmbundle>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.pbt', '.sra', '.sru', '.srw'],
names: ['powerbuilder'],
patterns: [
{include: '#strings'},
{include: '#comments'},
{include: '#general_rules'},
{include: '#keywords'},
{include: '#literals'},
{include: '#special_rules'},
{include: '#final'}
],
repository: {
comments: {
patterns: [
{match: '//.*$', name: 'comment.line.double-slash.powerbuilder'},
{
begin: '/\\*',
end: '\\*/',
name: 'comment.block.documentation.powerbuilder'
},
{
begin: '\\A(HA)?(?=\\$)',
captures: {
1: {name: 'comment.block.documentation.headers.powerbuilder'}
},
end: '^(?!\\$)',
name: 'meta.header.powerbuilder',
patterns: [
{
captures: {
1: {name: 'comment.block.documentation.headers.powerbuilder'},
2: {name: 'variable.other.header.name.powerbuilder'},
3: {name: 'comment.block.documentation.headers.powerbuilder'},
4: {
name: 'string.unquoted.header.description.powerbuilder',
patterns: [{include: '#string-escapes'}]
}
},
match: '(\\$)(.*?)(\\$)(.*)',
name: 'meta.header.line.powerbuilder'
}
]
}
]
},
final: {
patterns: [
{
match: '([\\w$#%][\\w\\d$#%\\-]*)',
name: 'variable.other.local.powerbuilder'
},
{include: '#operators'}
]
},
general_rules: {
patterns: [
{
begin:
'(?i)^\\s*(close|commit|connect|declare|delete|describe|disconnect|execute|fetch|insert|open|prepare|rollback|select|selectblob|update|updateblob)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(?!\\s*\\()',
captures: {
1: {name: 'keyword.operator.sql.powerbuilder'},
2: {name: 'keyword.operator.sql.powerbuilder'}
},
end: '(;)',
name: 'meta.sql.statement.powerbuilder',
patterns: [
{include: '#strings'},
{include: '#sql_keywords'},
{include: '#literals'},
{include: '#operators'},
{
match: '(?<=::|\\.)[\\w$#%][\\w\\d$#%\\-]*',
name: 'variable.other.local.powerbuilder'
},
{
match: ':?([\\w$#%][\\w\\d$#%\\-]*)',
name: 'variable.other.local.powerbuilder'
}
]
},
{
captures: {
1: {name: 'keyword.other.types.powerbuilder'},
2: {patterns: [{include: '#types'}]}
},
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(create)\\s+(?!using(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`])))([\\w$#%][\\w\\d$#%\\-`]*)',
name: 'meta.variable.create.powerbuilder'
},
{
captures: {
1: {name: 'keyword.other.types.powerbuilder'},
2: {name: 'entity.type.name.complex.powerbuilder'},
3: {name: 'keyword.other.types.powerbuilder'},
4: {name: 'entity.other.inherited-class.powerbuilder'},
6: {name: 'keyword.other.types.powerbuilder'},
7: {name: 'entity.other.inherited-class.powerbuilder'}
},
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(type)\\s+([\\w$#%][\\w\\d$#%\\-]*)\\s+(from)\\s+([\\w$#%][\\w\\d$#%\\-`]*)(\\s+(within)\\s+([\\w$#%][\\w\\d$#%\\-`]*))?',
name: 'meta.type.declaration.powerbuilder'
},
{
captures: {
1: {name: 'keyword.other.functions.powerbuilder'},
2: {patterns: [{include: '#types'}]}
},
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(throws)\\s+([\\w$#%][\\w\\d$#%\\-`]*(,\\s*[\\w$#%][\\w\\d$#%\\-`]*)*)',
name: 'meta.function.throws_clause.powerbuilder'
},
{
captures: {
1: {name: 'keyword.other.functions.powerbuilder'},
3: {name: 'keyword.other.types.powerbuilder'},
4: {patterns: [{include: '#types'}]},
5: {name: 'entity.name.function.event.powerbuilder'},
7: {name: 'entity.name.tag.event.powerbuilder'}
},
match:
'(?i)(event)(\\s+(type)\\s+([\\w$#%][\\w\\d$#%\\-`]*))?\\s+([\\w$#%][\\w\\d$#%\\-]*)\\s*(\\s([\\w$#%][\\w\\d$#%\\-]*)\\s*($|;)|(?=\\())',
name: 'meta.event.declaration_definition.powerbuilder'
}
]
},
keywords: {
patterns: [
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(or|and|not)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.operator.boolean.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(constant|readonly|ref)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.variable.modifier.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(public|private|protected|privatewrite|privateread|protectedread|protectedwrite|systemread|systemwrite)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.access.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(super|this|sqlca|parent)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'variable.language.powerbuiler'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(indirect|variables|end\\s+variables|forward|end\\s+forward|destroy|create|using|type|end\\s+type|prototypes|within|autoinstantiate|system)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.types.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(global|shared)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.scope.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(return|function|end\\s+function|subroutine|end\\s+subroutine|throw|throws|event|end\\s+event|on|end\\s+on|call|dynamic|post|trigger|open|static|alias\\s+for|alias|library|rpcfunc)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.functions.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(if|then|else|elseif|case|choose|exit|continue|for|to|step|next|do|while|loop|until|try|catch|finally|release|end|goto|halt)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.control.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(namespace|intrinsic|with|_debug|enumerated|external|native)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.other.reserved.powerbuilder'
},
{include: '#sql_keywords'}
]
},
literals: {
patterns: [
{
match:
'(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))\\d{4}-\\d{2}-\\d{2}(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'constant.numeric.date.powerbuilder'
},
{
match:
'(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))\\d{2}:\\d{2}:\\d{2}(.\\d+)?(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'constant.numeric.time.powerbuilder'
},
{
match:
'((?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))|\\+|-)(\\d+(\\.\\d+)?|(\\.\\d+))([eE][+\\-]?\\d+)?(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'constant.numeric.number.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(true|false)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'constant.language.boolean.powerbuilder'
},
{
match: '([\\w$#%][\\w\\d$#%\\-]*!)',
name: 'constant.language.enumerated.powerbuilder'
}
]
},
operators: {
patterns: [
{
match: '(\\+|\\-|\\*|\\/|\\^|=|>|<|&)',
name: 'keyword.operator.symbols.powerbuilder'
}
]
},
primitives: {
patterns: [
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(any|blob|boolean|byte|char|character|date|datetime|dec|decimal|double|int|integer|long|longlong|longptr|real|string|time|uint|ulong|unsignedinteger|unsignedlong)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'entity.name.type.primitives.powerbuilder'
}
]
},
special_rules: {
patterns: [
{
match: '[\\w$#%][\\w\\d$#%\\-]*(?=\\s*\\()',
name: 'entity.name.function.powerbuilder'
},
{
match: '(?<=::|\\.)[\\w$#%][\\w\\d$#%\\-]*',
name: 'variable.other.member.powerbuilder'
},
{
captures: {
1: {patterns: [{include: '#types'}]},
2: {name: 'entity.name.function.powerbuilder'}
},
match:
'([\\w$#%][\\w\\d$#%\\-]*)\\s+([\\w$#%][\\w\\d$#%\\-]*)(?=\\s*\\()',
name: 'meta.function.declaration.powerbuilder'
},
{
captures: {
1: {patterns: [{include: '#types'}]},
3: {name: 'constant.numeric.number.powerbuilder'},
5: {name: 'variable.other.local.powerbuilder'}
},
match:
'(?i)([\\w$#%][\\w\\d$#%\\-`]*)\\s*(\\{(\\d+)\\}|\\s)\\s*(?!(or|and|then)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`])))([\\w$#%][\\w\\d$#%\\-]*)',
name: 'meta.variable.declaration.powerbuilder'
}
]
},
sql_keywords: {
patterns: [
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(or|and|xor|not)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.operator.sql.boolean.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(close|commit|connect|declare|delete|describe|disconnect|execute|fetch|insert|open|prepare|rollback|select|selectblob|update|updateblob)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.operator.sql.powerbuilder'
},
{
match:
'(?i)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))(set|current|of|is|null|from|into|using|values|where|first|prior|last|rollback|immediate|descriptor|cursor|procedure|for|of)(?:^(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])$|(?<![\\w\\d$#%\\-`])(?=[\\w\\d$#%\\-`])|(?<=[\\w\\d$#%\\-`])(?![\\w\\d$#%\\-`]))',
name: 'keyword.operator.sql.powerbuilder'
}
]
},
'string-escapes': {
patterns: [
{match: '~o?\\d{3}', name: 'constant.character.escape.powerbuilder'},
{
match: '~h[0-9a-fA-F]{2}',
name: 'constant.character.escape.powerbuilder'
},
{match: '~.', name: 'constant.character.escape.powerbuilder'}
]
},
strings: {
patterns: [
{
begin: '\\"',
end: '\\"',
name: 'string.quoted.double.powerbuilder',
patterns: [{include: '#string-escapes'}]
},
{
begin: "\\'",
end: "\\'",
name: 'string.quoted.single.powerbuilder',
patterns: [{include: '#string-escapes'}]
}
]
},
types: {
patterns: [
{include: '#primitives'},
{
match: '([\\w$#%][\\w\\d$#%\\-`]*)',
name: 'entity.name.type.complex.powerbuilder'
}
]
}
},
scopeName: 'source.powerbuilder'
}
export default grammar