@surrealdb/lezer 1.0.0-beta.21 → 1.0.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,186 @@ expression {
43
43
  value
44
44
  }
45
45
 
46
+ paramDefinition[@name=ParamDefinition] {
47
+ VariableName
48
+ (":" Type { type })?
49
+ }
50
+
51
+ escapedParamDefinition[@name=ParamDefinition] {
52
+ VariableName
53
+ (":" Type { safeType })?
54
+ }
55
+
56
+ anyKeyword {
57
+ access |
58
+ algorithm |
59
+ alter |
60
+ analyzer |
61
+ any |
62
+ as |
63
+ asc |
64
+ assert |
65
+ at |
66
+ authenticate |
67
+ auto |
68
+ begin |
69
+ bm25 |
70
+ break |
71
+ by |
72
+ cancel |
73
+ capacity |
74
+ changefeed |
75
+ changes |
76
+ columns |
77
+ comment |
78
+ commit |
79
+ concurrently |
80
+ config |
81
+ content |
82
+ continue |
83
+ create |
84
+ database |
85
+ db |
86
+ default |
87
+ define |
88
+ delete |
89
+ desc |
90
+ dimension |
91
+ dist |
92
+ doc_ids_cache |
93
+ doc_ids_order |
94
+ doc_lengths_cache |
95
+ doc_lengths_order |
96
+ drop |
97
+ duplicate |
98
+ duration |
99
+ efc |
100
+ else |
101
+ end |
102
+ event |
103
+ exclude |
104
+ exists |
105
+ explain |
106
+ extend_candidates |
107
+ fetch |
108
+ field |
109
+ fields |
110
+ filters |
111
+ flexible |
112
+ for |
113
+ from |
114
+ functions |
115
+ graphql |
116
+ group |
117
+ highlights |
118
+ hnsw |
119
+ if |
120
+ ignore |
121
+ in |
122
+ include |
123
+ index |
124
+ info |
125
+ insert |
126
+ into |
127
+ issuer |
128
+ jwt |
129
+ keep_pruned_connections |
130
+ key |
131
+ kill |
132
+ let |
133
+ limit |
134
+ live |
135
+ lm |
136
+ m |
137
+ m0 |
138
+ merge |
139
+ mtree |
140
+ mtree_cache |
141
+ namespace |
142
+ noindex |
143
+ normal |
144
+ not |
145
+ ns |
146
+ on |
147
+ only |
148
+ option |
149
+ order |
150
+ out |
151
+ overwrite |
152
+ parallel |
153
+ param |
154
+ passhash |
155
+ password |
156
+ patch |
157
+ permissions |
158
+ postings_cache |
159
+ postings_order |
160
+ readonly |
161
+ rebuild |
162
+ record |
163
+ relate |
164
+ relation |
165
+ remove |
166
+ return |
167
+ roles |
168
+ root |
169
+ sc |
170
+ schemafull |
171
+ schemaless |
172
+ scope |
173
+ search |
174
+ select |
175
+ session |
176
+ set |
177
+ show |
178
+ signin |
179
+ signup |
180
+ since |
181
+ sleep |
182
+ split |
183
+ start |
184
+ structure |
185
+ table |
186
+ tables |
187
+ tb |
188
+ tempfiles |
189
+ terms_cache |
190
+ terms_order |
191
+ then |
192
+ throw |
193
+ timeout |
194
+ to |
195
+ token |
196
+ tokenizers |
197
+ transaction |
198
+ typeKeyword |
199
+ unique |
200
+ unset |
201
+ update |
202
+ upsert |
203
+ url |
204
+ use |
205
+ user |
206
+ valueKeyword |
207
+ values |
208
+ when |
209
+ where |
210
+ with
211
+ }
212
+
213
+ anyLiteral {
214
+ after |
215
+ before |
216
+ diff |
217
+ false |
218
+ full |
219
+ none |
220
+ null |
221
+ true |
222
+
223
+ IndexTypeClause
224
+ }
225
+
46
226
  SubQuery {
47
227
  "("
48
228
  expression
@@ -54,7 +234,7 @@ Block {
54
234
  }
55
235
 
56
236
  Closure[since=2_0_0] {
57
- ParamList { "|" commaSep<VariableName ":" safeType>? "|" } ("->" type)? Block
237
+ "|" commaSep<escapedParamDefinition>? "|" ("->" type)? Block
58
238
  }
59
239
 
60
240
  subqueryStatement {
@@ -103,41 +283,40 @@ CommitStatement { commit transaction? }
103
283
  DefineStatement {
104
284
  define
105
285
  (
106
- AccessDefinition[since=2_0_0] { access defineAccessOptions } |
107
- ( namespace defineNamespaceOptions ) |
108
- ( database defineDatabaseOptions ) |
109
- ( user defineUserOptions ) |
110
- ( token defineTokenOptions ) |
111
- ( event defineEventOptions ) |
112
- ( field defineFieldOptions ) |
113
- ( index defineIndexOptions ) |
114
- ( analyzer defineAnalyzerOptions ) |
115
- ( functionKw defineFunctionOptions ) |
116
- ( param defineParamOptions ) |
117
- ScopeDefinition[until=2_0_0] { scope defineScopeOptions } |
118
- ( table defineTableOptions ) |
119
- ( config defineConfigOptions ) |
120
- ( api defineApiOptions )
286
+ AccessDefinition[since=2_0_0] { access defineAccessOptions } |
287
+ ( namespace defineNamespaceOptions ) |
288
+ ( database defineDatabaseOptions ) |
289
+ ( user defineUserOptions ) |
290
+ ( token defineTokenOptions ) |
291
+ ( event defineEventOptions ) |
292
+ ( field defineFieldOptions ) |
293
+ ( index defineIndexOptions ) |
294
+ ( analyzer defineAnalyzerOptions ) |
295
+ ( functionKw defineFunctionOptions ) |
296
+ ( param defineParamOptions ) |
297
+ ScopeDefinition[until=2_0_0] { scope defineScopeOptions } |
298
+ ( table defineTableOptions ) |
299
+ ( config defineConfigOptions ) |
300
+ ( api defineApiOptions ) |
301
+ ( bucket defineBucketOptions )
121
302
  )
122
303
  }
123
304
 
124
305
  defineAccessOptions {
125
- (IfNotExistsClause | overwrite)?
126
- Ident
127
- accessClauses1 {
128
- OnRootNsDbClause
129
- AccessTypeClause
130
- }
131
- accessClauses2 {
132
- AuthenticateClause?
133
- DurationClause?
134
- CommentClause?
135
- }
306
+ (IfNotExistsClause | OverwriteClause)?
307
+ value
308
+ OnRootNsDbClause
309
+ (
310
+ AccessTypeClause |
311
+ AuthenticateClause |
312
+ DurationClause |
313
+ CommentClause
314
+ )*
136
315
  }
137
316
 
138
317
  defineAnalyzerOptions {
139
318
  (IfNotExistsClause | OverwriteClause)?
140
- Ident
319
+ value
141
320
  (
142
321
  TokenizersClause |
143
322
  FiltersClause |
@@ -148,7 +327,7 @@ defineAnalyzerOptions {
148
327
 
149
328
  defineEventOptions {
150
329
  (IfNotExistsClause | OverwriteClause)?
151
- Ident
330
+ value
152
331
  OnTableClause
153
332
  (
154
333
  WhenClause {
@@ -165,13 +344,13 @@ defineEventOptions {
165
344
 
166
345
  defineDatabaseOptions {
167
346
  (IfNotExistsClause | OverwriteClause)?
168
- Ident on Ident
347
+ value on value
169
348
  CommentClause?
170
349
  }
171
350
 
172
351
  defineFieldOptions {
173
352
  (IfNotExistsClause | OverwriteClause)?
174
- Ident
353
+ value
175
354
  OnTableClause
176
355
  (
177
356
  TypeClause |
@@ -181,14 +360,15 @@ defineFieldOptions {
181
360
  AssertClause |
182
361
  PermissionsForClause |
183
362
  CommentClause |
184
- ReferenceClause
363
+ ReferenceClause |
364
+ ComputedClause
185
365
  )*
186
366
  }
187
367
 
188
368
  defineFunctionOptions {
189
369
  (IfNotExistsClause | OverwriteClause)?
190
370
  customFunctionName
191
- ParamList { "(" commaSep<VariableName ":" type>? ")" }
371
+ params { "(" commaSep<paramDefinition>? ")" }
192
372
  ("->" type)?
193
373
  Block
194
374
  (
@@ -201,7 +381,7 @@ functionKw[@name=Keyword] { function }
201
381
 
202
382
  defineIndexOptions {
203
383
  (IfNotExistsClause | OverwriteClause)?
204
- Ident
384
+ value
205
385
  OnTableClause
206
386
  (
207
387
  FieldsColumnsClause |
@@ -213,7 +393,7 @@ defineIndexOptions {
213
393
 
214
394
  defineNamespaceOptions {
215
395
  (IfNotExistsClause | OverwriteClause)?
216
- Ident
396
+ value
217
397
  CommentClause?
218
398
  }
219
399
 
@@ -230,7 +410,7 @@ defineParamOptions {
230
410
 
231
411
  defineScopeOptions {
232
412
  (IfNotExistsClause | OverwriteClause)?
233
- Ident
413
+ value
234
414
  (
235
415
  SessionClause |
236
416
  SigninClause |
@@ -241,7 +421,7 @@ defineScopeOptions {
241
421
 
242
422
  defineTableOptions {
243
423
  (IfNotExistsClause | OverwriteClause)?
244
- Ident
424
+ value
245
425
  (
246
426
  drop |
247
427
  (schemafull | schemaless) |
@@ -276,15 +456,15 @@ defineConfigApiOptions {
276
456
 
277
457
  defineTokenOptions {
278
458
  (IfNotExistsClause | OverwriteClause)?
279
- Ident
280
- ( on ( namespace | database | scope Ident ) )
459
+ value
460
+ ( on ( namespace | database | scope value ) )
281
461
  TokenTypeClause
282
462
  ( valueKeyword String )
283
463
  }
284
464
 
285
465
  defineUserOptions {
286
466
  (IfNotExistsClause | OverwriteClause)?
287
- Ident
467
+ value
288
468
  OnRootNsDbClause
289
469
  ( ( password | passhash ) String )
290
470
  ( roles commaSep<Ident> )
@@ -314,18 +494,28 @@ HttpMethod {
314
494
  get | put | post | delete | patch | trace
315
495
  }
316
496
 
497
+ defineBucketOptions {
498
+ (IfNotExistsClause | OverwriteClause)?
499
+ value
500
+ (
501
+ BackendClause |
502
+ PermissionsBasicClause |
503
+ CommentClause
504
+ )*
505
+ }
506
+
317
507
  // Alter statement
318
508
 
319
509
  AlterStatement[since=2_0_0] {
320
510
  alter
321
511
  (
322
- ( table alterTableOptions )
512
+ table alterTableOptions
323
513
  )
324
514
  }
325
515
 
326
516
  alterTableOptions {
327
517
  IfNotExistsClause?
328
- Ident
518
+ value
329
519
  (
330
520
  drop |
331
521
  (schemafull | schemaless) |
@@ -339,18 +529,20 @@ alterTableOptions {
339
529
  RemoveStatement {
340
530
  remove
341
531
  (
342
- ( namespace IfExistsClause? Ident (and expunge)? ) |
343
- ( database IfExistsClause? Ident (and expunge)? ) |
344
- ( user IfExistsClause? Ident on ( root | namespace | database ) ) |
345
- ( token IfExistsClause? Ident on ( namespace | database | scope ) ) |
346
- ( event IfExistsClause? Ident on table? Ident ) |
347
- ( field IfExistsClause? Ident on table? Ident ) |
348
- ( index IfExistsClause? Ident on table? Ident ) |
349
- ( analyzer IfExistsClause? Ident ) |
350
- ( functionKw IfExistsClause? customFunctionName ) |
351
- ( param IfExistsClause? VariableName ) |
352
- ( scope IfExistsClause? Ident ) |
353
- ( table IfExistsClause? Ident (and expunge)? )
532
+ ( namespace IfExistsClause? value (and expunge)? ) |
533
+ ( database IfExistsClause? value (and expunge)? ) |
534
+ ( user IfExistsClause? value on ( root | namespace | database ) ) |
535
+ ( token IfExistsClause? value on ( namespace | database | scope ) ) |
536
+ ( event IfExistsClause? value OnTableClause ) |
537
+ ( field IfExistsClause? value OnTableClause ) |
538
+ ( index IfExistsClause? value OnTableClause ) |
539
+ ( analyzer IfExistsClause? value ) |
540
+ ( functionKw IfExistsClause? customFunctionName ) |
541
+ ( param IfExistsClause? VariableName ) |
542
+ ( scope IfExistsClause? value ) |
543
+ ( table IfExistsClause? value (and expunge)? )
544
+ ( api IfExistsClause? value ) |
545
+ ( bucket IfExistsClause? value )
354
546
  )
355
547
  }
356
548
 
@@ -360,17 +552,19 @@ CreateStatement {
360
552
  create only?
361
553
  createTargets { commaSep<Ident | VariableName | FunctionCall | RecordId> }
362
554
  createContent { ContentClause | SetClause | UnsetClause | () }
363
- ReturnClause?
364
- TimeoutClause?
365
- ParallelClause?
555
+ createOptionals {
556
+ ReturnClause?
557
+ TimeoutClause?
558
+ ParallelClause?
559
+ }
366
560
  }
367
561
 
368
562
  SelectStatement {
369
- (select)
370
- (Fields)
371
- (OmitClause?)
372
- (from)
373
- (only)?
563
+ select
564
+ Fields
565
+ OmitClause?
566
+ from
567
+ only?
374
568
  (
375
569
  statement |
376
570
  (
@@ -399,19 +593,23 @@ DeleteStatement {
399
593
  statement |
400
594
  (
401
595
  commaSep<value>
402
- WhereClause?
403
- ReturnClause?
404
- TimeoutClause?
405
- ParallelClause?
596
+ (
597
+ WhereClause |
598
+ ReturnClause |
599
+ TimeoutClause |
600
+ ParallelClause
601
+ )*
406
602
  )
407
603
  )
408
604
  }
409
605
 
410
606
  InsertStatement {
411
607
  insert
412
- ignore?
413
- relation?
414
- (into Ident)?
608
+ insertOptionals {
609
+ ignore?
610
+ relation?
611
+ (into Ident)?
612
+ }
415
613
  (
416
614
  // TODO this should be value, but cannot easily union with VALUES syntax
417
615
  Object |
@@ -432,75 +630,21 @@ InsertStatement {
432
630
  InsertReturnClause[since=2_0_0] { ReturnClause? }
433
631
  }
434
632
 
435
- IfElseStatement {
436
- if
437
- (
438
- Legacy {
439
- value
440
- then
441
- ( Block | SubQuery)
442
- (
443
- else if
444
- value
445
- then
446
- ( Block | SubQuery)
447
- )*
448
- (
449
- else
450
- ( Block | SubQuery)
451
- )?
452
- end
453
- } |
454
- Modern {
455
- value Block
456
- (
457
- else if
458
- value Block
459
- )*
460
- (
461
- else Block
462
- )?
463
- }
464
- )
465
- }
466
-
467
- relateSubject { Array | Ident | FunctionCall | VariableName | RecordId }
468
- RelateStatement {
469
- relate only?
470
- relateSubject ("->" | "<-") relateSubject ("->" | "<-") relateSubject
471
- ( ContentClause | SetClause )?
472
- ReturnClause?
473
- TimeoutClause?
474
- ParallelClause?
475
- }
476
-
477
- InfoForStatement {
478
- info for
479
- (
480
- root |
481
- ns | namespace |
482
- db | database |
483
- ( sc Ident | scope Ident) |
484
- ( tb Ident | table Ident)
485
- )
486
- structure?
487
- }
488
-
489
633
  UpdateStatement {
490
634
  update only?
491
635
  (
492
636
  statement |
493
637
  (
494
638
  commaSep<value>
495
- updateClause1 {
639
+ (
496
640
  ContentClause |
497
641
  ReplaceClause |
498
642
  MergeClause |
499
643
  PatchClause |
500
644
  SetClause |
501
645
  UnsetClause
502
- }?
503
- updateClause2 {
646
+ )?
647
+ updateOptionals {
504
648
  WhereClause?
505
649
  ReturnClause?
506
650
  TimeoutClause?
@@ -516,15 +660,15 @@ UpsertStatement[since=2_0_0] {
516
660
  statement |
517
661
  (
518
662
  commaSep<value>
519
- updateClause1 {
663
+ (
520
664
  ContentClause |
521
665
  ReplaceClause |
522
666
  MergeClause |
523
667
  PatchClause |
524
668
  SetClause |
525
669
  UnsetClause
526
- }?
527
- updateClause2 {
670
+ )?
671
+ upsertOptionals {
528
672
  WhereClause?
529
673
  ReturnClause?
530
674
  TimeoutClause?
@@ -534,14 +678,75 @@ UpsertStatement[since=2_0_0] {
534
678
  )
535
679
  }
536
680
 
681
+ relateSubject { Array | Ident | FunctionCall | VariableName | RecordId }
682
+
683
+ RelateStatement {
684
+ relate only?
685
+ relateSubject ("->" | "<-") relateSubject ("->" | "<-") relateSubject
686
+ ( ContentClause | SetClause )?
687
+ relateOptionals {
688
+ ReturnClause?
689
+ TimeoutClause?
690
+ ParallelClause?
691
+ }
692
+ }
693
+
694
+ // Info statement
695
+
696
+ InfoForStatement {
697
+ info for
698
+ (
699
+ root |
700
+ ns | namespace |
701
+ db | database |
702
+ ( sc Ident | scope Ident) |
703
+ ( tb Ident | table Ident)
704
+ )
705
+ structure?
706
+ }
707
+
537
708
  // Control statements
709
+
538
710
  BreakStatement { break }
539
711
  ContinueStatement { continue }
540
712
  ForStatement { for VariableName in ( Array | VariableName | SubQuery | Block ) Block }
541
713
  ReturnStatement { return expression }
542
714
  ThrowStatement { throw value }
543
715
 
716
+ IfElseStatement {
717
+ if
718
+ (
719
+ Legacy {
720
+ value
721
+ then
722
+ ( Block | SubQuery)
723
+ (
724
+ else if
725
+ value
726
+ then
727
+ ( Block | SubQuery)
728
+ )*
729
+ (
730
+ else
731
+ ( Block | SubQuery)
732
+ )?
733
+ end
734
+ } |
735
+ Modern {
736
+ value Block
737
+ (
738
+ else if
739
+ value Block
740
+ )*
741
+ (
742
+ else Block
743
+ )?
744
+ }
745
+ )
746
+ }
747
+
544
748
  // Live statements
749
+
545
750
  KillStatement { kill String }
546
751
  LiveSelectStatement {
547
752
  live select
@@ -555,14 +760,17 @@ LiveSelectStatement {
555
760
  FetchClause?
556
761
  }
557
762
 
558
- // Other statements
763
+ // Let statement
764
+
559
765
  LetStatement {
560
- let LetStatementName { VariableName }
561
- LetStatementType[since=2_0_0] { (":" type)? }
766
+ let
767
+ paramDefinition
562
768
  "="
563
769
  (value | subqueryStatement)
564
770
  }
565
771
 
772
+ // Show statement
773
+
566
774
  ShowStatement {
567
775
  show changes for table
568
776
  Ident
@@ -570,28 +778,37 @@ ShowStatement {
570
778
  ( limit number )?
571
779
  }
572
780
 
781
+ // Sleep statement
782
+
573
783
  SleepStatement {
574
784
  sleep Duration
575
785
  }
576
786
 
787
+ // Use statement
788
+
577
789
  useNs { ( ns | namespace ) Ident }
578
790
  useDb { ( db | database ) Ident }
791
+
579
792
  UseStatement {
580
793
  use
581
794
  ( useNs | useDb | ( useNs useDb ) )
582
795
  }
583
796
 
797
+ // Option statement
798
+
584
799
  OptionStatement {
585
- option
586
- Ident
587
- ( "=" ( true | false ) )?
800
+ option
801
+ Ident
802
+ ( "=" ( true | false ) )?
588
803
  }
589
804
 
805
+ // Rebuild statement
806
+
590
807
  RebuildStatement[since=1_5_0] {
591
- rebuild index
592
- IfExistsClause?
593
- Ident
594
- OnTableClause
808
+ rebuild index
809
+ IfExistsClause?
810
+ Ident
811
+ OnTableClause
595
812
  }
596
813
 
597
814
  // Values
@@ -621,11 +838,6 @@ baseValue {
621
838
  Point { "(" number "," number ")" }
622
839
  }
623
840
 
624
- Any { "?" }
625
- AnyStar[@name=Any] { "*" }
626
- At[since=2_1_0] { "@" }
627
- Optional[since=2_0_0] { "?" }
628
-
629
841
  value[@isGroup=Value] {
630
842
  baseValue |
631
843
  BinaryExpression |
@@ -633,6 +845,11 @@ value[@isGroup=Value] {
633
845
  Path
634
846
  }
635
847
 
848
+ Any { "?" }
849
+ AnyStar[@name=Any] { "*" }
850
+ At[since=2_1_0] { "@" }
851
+ Optional[since=2_0_0] { "?" }
852
+
636
853
  // Binary expressions
637
854
 
638
855
  BinaryExpression {
@@ -646,14 +863,18 @@ Range[since=2_0_0] {
646
863
  value !range rangeOp !range value
647
864
  }
648
865
 
866
+ Idiom {
867
+ Ident ( "." Ident )*
868
+ }
869
+
649
870
  Path {
650
871
  baseValue pathElement+ |
651
872
  At ( dotPart pathElement* | pathElement+ ) |
652
- GraphPath pathElement*
873
+ Lookup pathElement*
653
874
  }
654
875
 
655
876
  pathElement {
656
- GraphPath |
877
+ Lookup |
657
878
  Subscript {
658
879
  Optional?
659
880
  "."
@@ -671,12 +892,12 @@ dotPart {
671
892
  Recurse
672
893
  }
673
894
 
674
- GraphPath {
675
- ("<-" | "->" | "<->")
676
- (Ident | Any | GraphSelection)
895
+ Lookup {
896
+ ("<-" | "->" | "<->" | "<~")
897
+ (Ident | Any | LookupSelection)
677
898
  }
678
899
 
679
- GraphSelection {
900
+ LookupSelection {
680
901
  "("
681
902
  GraphFieldSelection[since=2_2_0] {
682
903
  select
@@ -700,7 +921,7 @@ GraphPredicate {
700
921
  }
701
922
 
702
923
  Destructure[since=2_0_0] {
703
- "{" commaSep<((Ident ":")? ( Ident | GraphPath ) pathElement* )> "}"
924
+ "{" commaSep<((Ident ":")? ( Ident | Lookup ) pathElement* )> "}"
704
925
  }
705
926
 
706
927
  IdiomFunction[since=2_0_0] {
@@ -723,11 +944,11 @@ RecurseRange {
723
944
  }
724
945
 
725
946
  RecurseOptions[since=2_2_0] {
726
- ("+" recurseOptionName ("=" baseValue)?)*
947
+ ("+" recurseOptionName ("=" baseValue)?)*
727
948
  }
728
949
 
729
950
  recurseOptionName[@name=FunctionName] {
730
- rawident
951
+ rawident
731
952
  }
732
953
 
733
954
  // Fields
@@ -758,7 +979,7 @@ Object {
758
979
 
759
980
  // Arrays
760
981
 
761
- Array { "[" commaSep<value>? "]"}
982
+ Array { "[" commaSepTrailing<value>? "]"}
762
983
 
763
984
  // Record Ids
764
985
 
@@ -768,6 +989,8 @@ RecordTbIdent {
768
989
  bracketIdent
769
990
  }
770
991
 
992
+ // Ideally we match "number" here, but I cannot for the life of me get it to
993
+ // fall back to numberident after. This will suffice for now.
771
994
  RecordIdIdent {
772
995
  numberident |
773
996
  tickIdent |
@@ -776,7 +999,6 @@ RecordIdIdent {
776
999
 
777
1000
  recordIdValue {
778
1001
  RecordIdIdent |
779
- number |
780
1002
  Array |
781
1003
  Object |
782
1004
  RecordIdString { prefixedString }
@@ -820,8 +1042,8 @@ FunctionJs {
820
1042
  "/*" (blockCommentContent | blockCommentNewline)* blockCommentEnd
821
1043
  }
822
1044
  FormatString {
823
- 'f"' (formatStringContentDouble | Interpolation)* '"' |
824
- "f'" (formatStringContentSingle | Interpolation)* "'"
1045
+ '$"' (formatStringContentDouble | Interpolation)* '"' |
1046
+ "$'" (formatStringContentSingle | Interpolation)* "'"
825
1047
  }
826
1048
  }
827
1049
 
@@ -837,7 +1059,8 @@ FunctionCall {
837
1059
  Version { "<" VersionNumber ">" }?
838
1060
  ArgumentList
839
1061
  ) |
840
- RecordId ArgumentList
1062
+ RecordId ArgumentList |
1063
+ VariableName ArgumentList
841
1064
  }
842
1065
 
843
1066
  ArgumentList { "(" (commaSep<value>? | subqueryStatement) ")" }
@@ -914,7 +1137,7 @@ JwtClause {
914
1137
  }
915
1138
 
916
1139
  OnTableClause {
917
- on table? Ident
1140
+ on table? value
918
1141
  }
919
1142
 
920
1143
  OnRootNsDbClause {
@@ -946,9 +1169,18 @@ UniqueClause {
946
1169
  SearchAnalyzerClause {
947
1170
  search analyzer
948
1171
  Ident
949
- (Bm25Clause | DocIdsOrderClause | DocLenghtsOrderClause | PostingsOrderClause |
950
- TermsOrderClause | DocIdsCacheClause | DocLenghtsCacheClause | PostingsCacheClause |
951
- TermsCacheClause | highlights)*
1172
+ (
1173
+ Bm25Clause |
1174
+ DocIdsOrderClause |
1175
+ DocLenghtsOrderClause |
1176
+ PostingsOrderClause |
1177
+ TermsOrderClause |
1178
+ DocIdsCacheClause |
1179
+ DocLenghtsCacheClause |
1180
+ PostingsCacheClause |
1181
+ TermsCacheClause |
1182
+ highlights
1183
+ )*
952
1184
  }
953
1185
 
954
1186
  Bm25Clause { bm25 ( "(" number "," number ")")? }
@@ -1017,7 +1249,7 @@ SetClause {
1017
1249
  }
1018
1250
 
1019
1251
  OmitClause {
1020
- omit commaSep<inclusivePredicate>
1252
+ omit commaSep<inclusivePredicate>
1021
1253
  }
1022
1254
 
1023
1255
  UnsetClause {
@@ -1079,7 +1311,7 @@ LimitStartComboClause {
1079
1311
  GroupClause {
1080
1312
  group
1081
1313
  (
1082
- by? commaSep<Ident> |
1314
+ by? commaSep<Idiom> |
1083
1315
  all
1084
1316
  )
1085
1317
  }
@@ -1093,7 +1325,7 @@ OrderClause {
1093
1325
  SplitClause {
1094
1326
  split
1095
1327
  on?
1096
- Ident
1328
+ Idiom
1097
1329
  }
1098
1330
 
1099
1331
  WhereClause {
@@ -1162,6 +1394,11 @@ ReferenceClause {
1162
1394
  (on delete (reject | cascade | ignore | unset | then Block))?
1163
1395
  }
1164
1396
 
1397
+ ComputedClause {
1398
+ computed
1399
+ value
1400
+ }
1401
+
1165
1402
  PermissionsForClause {
1166
1403
  permissions
1167
1404
  (
@@ -1180,8 +1417,8 @@ PermissionsBasicClause {
1180
1417
  }
1181
1418
 
1182
1419
  MiddlewareClause {
1183
- middleware
1184
- commaSep<FunctionCall>
1420
+ middleware
1421
+ commaSep<FunctionCall>
1185
1422
  }
1186
1423
 
1187
1424
  CommentClause {
@@ -1202,6 +1439,11 @@ TokenTypeClause {
1202
1439
  TokenType
1203
1440
  }
1204
1441
 
1442
+ BackendClause {
1443
+ backend
1444
+ value
1445
+ }
1446
+
1205
1447
  // Support
1206
1448
 
1207
1449
  AnalyzerFilters {
@@ -1209,10 +1451,10 @@ AnalyzerFilters {
1209
1451
  }
1210
1452
 
1211
1453
  Order {
1212
- Ident
1213
- collate?
1214
- numeric?
1215
- ( asc | desc )?
1454
+ Idiom
1455
+ collate?
1456
+ numeric?
1457
+ ( asc | desc )?
1216
1458
  }
1217
1459
 
1218
1460
  Predicate {
@@ -1221,7 +1463,7 @@ Predicate {
1221
1463
  }
1222
1464
 
1223
1465
  inclusivePredicate {
1224
- AnyStar | Predicate
1466
+ AnyStar | Predicate
1225
1467
  }
1226
1468
 
1227
1469
  // Types
@@ -1236,18 +1478,18 @@ LiteralType[since=2_0_0] {
1236
1478
  }
1237
1479
 
1238
1480
  singleType {
1239
- TypeName { rawident } |
1240
- ParameterizedType { singleType "<" type ">" } |
1241
- LiteralType
1481
+ TypeName { rawident } |
1482
+ ParameterizedType { singleType "<" type ">" } |
1483
+ LiteralType
1242
1484
  }
1243
1485
 
1244
1486
  type {
1245
- singleType |
1246
- UnionType { type (!union "|" type)+ }
1487
+ singleType |
1488
+ UnionType { type (!union "|" type)+ }
1247
1489
  }
1248
1490
 
1249
1491
  safeType {
1250
- singleType | "<" type ">"
1492
+ singleType | "<" type ">"
1251
1493
  }
1252
1494
 
1253
1495
  ObjectTypeContent {
@@ -1267,10 +1509,10 @@ Ident {
1267
1509
  tickIdent
1268
1510
  }
1269
1511
 
1270
- number { "-"? (Int | Float | Decimal) }
1512
+ number { ("-" | "+")? (Int | Float | Decimal) }
1271
1513
 
1272
1514
  Operator {
1273
- binaryOperator |
1515
+ binaryOperator |
1274
1516
  "-" | "=" | ">" | "<" |
1275
1517
  binaryOperatorKeyword |
1276
1518
  is | ( is opNot ) |
@@ -1309,10 +1551,14 @@ Operator {
1309
1551
  "[" "]"
1310
1552
  "<" ">"
1311
1553
  ":"[@name=Colon]
1312
- "->"[@name=ArrowRight]
1313
- "<-"[@name=ArrowLeft]
1314
- "<->"[@name=ArrowBoth]
1554
+ "->"[@name=LookupRight]
1555
+ "<-"[@name=LookupLeft]
1556
+ "<~"[@name=LookupLeft]
1557
+ "<->"[@name=LookupBoth]
1315
1558
  "|"[@name=Pipe]
1559
+ "~"[until=2_4_0]
1560
+ "!~"[until=2_4_0]
1561
+ "*~"[until=2_4_0]
1316
1562
 
1317
1563
  // Helpers
1318
1564
  whitespace { $[ \n\r\t] }
@@ -1328,12 +1574,12 @@ Operator {
1328
1574
  Int { @digit+ }
1329
1575
  frac { '.' @digit+ }
1330
1576
  exp { $[eE] $[+\-]? @digit+ }
1331
- Float { @digit+ (frac exp? | exp) "f"? }
1577
+ Float { (@digit+ (frac exp? | exp) "f"?) | "Infinity" | "NaN" }
1332
1578
  Decimal { @digit+ frac? exp? "dec" }
1333
1579
  VersionNumber { @digit+ ("." @digit+ ("." @digit+)?)? }
1334
1580
 
1335
1581
  String { "'" (!['\\] | "\\" _)* "'" | '"' (!["\\] | "\\" _)* '"' }
1336
- prefixedString[@name=String] { $[ruds] String }
1582
+ prefixedString[@name=String] { $[rudbf] String }
1337
1583
 
1338
1584
  formatStringContentDouble { ("\\" _ | !["{\\])+ }
1339
1585
  formatStringContentSingle { ("\\" _ | !['{\\])+ }
@@ -1349,7 +1595,7 @@ Operator {
1349
1595
  rawident { (@asciiLetter | "_") (@asciiLetter | @digit | "_")* }
1350
1596
  numberident {
1351
1597
  rawident |
1352
- ( @digit+ (@asciiLetter | "_") (@asciiLetter | @digit | "_")* )
1598
+ @digit (@asciiLetter | @digit | "_")*
1353
1599
  }
1354
1600
 
1355
1601
  functionNameSegment { (@asciiLetter | "_") (@asciiLetter | "_" | @digit)* }
@@ -1367,16 +1613,13 @@ Operator {
1367
1613
 
1368
1614
  @precedence { CommentResult Comment Int "-" }
1369
1615
  @precedence { Comment binaryOperator }
1616
+ @precedence { Float Decimal Int rawident }
1617
+ @precedence { DurationPart Int rawident }
1370
1618
  @precedence { prefixedString numberident rawident }
1371
1619
  @precedence { customFunctionName FunctionName rawident }
1372
- @precedence { Float Decimal Int rawident }
1373
- @precedence { DurationPart rawident }
1374
- @precedence { DurationPart Int }
1375
- @precedence { numberident Int rawident }
1376
1620
  @precedence { "f'" 'f"' rawident }
1377
1621
  @precedence { "/*" Regex }
1378
- @precedence { Decimal numberident }
1379
- @precedence { Float numberident }
1622
+ @precedence { Float FunctionName }
1380
1623
 
1381
1624
  javaScriptContent { "\n" | ![{}\n'"]+ "\n"? | String }
1382
1625
  javaScriptBraceOpen { "{" }
@@ -1386,7 +1629,7 @@ Operator {
1386
1629
  "&&" | "||" | "??" | "?:" | "!=" | "==" | "?=" | "*=" | "~" | "!~" | "*~" |
1387
1630
  "<=" | ">=" | "+" | "+=" | "-=" | "*" | "×" | "/" | "÷" | "**" |
1388
1631
  $[∋∌⊇⊃⊅∈∉⊆⊂⊄] | "@@"
1389
- }
1632
+ }
1390
1633
 
1391
1634
  assignmentOperator[@name=Operator] {
1392
1635
  "=" |
@@ -1430,9 +1673,11 @@ piped<content> {
1430
1673
  at [@name=Keyword],
1431
1674
  authenticate [@name=Keyword],
1432
1675
  auto [@name=Keyword],
1676
+ backend [@name=Keyword],
1433
1677
  begin [@name=Keyword],
1434
1678
  bm25 [@name=Keyword],
1435
1679
  break [@name=Keyword],
1680
+ bucket [@name=Keyword],
1436
1681
  by [@name=Keyword],
1437
1682
  cancel [@name=Keyword],
1438
1683
  capacity [@name=Keyword],
@@ -1443,6 +1688,7 @@ piped<content> {
1443
1688
  columns [@name=Keyword],
1444
1689
  comment [@name=Keyword],
1445
1690
  commit [@name=Keyword],
1691
+ computed [@name=Keyword],
1446
1692
  concurrently [@name=Keyword],
1447
1693
  config [@name=Keyword],
1448
1694
  content [@name=Keyword],
@@ -1617,174 +1863,4 @@ piped<content> {
1617
1863
  function,
1618
1864
  rand [@name=FunctionName],
1619
1865
  count [@name=FunctionName]
1620
- }
1621
-
1622
- anyKeyword {
1623
- access |
1624
- algorithm |
1625
- alter |
1626
- analyzer |
1627
- any |
1628
- as |
1629
- asc |
1630
- assert |
1631
- at |
1632
- authenticate |
1633
- auto |
1634
- begin |
1635
- bm25 |
1636
- break |
1637
- by |
1638
- cancel |
1639
- capacity |
1640
- changefeed |
1641
- changes |
1642
- columns |
1643
- comment |
1644
- commit |
1645
- concurrently |
1646
- config |
1647
- content |
1648
- continue |
1649
- create |
1650
- database |
1651
- db |
1652
- default |
1653
- define |
1654
- delete |
1655
- desc |
1656
- dimension |
1657
- dist |
1658
- doc_ids_cache |
1659
- doc_ids_order |
1660
- doc_lengths_cache |
1661
- doc_lengths_order |
1662
- drop |
1663
- duplicate |
1664
- duration |
1665
- efc |
1666
- else |
1667
- end |
1668
- event |
1669
- exclude |
1670
- exists |
1671
- explain |
1672
- extend_candidates |
1673
- fetch |
1674
- field |
1675
- fields |
1676
- filters |
1677
- flexible |
1678
- for |
1679
- from |
1680
- functions |
1681
- graphql |
1682
- group |
1683
- highlights |
1684
- hnsw |
1685
- if |
1686
- ignore |
1687
- in |
1688
- include |
1689
- index |
1690
- info |
1691
- insert |
1692
- into |
1693
- issuer |
1694
- jwt |
1695
- keep_pruned_connections |
1696
- key |
1697
- kill |
1698
- let |
1699
- limit |
1700
- live |
1701
- lm |
1702
- m |
1703
- m0 |
1704
- merge |
1705
- mtree |
1706
- mtree_cache |
1707
- namespace |
1708
- noindex |
1709
- normal |
1710
- not |
1711
- ns |
1712
- on |
1713
- only |
1714
- option |
1715
- order |
1716
- out |
1717
- overwrite |
1718
- parallel |
1719
- param |
1720
- passhash |
1721
- password |
1722
- patch |
1723
- permissions |
1724
- postings_cache |
1725
- postings_order |
1726
- readonly |
1727
- rebuild |
1728
- record |
1729
- relate |
1730
- relation |
1731
- remove |
1732
- return |
1733
- roles |
1734
- root |
1735
- sc |
1736
- schemafull |
1737
- schemaless |
1738
- scope |
1739
- search |
1740
- select |
1741
- session |
1742
- set |
1743
- show |
1744
- signin |
1745
- signup |
1746
- since |
1747
- sleep |
1748
- split |
1749
- start |
1750
- structure |
1751
- table |
1752
- tables |
1753
- tb |
1754
- tempfiles |
1755
- terms_cache |
1756
- terms_order |
1757
- then |
1758
- throw |
1759
- timeout |
1760
- to |
1761
- token |
1762
- tokenizers |
1763
- transaction |
1764
- typeKeyword |
1765
- unique |
1766
- unset |
1767
- update |
1768
- upsert |
1769
- url |
1770
- use |
1771
- user |
1772
- valueKeyword |
1773
- values |
1774
- when |
1775
- where |
1776
- with
1777
- }
1778
-
1779
- anyLiteral {
1780
- after |
1781
- before |
1782
- diff |
1783
- false |
1784
- full |
1785
- none |
1786
- null |
1787
- true |
1788
-
1789
- IndexTypeClause
1790
- }
1866
+ }