-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsource.edgeql.js
More file actions
513 lines (511 loc) · 29.6 KB
/
source.edgeql.js
File metadata and controls
513 lines (511 loc) · 29.6 KB
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/edgedb/edgedb-editor-plugin>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.edgeql', '.esdl'],
names: ['edgeql', 'esdl'],
patterns: [{include: '#all'}],
repository: {
all: {
patterns: [
{include: '#fnstatement'},
{include: '#expressions'},
{match: '(;)', name: 'punctuation.statement.delimiter.edgeql'}
]
},
'array-dimensions': {
begin: '(\\[)',
beginCaptures: {1: {name: 'punctuation.parenthesis.begin.edgeql'}},
end: '(\\])',
endCaptures: {1: {name: 'punctuation.parenthesis.end.edgeql'}},
patterns: [
{match: '(\\d+)', name: 'constant.numeric.edgeql'},
{match: '\\S+', name: 'invalid.illegal.type.edgeql'}
]
},
'builtin-indexes': {
match:
'(?x) \\b(?<!\\.|\\.<|\\.>) (\n brin | btree | gin | gist |\n hash | index | spgist\n)\\b\n',
name: 'support.other.index.builtin.edgeql'
},
'builtin-modules': {
match:
'(?x) \\b(?<!::|\\.|\\.<|\\.>)(\n cal | cfg | enc | ext |\n fts | go | http | js |\n lang | math | net | perm |\n pg | py | rs | schema |\n std | sys\n)\\b\n',
name: 'support.other.module.builtin.edgeql'
},
'builtin-types': {
match:
'(?x) \\b(?<!\\.|\\.<|\\.>) (\n Base64Alphabet | BaseObject | ElasticLanguage | Endian |\n FreeObject | JsonEmpty | Language | LuceneLanguage |\n Method | Object | PGLanguage | RequestFailureKind |\n RequestState | Response | ScheduledRequest | Weight |\n anycontiguous | anydiscrete | anyenum | anyfloat |\n anyint | anynumeric | anypoint | anyreal |\n anyscalar | anytype | array | bigint |\n bool | bytes | date | date_duration |\n datetime | decimal | document | duration |\n enum | float32 | float64 | int16 |\n int32 | int64 | interval | json |\n local_date | local_datetime | local_time | multirange |\n range | relative_duration | sequence | str |\n timestamp | timestamptz | tuple | uuid\n)\\b\n',
name: 'support.type.builtin.edgeql'
},
builtins: {
patterns: [
{
match:
'(?x) \\b(?<!\\.|\\.<|\\.>) (\n abs | acos | adjacent |\n all | any | approximate_count |\n array_agg | array_fill | array_get |\n array_insert | array_join | array_replace |\n array_set | array_unpack | asin |\n assert | assert_distinct | assert_exists |\n assert_single | atan | atan2 |\n bit_and | bit_count | bit_lshift |\n bit_not | bit_or | bit_rshift |\n bit_xor | bounded_above | bounded_below |\n bytes_get_bit | ceil | contains |\n cos | cot | count |\n date_get | datetime_current | datetime_get |\n datetime_of_statement | datetime_of_transaction | datetime_truncate |\n duration_get | duration_normalize_days | duration_normalize_hours |\n duration_to_seconds | duration_truncate | enumerate |\n find | floor | get_current_branch |\n get_current_database | get_instance_name | get_transaction_isolation |\n get_version | get_version_as_str | json_array_unpack |\n json_get | json_object_pack | json_object_unpack |\n json_set | json_typeof | len |\n lg | ln | log |\n materialized | max | mean |\n min | multirange | multirange_unpack |\n overlaps | pi | random |\n range | range_get_lower | range_get_upper |\n range_is_empty | range_is_inclusive_lower | range_is_inclusive_upper |\n range_unpack | re_match | re_match_all |\n re_replace | re_test | reset_query_stats |\n round | search | sequence_next |\n sequence_reset | sin | sqrt |\n stddev | stddev_pop | str_lower |\n str_lpad | str_ltrim | str_pad_end |\n str_pad_start | str_repeat | str_replace |\n str_reverse | str_rpad | str_rtrim |\n str_split | str_title | str_trim |\n str_trim_end | str_trim_start | str_upper |\n strictly_above | strictly_below | sum |\n tan | time_get | to_bigint |\n to_bytes | to_date_duration | to_datetime |\n to_decimal | to_duration | to_float32 |\n to_float64 | to_int16 | to_int32 |\n to_int64 | to_json | to_local_date |\n to_local_datetime | to_local_time | to_relative_duration |\n to_str | to_uuid | uuid_generate_v1mc |\n uuid_generate_v4 | var | var_pop |\n with_options\n)(?=\\s*\\()\\b\n',
name: 'support.function.builtin.edgeql'
},
{
match:
'(?x) \\b(?<!\\.|\\.<|\\.>) (\n constraint | exclusive | expression |\n len_value | max_ex_value | max_len_value |\n max_value | min_ex_value | min_len_value |\n min_value | one_of | regexp\n)\\b\n',
name: 'support.function.constraint.builtin.edgeql'
},
{include: '#builtin-modules'},
{
match:
'(?x) \\b(\n __default__ | __edgedbsys__ | __edgedbtpl__ |\n __new__ | __old__ | __source__ |\n __specified__ | __std__ | __subject__ |\n __type__\n)\\b\n',
name: 'support.other.link.builtin.edgeql'
}
]
},
bytes: {
patterns: [
{
begin: "(b)(')",
beginCaptures: {
1: {name: 'storage.type.string.edgeql'},
2: {name: 'punctuation.definition.string.begin.edgeql'}
},
end: '(\\2)',
endCaptures: {1: {name: 'punctuation.definition.string.end.edgeql'}},
name: 'string.quoted.bytes.edgeql',
patterns: [
{include: '#bytes-escapes'},
{match: '([\\n -&(-\\[\\]-~])+'},
{
match: '(\\\\x.{1,2})|(\\\\.)|(.)',
name: 'invalid.illegal.bytes.edgeql'
}
]
},
{
begin: '(b)(")',
beginCaptures: {
1: {name: 'storage.type.string.edgeql'},
2: {name: 'punctuation.definition.string.begin.edgeql'}
},
end: '(\\2)',
endCaptures: {1: {name: 'punctuation.definition.string.end.edgeql'}},
name: 'string.quoted.bytes.edgeql',
patterns: [
{include: '#bytes-escapes'},
{match: '([\\n -!#-\\[\\]-~])+'},
{
match: '(\\\\x.{1,2})|(\\\\.)|(.)',
name: 'invalid.illegal.bytes.edgeql'
}
]
}
]
},
'bytes-escapes': {
match:
'(?x)\n (\n \\\\[\\\\\'"bfnrt] |\n \\\\x[0-9a-fA-F]{2}\n )\n',
name: 'constant.character.escape.edgeql'
},
casts: {
begin:
'(?xi)\n (?:\n (?<= ^ | [@~+\\-*/%^<>=?,:(\\[{])\n |\n (?<=\n AND | OR | NOT | LIKE | ILIKE | IS | IN | IF | ELSE |\n UNION | ALL | EXISTS |\n\n SELECT | GROUP | UPDATE | BY | THEN | LIMIT |\n # there are some ligature-related issues with "fi" and "ff"\n F[Ii]LTER | OF[Ff]SET\n )\n ) \\s* (\\<)\n',
beginCaptures: {1: {name: 'keyword.operator.cast.begin.edgeql'}},
contentName: 'meta.typecast.edgeql',
end: '(\\>)',
endCaptures: {1: {name: 'keyword.operator.cast.end.edgeql'}},
patterns: [{include: '#types'}, {include: '#types-common'}]
},
code: {
patterns: [
{
captures: {
1: {name: 'keyword.declaration.edgeql'},
3: {name: 'keyword.declaration.edgeql'}
},
match: '(?xi)\n \\b(FROM) \\s+ (EDGEQL | SQL) \\s+ (EXPRESSION)\n'
},
{
begin: '(?xi)\n \\b(FROM) \\s+\n (SQL) \\s+\n (\\$\\w?\\$)\n',
beginCaptures: {
1: {name: 'keyword.declaration.edgeql'},
3: {name: 'string.quoted.edgeql'}
},
end: '(\\3)',
endCaptures: {1: {name: 'string.quoted.edgeql'}},
patterns: [{include: 'source.sql'}]
},
{
begin: '(?xi)\n \\b(FROM) \\s+\n (EDGEQL) \\s+\n (\\$\\w?\\$)\n',
beginCaptures: {
1: {name: 'keyword.declaration.edgeql'},
3: {name: 'string.quoted.edgeql'}
},
end: '(\\3)',
endCaptures: {1: {name: 'string.quoted.edgeql'}},
patterns: [{include: 'source.edgeql'}]
}
]
},
commandblock: {
begin: '(?=SET|CREATE|ALTER|DROP|RENAME|FROM)',
end: '(?=\\})',
patterns: [{include: '#all'}]
},
comments: {
patterns: [
{
captures: {
1: {name: 'punctuation.definition.comment.edgeql'},
2: {name: 'comment.line.note.notation.edgeql'},
3: {name: 'comment.line.note.edgeql'}
},
match: '(#)\\s*((BUG|FIXME|TODO|XXX)).*$\\n?',
name: 'comment.line.number-sign.edgeql'
},
{
captures: {1: {name: 'punctuation.definition.comment.edgeql'}},
match: '(#).*$\\n?',
name: 'comment.line.number-sign.edgeql'
}
]
},
curlybraces: {
begin: '(\\{)',
beginCaptures: {1: {name: 'punctuation.parenthesis.begin.edgeql'}},
end: '(\\})',
endCaptures: {1: {name: 'punctuation.parenthesis.end.edgeql'}},
patterns: [
{include: '#comments'},
{include: '#commandblock'},
{include: '#shape'}
]
},
definition: {
captures: {
1: {name: 'variable.parameter.definition.edgeql'},
2: {name: 'invalid.illegal.definition.edgeql'}
},
match:
'(?x)\n (?:\n ([[:alpha:]_][[:alnum:]_]*)\n |\n ([\\.\\d]\\S*?)\n ) (?=\\s*:=)\n'
},
expressions: {
patterns: [
{include: '#comments'},
{include: '#code'},
{include: '#keywords'},
{include: '#fncalls'},
{include: '#operators'},
{include: '#builtins'},
{include: '#types'},
{include: '#quoted-name'},
{include: '#values'},
{include: '#link-properties'},
{include: '#variables'},
{include: '#parentheses'},
{include: '#squarebraces'},
{include: '#curlybraces'},
{include: '#casts'}
]
},
fncallargs: {
patterns: [
{include: '#definition'},
{include: '#expressions'},
{match: '(,)', name: 'punctuation.separator.arguments.edgeql'},
{match: '(;)', name: 'invalid.illegal.delimiter.edgeql'}
]
},
fncalls: {
patterns: [
{
begin:
'(?x)\n \\b(?<!\\.|\\.<|\\.>)\n # function name\n (?:\n (\n # functions\n abs | acos | adjacent |\n all | any | approximate_count |\n array_agg | array_fill | array_get |\n array_insert | array_join | array_replace |\n array_set | array_unpack | asin |\n assert | assert_distinct | assert_exists |\n assert_single | atan | atan2 |\n bit_and | bit_count | bit_lshift |\n bit_not | bit_or | bit_rshift |\n bit_xor | bounded_above | bounded_below |\n bytes_get_bit | ceil | contains |\n cos | cot | count |\n date_get | datetime_current | datetime_get |\n datetime_of_statement | datetime_of_transaction | datetime_truncate |\n duration_get | duration_normalize_days | duration_normalize_hours |\n duration_to_seconds | duration_truncate | enumerate |\n find | floor | get_current_branch |\n get_current_database | get_instance_name | get_transaction_isolation |\n get_version | get_version_as_str | json_array_unpack |\n json_get | json_object_pack | json_object_unpack |\n json_set | json_typeof | len |\n lg | ln | log |\n materialized | max | mean |\n min | multirange | multirange_unpack |\n overlaps | pi | random |\n range | range_get_lower | range_get_upper |\n range_is_empty | range_is_inclusive_lower | range_is_inclusive_upper |\n range_unpack | re_match | re_match_all |\n re_replace | re_test | reset_query_stats |\n round | search | sequence_next |\n sequence_reset | sin | sqrt |\n stddev | stddev_pop | str_lower |\n str_lpad | str_ltrim | str_pad_end |\n str_pad_start | str_repeat | str_replace |\n str_reverse | str_rpad | str_rtrim |\n str_split | str_title | str_trim |\n str_trim_end | str_trim_start | str_upper |\n strictly_above | strictly_below | sum |\n tan | time_get | to_bigint |\n to_bytes | to_date_duration | to_datetime |\n to_decimal | to_duration | to_float32 |\n to_float64 | to_int16 | to_int32 |\n to_int64 | to_json | to_local_date |\n to_local_datetime | to_local_time | to_relative_duration |\n to_str | to_uuid | uuid_generate_v1mc |\n uuid_generate_v4 | var | var_pop |\n with_options\n |\n # constraints\n constraint | exclusive | expression |\n len_value | max_ex_value | max_len_value |\n max_value | min_ex_value | min_len_value |\n min_value | one_of | regexp\n )\n |\n ([[:alpha:]_][[:alnum:]_]*)\n |\n (`.*?`)\n ) \\s*(\\()\n',
beginCaptures: {
1: {name: 'support.function.builtin.edgeql'},
2: {name: 'entity.name.function.edgeql'},
3: {name: 'string.interpolated.edgeql'},
4: {name: 'punctuation.definition.arguments.begin.edgeql'}
},
end: '(\\))',
endCaptures: {
1: {name: 'punctuation.definition.arguments.end.edgeql'}
},
name: 'meta.function-call.edgeql',
patterns: [{include: '#fncallargs'}]
},
{
begin:
'(?x)\n \\b(?<!\\.|\\.<|\\.>)\n # module\n (?:\n (\n cal | cfg | enc |\n ext | fts | go |\n http | js | lang |\n math | net | perm |\n pg | py | rs |\n schema | std | sys\n )\n |\n (?# masking built-ins in odd ways)\n (\n #functions\n abs | acos | adjacent |\n all | any | approximate_count |\n array_agg | array_fill | array_get |\n array_insert | array_join | array_replace |\n array_set | array_unpack | asin |\n assert | assert_distinct | assert_exists |\n assert_single | atan | atan2 |\n bit_and | bit_count | bit_lshift |\n bit_not | bit_or | bit_rshift |\n bit_xor | bounded_above | bounded_below |\n bytes_get_bit | ceil | contains |\n cos | cot | count |\n date_get | datetime_current | datetime_get |\n datetime_of_statement | datetime_of_transaction | datetime_truncate |\n duration_get | duration_normalize_days | duration_normalize_hours |\n duration_to_seconds | duration_truncate | enumerate |\n find | floor | get_current_branch |\n get_current_database | get_instance_name | get_transaction_isolation |\n get_version | get_version_as_str | json_array_unpack |\n json_get | json_object_pack | json_object_unpack |\n json_set | json_typeof | len |\n lg | ln | log |\n materialized | max | mean |\n min | multirange | multirange_unpack |\n overlaps | pi | random |\n range | range_get_lower | range_get_upper |\n range_is_empty | range_is_inclusive_lower | range_is_inclusive_upper |\n range_unpack | re_match | re_match_all |\n re_replace | re_test | reset_query_stats |\n round | search | sequence_next |\n sequence_reset | sin | sqrt |\n stddev | stddev_pop | str_lower |\n str_lpad | str_ltrim | str_pad_end |\n str_pad_start | str_repeat | str_replace |\n str_reverse | str_rpad | str_rtrim |\n str_split | str_title | str_trim |\n str_trim_end | str_trim_start | str_upper |\n strictly_above | strictly_below | sum |\n tan | time_get | to_bigint |\n to_bytes | to_date_duration | to_datetime |\n to_decimal | to_duration | to_float32 |\n to_float64 | to_int16 | to_int32 |\n to_int64 | to_json | to_local_date |\n to_local_datetime | to_local_time | to_relative_duration |\n to_str | to_uuid | uuid_generate_v1mc |\n uuid_generate_v4 | var | var_pop |\n with_options\n |\n #constraints\n constraint | exclusive | expression |\n len_value | max_ex_value | max_len_value |\n max_value | min_ex_value | min_len_value |\n min_value | one_of | regexp\n )\n |\n ([[:alpha:]_][[:alnum:]_]*)\n |\n (`.*?`)\n )\n\n \\s*(::)\\s*\n\n # function name\n (?:\n (\n #functions\n abs | acos | adjacent |\n all | any | approximate_count |\n array_agg | array_fill | array_get |\n array_insert | array_join | array_replace |\n array_set | array_unpack | asin |\n assert | assert_distinct | assert_exists |\n assert_single | atan | atan2 |\n bit_and | bit_count | bit_lshift |\n bit_not | bit_or | bit_rshift |\n bit_xor | bounded_above | bounded_below |\n bytes_get_bit | ceil | contains |\n cos | cot | count |\n date_get | datetime_current | datetime_get |\n datetime_of_statement | datetime_of_transaction | datetime_truncate |\n duration_get | duration_normalize_days | duration_normalize_hours |\n duration_to_seconds | duration_truncate | enumerate |\n find | floor | get_current_branch |\n get_current_database | get_instance_name | get_transaction_isolation |\n get_version | get_version_as_str | json_array_unpack |\n json_get | json_object_pack | json_object_unpack |\n json_set | json_typeof | len |\n lg | ln | log |\n materialized | max | mean |\n min | multirange | multirange_unpack |\n overlaps | pi | random |\n range | range_get_lower | range_get_upper |\n range_is_empty | range_is_inclusive_lower | range_is_inclusive_upper |\n range_unpack | re_match | re_match_all |\n re_replace | re_test | reset_query_stats |\n round | search | sequence_next |\n sequence_reset | sin | sqrt |\n stddev | stddev_pop | str_lower |\n str_lpad | str_ltrim | str_pad_end |\n str_pad_start | str_repeat | str_replace |\n str_reverse | str_rpad | str_rtrim |\n str_split | str_title | str_trim |\n str_trim_end | str_trim_start | str_upper |\n strictly_above | strictly_below | sum |\n tan | time_get | to_bigint |\n to_bytes | to_date_duration | to_datetime |\n to_decimal | to_duration | to_float32 |\n to_float64 | to_int16 | to_int32 |\n to_int64 | to_json | to_local_date |\n to_local_datetime | to_local_time | to_relative_duration |\n to_str | to_uuid | uuid_generate_v1mc |\n uuid_generate_v4 | var | var_pop |\n with_options\n |\n #constraints\n constraint | exclusive | expression |\n len_value | max_ex_value | max_len_value |\n max_value | min_ex_value | min_len_value |\n min_value | one_of | regexp\n )\n |\n ([[:alpha:]_][[:alnum:]_]*)\n |\n (`.*?`)\n ) \\s*(\\()\n',
beginCaptures: {
1: {name: 'support.other.module.builtin.edgeql'},
2: {name: 'support.function.builtin.edgeql'},
3: {name: 'entity.name.function.edgeql'},
4: {name: 'string.interpolated.edgeql'},
5: {name: 'keyword.operator.namespace.edgeql'},
6: {name: 'support.function.builtin.edgeql'},
7: {name: 'entity.name.function.edgeql'},
8: {name: 'string.interpolated.edgeql'},
9: {name: 'punctuation.definition.arguments.begin.edgeql'}
},
end: '(\\))',
endCaptures: {
1: {name: 'punctuation.definition.arguments.end.edgeql'}
},
name: 'meta.function-call.edgeql',
patterns: [{include: '#fncallargs'}]
}
]
},
fnstatement: {
begin: '(?ix) \\b(?<![:\\.])(FUNCTION|AGGREGATE|ABSTRACT CONSTRAINT)\\b',
beginCaptures: {1: {name: 'keyword.declaration.edgeql'}},
end: '(?=[^\\s\\w:]|\\bEXTENDING\\b|$)',
patterns: [
{include: '#builtins'},
{include: '#identifier'},
{match: '(::)', name: 'keyword.operator.namespace.edgeql'}
]
},
identifier: {match: '([[:alpha:]_][[:alnum:]_]*)'},
keywords: {
patterns: [
{
match: '(?i)\\b(TRUE)\\b',
name: 'constant.language.boolean.true.edgeql'
},
{
match: '(?i)\\b(FALSE)\\b',
name: 'constant.language.boolean.false.edgeql'
},
{match: '(?i)\\b(EMPTY)\\b', name: 'constant.language.empty.edgeql'},
{
match: '(?i)\\b(?<!::|\\.|\\.<|\\.>)(CONSTRAINT)\\b(?!=\\s+\\()',
name: 'keyword.declaration.edgeql'
},
{
match:
'(?ix) \\b(?<!::|\\.|\\.<|\\.>)(\n (?# special case)\n (named \\s+ only)\n |\n (as \\s+ text)\n |\n (all (?!\\s*\\())\n |\n\n (?# unreserved)\n abort | abstract | access | after | alias |\n allow | annotation | applied | as | asc |\n assignment | before | blobal | branch | cardinality |\n cast | committed | config | conflict | cube |\n current | data | database | ddl | declare |\n default | deferrable | deferred | delegated | deny |\n desc | each | empty | extension | final |\n first | force | from | function | future |\n implicit | index | infix | inheritable | instance |\n into | isolation | last | link | migration |\n multi | object | of | only | onto |\n operator | optionality | order | orphan | overloaded |\n owned | package | permission | policy | populate |\n postfix | prefix | property | proposed | pseudo |\n read | reject | release | rename | repeatable |\n required | reset | restrict | rewrite | role |\n roles | rollup | savepoint | scalar | schema |\n sdl | serializable | session | source | superuser |\n system | target | template | ternary | then |\n to | transaction | trigger | type | unless |\n using | verbose | version | view | write\n |\n (?# reserved)\n administer | alter | analyze | and | anyarray |\n anyobject | anytuple | begin | by | case |\n check | commit | configure | create | deallocate |\n delete | describe | detached | discard | distinct |\n do | drop | else | end | except |\n exists | explain | extending | fetch | filter |\n for | get | global | grant | group |\n if | ilike | import | in | insert |\n intersect | introspect | is | like | limit |\n listen | load | lock | match | module |\n move | never | not | notify | offset |\n on | optional | or | over | partition |\n prepare | raise | refresh | revoke | rollback |\n select | set | single | start | typeof |\n union | update | variadic | when | window |\n with\n)\\b\n',
name: 'keyword.declaration.edgeql'
}
]
},
'link-properties': {
begin: '(\\@)',
end: '(?<=[[:alnum:]_`])',
name: 'support.other.linkproperty.edgeql',
patterns: [{include: '#identifier'}, {include: '#quoted-name'}]
},
number: {
patterns: [
{
captures: {
1: {name: 'invalid.illegal.dec.edgeql'},
2: {name: 'invalid.illegal.dec.edgeql'},
4: {name: 'invalid.illegal.dec.edgeql'},
5: {name: 'storage.type.number.edgeql'},
6: {name: 'invalid.illegal.dec.edgeql'},
7: {name: 'invalid.illegal.dec.edgeql'}
},
match:
'(?x)\n (?:\n #decimal part\n \\.(_*)(?:[0-9](?:[0-9_]*[0-9])?)\n |\n # integer part\n \\b(?: [1-9](?: [0-9_]*[0-9] )? | 0 )\n (?:\\.(_*)[0-9](?:[0-9_]*[0-9])?)\n )\n ((_*)([eE][\\+\\-]?)(_*)[0-9](?:[0-9_]*[0-9])?)?\n\n (_*)\n \\b\n',
name: 'constant.numeric.float.edgeql'
},
{
captures: {
2: {name: 'invalid.illegal.dec.edgeql'},
3: {name: 'storage.type.number.edgeql'},
4: {name: 'invalid.illegal.dec.edgeql'},
5: {name: 'invalid.illegal.dec.edgeql'}
},
match:
'(?x)\n (?:\n # integer part\n \\b(?:[1-9](?:[0-9_]*[0-9])?|0)\n )\n ((_*)([eE][\\+\\-]?)(_*)[0-9](?:[0-9_]*[0-9])?)\n\n (_*)\n \\b\n',
name: 'constant.numeric.float.edgeql'
},
{
captures: {
1: {name: 'invalid.illegal.dec.edgeql'},
2: {name: 'invalid.illegal.dec.edgeql'},
4: {name: 'invalid.illegal.dec.edgeql'},
5: {name: 'storage.type.number.edgeql'},
6: {name: 'invalid.illegal.dec.edgeql'},
7: {name: 'invalid.illegal.dec.edgeql'},
8: {name: 'storage.type.number.edgeql'}
},
match:
'(?x)\n (?:\n #decimal part\n \\.(_*)(?:[0-9](?:[0-9_]*[0-9])?)\n |\n # integer part\n \\b(?:[1-9](?:[0-9_]*[0-9])?|0)\n (?:\\.(_*)[0-9](?:[0-9_]*[0-9])?)?\n )\n ((_*)([eE][\\+\\-]?)(_*)[0-9](?:[0-9_]*[0-9])?)?\n\n (_*)\n (n)\n',
name: 'constant.numeric.decimal.edgeql'
},
{
captures: {
1: {name: 'invalid.illegal.dec.edgeql'},
2: {name: 'invalid.illegal.dec.edgeql'}
},
match:
'(?x)\n (?:\n # integer part\n \\b(?:[1-9](?:[0-9_]*[0-9])?|0)\n )\n (_*)\n \\b\n',
name: 'constant.numeric.integer.edgeql'
}
]
},
operators: {
patterns: [
{match: '(\\.[<>])', name: 'keyword.operator.navigation.edgeql'},
{match: '(::)', name: 'keyword.operator.namespace.edgeql'},
{match: '->', name: 'keyword.declaration.edgeql'},
{match: '(:(?!=))', name: 'punctuation.declaration.delimiter.edgeql'},
{
match:
'(?x)\n \\?\\!\\= | \\?\\? | \\?\\= | \\>\\= | \\<\\= | \\:\\= | \\/\\/ | \\+\\+ |\n \\!\\= | \\^ | \\> | \\= | \\< | \\/ | \\- | \\+ |\n \\* | \\%\n',
name: 'keyword.operator.edgeql'
}
]
},
parencommon: {
patterns: [
{match: '(,)', name: 'punctuation.separator.element.edgeql'},
{match: '(;)', name: 'invalid.illegal.delimiter.edgeql'}
]
},
parentheses: {
begin: '(\\()',
beginCaptures: {1: {name: 'punctuation.parenthesis.begin.edgeql'}},
end: '(\\))',
endCaptures: {1: {name: 'punctuation.parenthesis.end.edgeql'}},
patterns: [{include: '#expressions'}, {include: '#parencommon'}]
},
'quoted-name': {match: '(`.*?`)', name: 'string.interpolated.edgeql'},
shape: {
begin: '(?=\\S)',
end: '(?=\\})',
patterns: [
{match: '(;)', name: 'punctuation.statement.delimiter.edgeql'},
{include: '#expressions'},
{include: '#parencommon'}
]
},
squarebraces: {
begin: '(\\[)',
beginCaptures: {1: {name: 'punctuation.parenthesis.begin.edgeql'}},
end: '(\\])',
endCaptures: {1: {name: 'punctuation.parenthesis.end.edgeql'}},
patterns: [
{match: '(^|\\b|\\s)(->)($|\\b|\\s)', name: 'keyword.operator.edgeql'},
{include: '#expressions'},
{include: '#parencommon'}
]
},
string: {
patterns: [
{
begin: '(r)([\'"])',
beginCaptures: {
1: {name: 'storage.type.string.edgeql'},
2: {name: 'punctuation.definition.string.begin.edgeql'}
},
end: '(\\2)',
endCaptures: {1: {name: 'punctuation.definition.string.end.edgeql'}},
name: 'string.quoted.raw.edgeql'
},
{
begin: '([\'"])',
beginCaptures: {
1: {name: 'punctuation.definition.string.begin.edgeql'}
},
end: '(\\1)',
endCaptures: {1: {name: 'punctuation.definition.string.end.edgeql'}},
name: 'string.quoted.edgeql',
patterns: [
{include: '#string-escapes'},
{include: '#string-invalid-escapes'}
]
},
{
begin: '(\\$([[:alpha:]_][[:alnum:]]*)*\\$)',
beginCaptures: {
1: {name: 'punctuation.definition.string.begin.edgeql'}
},
end: '(\\1)',
endCaptures: {1: {name: 'punctuation.definition.string.end.edgeql'}},
name: 'string.dollar.edgeql'
}
]
},
'string-escapes': {
match:
'(?x)\n (\n \\\\(?=\\s*\\n) |\n \\\\[\\\\\'"bfnrt] |\n \\\\x[0-7][0-9a-fA-F] |\n \\\\u[0-9a-fA-F]{4} |\n \\\\U[0-9a-fA-F]{8}\n )\n',
name: 'constant.character.escape.edgeql'
},
'string-invalid-escapes': {
match: '(\\\\.)',
name: 'invalid.illegal.escapes.edgeql'
},
types: {
patterns: [
{
begin: '\\b(?<!::|\\.)(tuple)\\s*(<)',
beginCaptures: {
1: {name: 'storage.type.edgeql'},
2: {name: 'storage.type.placeholder.begin.edgeql'}
},
end: '(>)',
endCaptures: {1: {name: 'storage.type.placeholder.end.edgeql'}},
patterns: [
{include: '#types'},
{match: '(,)', name: 'punctuation.separator.type.edgeql'},
{match: '(:)'},
{include: '#types-common'}
]
},
{
begin: '\\b(?<!::|\\.)(array)\\s*(<)',
beginCaptures: {
1: {name: 'storage.type.edgeql'},
2: {name: 'storage.type.placeholder.begin.edgeql'}
},
end: '(>)',
endCaptures: {1: {name: 'storage.type.placeholder.end.edgeql'}},
patterns: [
{match: 'array', name: 'invalid.illegal.type.edgeql'},
{include: '#types'},
{include: '#array-dimensions'},
{include: '#types-common'}
]
},
{
match: '(?x) \\b(?<!::|\\.)(\n array | tuple\n)\\b\n',
name: 'storage.type.edgeql'
},
{include: '#builtin-modules'},
{include: '#builtin-types'},
{include: '#builtin-indexes'}
]
},
'types-common': {
patterns: [
{include: '#identifier'},
{match: '(::)', name: 'keyword.operator.namespace.edgeql'}
]
},
values: {
patterns: [
{include: '#number'},
{include: '#bytes'},
{include: '#string'}
]
},
variables: {
begin: '(\\$)(?=[[:alnum:]_]|`)',
end: '(?<=[[:alnum:]_`])',
name: 'constant.language.variable.edgeql',
patterns: [
{include: '#identifier'},
{include: '#quoted-name'},
{match: '(\\d)+'}
]
}
},
scopeName: 'source.edgeql'
}
export default grammar