xrb 0.11.2 → 0.12.0

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.
@@ -192,6 +192,7 @@
192
192
  require_relative '../error'
193
193
 
194
194
  module XRB
195
+ # @namespace
195
196
  module Fallback
196
197
  %% write data;
197
198
 
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # line 1 "lib/xrb/fallback/query.rl"
3
4
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
5
+ # Copyright, 2016-2024, by Samuel Williams.
6
+
5
7
 
6
8
  # line 57 "lib/xrb/fallback/query.rl"
7
9
 
@@ -11,7 +13,7 @@ require_relative "../error"
11
13
  module XRB
12
14
  module Fallback
13
15
 
14
- # line 16 "lib/xrb/fallback/query.rb"
16
+ # line 16 "lib/xrb/fallback/query.rb"
15
17
  class << self
16
18
  attr_accessor :_query_trans_keys
17
19
  private :_query_trans_keys, :_query_trans_keys=
@@ -25,7 +27,7 @@ module XRB
25
27
  93, 37, 93, 37, 93,
26
28
  38, 91, 38, 61, 0
27
29
  ]
28
-
30
+
29
31
  class << self
30
32
  attr_accessor :_query_key_spans
31
33
  private :_query_key_spans, :_query_key_spans=
@@ -35,7 +37,7 @@ module XRB
35
37
  57, 55, 55, 57, 57, 57, 57, 57,
36
38
  54, 24
37
39
  ]
38
-
40
+
39
41
  class << self
40
42
  attr_accessor :_query_index_offsets
41
43
  private :_query_index_offsets, :_query_index_offsets=
@@ -45,7 +47,7 @@ module XRB
45
47
  398, 456, 512, 568, 626, 684, 742, 800,
46
48
  858, 913
47
49
  ]
48
-
50
+
49
51
  class << self
50
52
  attr_accessor :_query_indicies
51
53
  private :_query_indicies, :_query_indicies=
@@ -170,7 +172,7 @@ module XRB
170
172
  1, 1, 1, 1, 1, 1, 1, 1,
171
173
  38, 1, 0
172
174
  ]
173
-
175
+
174
176
  class << self
175
177
  attr_accessor :_query_trans_targs
176
178
  private :_query_trans_targs, :_query_trans_targs=
@@ -182,7 +184,7 @@ module XRB
182
184
  3, 14, 7, 15, 5, 3, 15, 5,
183
185
  3, 15, 3, 14, 7, 3, 14
184
186
  ]
185
-
187
+
186
188
  class << self
187
189
  attr_accessor :_query_trans_actions
188
190
  private :_query_trans_actions, :_query_trans_actions=
@@ -194,7 +196,7 @@ module XRB
194
196
  8, 6, 6, 10, 11, 9, 11, 4,
195
197
  12, 4, 13, 0, 0, 14, 15
196
198
  ]
197
-
199
+
198
200
  class << self
199
201
  attr_accessor :_query_eof_actions
200
202
  private :_query_eof_actions, :_query_eof_actions=
@@ -204,7 +206,7 @@ module XRB
204
206
  0, 0, 0, 0, 0, 8, 9, 12,
205
207
  13, 14
206
208
  ]
207
-
209
+
208
210
  class << self
209
211
  attr_accessor :query_start
210
212
  end
@@ -217,330 +219,330 @@ module XRB
217
219
  attr_accessor :query_error
218
220
  end
219
221
  self.query_error = 0;
220
-
222
+
221
223
  class << self
222
224
  attr_accessor :query_en_main
223
225
  end
224
226
  self.query_en_main = 12;
225
-
226
-
227
- # line 64 "lib/xrb/fallback/query.rl"
227
+
228
+
229
+ # line 64 "lib/xrb/fallback/query.rl"
228
230
 
229
231
  def self.parse_query(buffer, delegate)
230
232
  data = buffer.read
231
233
  bytes = data.bytes
232
-
234
+
233
235
  p = 0
234
236
  pe = eof = data.bytesize
235
237
  stack = []
236
-
238
+
237
239
  string_begin = string_end = nil
238
240
  integer_begin = integer_end = nil
239
241
  value_begin = value_end = nil
240
242
  encoded = false
241
-
242
-
243
- # line 245 "lib/xrb/fallback/query.rb"
243
+
244
+
245
+ # line 245 "lib/xrb/fallback/query.rb"
246
+ begin
247
+ p ||= 0
248
+ pe ||= data.length
249
+ cs = query_start
250
+ end
251
+
252
+ # line 79 "lib/xrb/fallback/query.rl"
253
+
254
+ # line 254 "lib/xrb/fallback/query.rb"
255
+ begin
256
+ testEof = false
257
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
258
+ _goto_level = 0
259
+ _resume = 10
260
+ _eof_trans = 15
261
+ _again = 20
262
+ _test_eof = 30
263
+ _out = 40
264
+ while true
265
+ if _goto_level <= 0
266
+ if p == pe
267
+ _goto_level = _test_eof
268
+ next
269
+ end
270
+ if cs == 0
271
+ _goto_level = _out
272
+ next
273
+ end
274
+ end
275
+ if _goto_level <= _resume
276
+ _keys = cs << 1
277
+ _inds = _query_index_offsets[cs]
278
+ _slen = _query_key_spans[cs]
279
+ _wide = ( bytes[p])
280
+ _trans = if ( _slen > 0 &&
281
+ _query_trans_keys[_keys] <= _wide &&
282
+ _wide <= _query_trans_keys[_keys + 1]
283
+ ) then
284
+ _query_indicies[ _inds + _wide - _query_trans_keys[_keys] ]
285
+ else
286
+ _query_indicies[ _inds + _slen ]
287
+ end
288
+ cs = _query_trans_targs[_trans]
289
+ if _query_trans_actions[_trans] != 0
290
+ case _query_trans_actions[_trans]
291
+ when 1 then
292
+ # line 7 "lib/xrb/fallback/query.rl"
244
293
  begin
245
- p ||= 0
246
- pe ||= data.length
247
- cs = query_start
294
+
295
+ string_begin = p
248
296
  end
249
-
250
- # line 79 "lib/xrb/fallback/query.rl"
251
-
252
- # line 254 "lib/xrb/fallback/query.rb"
297
+ when 6 then
298
+ # line 11 "lib/xrb/fallback/query.rl"
253
299
  begin
254
- testEof = false
255
- _slen, _trans, _keys, _inds, _acts, _nacts = nil
256
- _goto_level = 0
257
- _resume = 10
258
- _eof_trans = 15
259
- _again = 20
260
- _test_eof = 30
261
- _out = 40
262
- while true
263
- if _goto_level <= 0
264
- if p == pe
265
- _goto_level = _test_eof
266
- next
267
- end
268
- if cs == 0
269
- _goto_level = _out
270
- next
271
- end
272
- end
273
- if _goto_level <= _resume
274
- _keys = cs << 1
275
- _inds = _query_index_offsets[cs]
276
- _slen = _query_key_spans[cs]
277
- _wide = ( bytes[p])
278
- _trans = if ( _slen > 0 &&
279
- _query_trans_keys[_keys] <= _wide &&
280
- _wide <= _query_trans_keys[_keys + 1]
281
- ) then
282
- _query_indicies[ _inds + _wide - _query_trans_keys[_keys] ]
283
- else
284
- _query_indicies[ _inds + _slen ]
285
- end
286
- cs = _query_trans_targs[_trans]
287
- if _query_trans_actions[_trans] != 0
288
- case _query_trans_actions[_trans]
289
- when 1 then
290
- # line 7 "lib/xrb/fallback/query.rl"
291
- begin
292
-
293
- string_begin = p
294
- end
295
- when 6 then
296
- # line 11 "lib/xrb/fallback/query.rl"
297
- begin
298
-
299
- string_end = p
300
-
301
- delegate.string(data.byteslice(string_begin...string_end), encoded)
302
-
303
- encoded = false
304
- end
305
- when 7 then
306
- # line 23 "lib/xrb/fallback/query.rl"
307
- begin
308
-
309
- integer_end = p
310
-
311
- delegate.integer(data.byteslice(integer_begin...integer_end))
312
- end
313
- when 15 then
314
- # line 29 "lib/xrb/fallback/query.rl"
315
- begin
316
-
317
- delegate.append
318
- end
319
- when 10 then
320
- # line 33 "lib/xrb/fallback/query.rl"
321
- begin
322
-
323
- value_begin = p
324
- end
325
- when 13 then
326
- # line 45 "lib/xrb/fallback/query.rl"
327
- begin
328
-
329
- delegate.pair
330
- end
331
- when 4 then
332
- # line 49 "lib/xrb/fallback/query.rl"
333
- begin
334
-
335
- encoded = 1;
336
- end
337
- when 3 then
338
- # line 7 "lib/xrb/fallback/query.rl"
339
- begin
340
-
341
- string_begin = p
342
- end
343
- # line 19 "lib/xrb/fallback/query.rl"
344
- begin
345
-
346
- integer_begin = p
347
- end
348
- when 2 then
349
- # line 7 "lib/xrb/fallback/query.rl"
350
- begin
351
-
352
- string_begin = p
353
- end
354
- # line 49 "lib/xrb/fallback/query.rl"
355
- begin
356
-
357
- encoded = 1;
358
- end
359
- when 8 then
360
- # line 11 "lib/xrb/fallback/query.rl"
361
- begin
362
-
363
- string_end = p
364
-
365
- delegate.string(data.byteslice(string_begin...string_end), encoded)
366
-
367
- encoded = false
368
- end
369
- # line 45 "lib/xrb/fallback/query.rl"
370
- begin
371
-
372
- delegate.pair
373
- end
374
- when 5 then
375
- # line 19 "lib/xrb/fallback/query.rl"
376
- begin
377
-
378
- integer_begin = p
379
- end
380
- # line 7 "lib/xrb/fallback/query.rl"
381
- begin
382
-
383
- string_begin = p
384
- end
385
- when 14 then
386
- # line 29 "lib/xrb/fallback/query.rl"
387
- begin
388
-
389
- delegate.append
390
- end
391
- # line 45 "lib/xrb/fallback/query.rl"
392
- begin
393
-
394
- delegate.pair
395
- end
396
- when 11 then
397
- # line 33 "lib/xrb/fallback/query.rl"
398
- begin
399
-
400
- value_begin = p
401
- end
402
- # line 49 "lib/xrb/fallback/query.rl"
403
- begin
404
-
405
- encoded = 1;
406
- end
407
- when 12 then
408
- # line 37 "lib/xrb/fallback/query.rl"
409
- begin
410
-
411
- value_end = p
412
-
413
- delegate.assign(data.byteslice(value_begin...value_end), encoded)
414
-
415
- encoded = false
416
- end
417
- # line 45 "lib/xrb/fallback/query.rl"
418
- begin
419
-
420
- delegate.pair
421
- end
422
- when 9 then
423
- # line 33 "lib/xrb/fallback/query.rl"
424
- begin
425
-
426
- value_begin = p
427
- end
428
- # line 37 "lib/xrb/fallback/query.rl"
429
- begin
430
-
431
- value_end = p
432
-
433
- delegate.assign(data.byteslice(value_begin...value_end), encoded)
434
-
435
- encoded = false
436
- end
437
- # line 45 "lib/xrb/fallback/query.rl"
438
- begin
439
-
440
- delegate.pair
441
- end
442
- # line 444 "lib/xrb/fallback/query.rb"
443
- end
444
- end
445
- end
446
- if _goto_level <= _again
447
- if cs == 0
448
- _goto_level = _out
449
- next
450
- end
451
- p += 1
452
- if p != pe
453
- _goto_level = _resume
454
- next
455
- end
456
- end
457
- if _goto_level <= _test_eof
458
- if p == eof
459
- case _query_eof_actions[cs]
460
- when 13 then
461
- # line 45 "lib/xrb/fallback/query.rl"
462
- begin
463
-
464
- delegate.pair
465
- end
466
- when 8 then
467
- # line 11 "lib/xrb/fallback/query.rl"
468
- begin
469
-
470
- string_end = p
471
-
472
- delegate.string(data.byteslice(string_begin...string_end), encoded)
473
-
474
- encoded = false
475
- end
476
- # line 45 "lib/xrb/fallback/query.rl"
477
- begin
478
-
479
- delegate.pair
480
- end
481
- when 14 then
482
- # line 29 "lib/xrb/fallback/query.rl"
483
- begin
484
-
485
- delegate.append
486
- end
487
- # line 45 "lib/xrb/fallback/query.rl"
488
- begin
489
-
490
- delegate.pair
491
- end
492
- when 12 then
493
- # line 37 "lib/xrb/fallback/query.rl"
494
- begin
495
-
496
- value_end = p
497
-
498
- delegate.assign(data.byteslice(value_begin...value_end), encoded)
499
-
500
- encoded = false
501
- end
502
- # line 45 "lib/xrb/fallback/query.rl"
503
- begin
504
-
505
- delegate.pair
506
- end
507
- when 9 then
508
- # line 33 "lib/xrb/fallback/query.rl"
509
- begin
510
-
511
- value_begin = p
512
- end
513
- # line 37 "lib/xrb/fallback/query.rl"
514
- begin
515
-
516
- value_end = p
517
-
518
- delegate.assign(data.byteslice(value_begin...value_end), encoded)
519
-
520
- encoded = false
521
- end
522
- # line 45 "lib/xrb/fallback/query.rl"
523
- begin
524
-
525
- delegate.pair
526
- end
527
- # line 529 "lib/xrb/fallback/query.rb"
528
- end
529
- end
530
-
531
- end
532
- if _goto_level <= _out
533
- break
534
- end
535
- end
300
+
301
+ string_end = p
302
+
303
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
304
+
305
+ encoded = false
536
306
  end
537
-
538
- # line 80 "lib/xrb/fallback/query.rl"
539
-
307
+ when 7 then
308
+ # line 23 "lib/xrb/fallback/query.rl"
309
+ begin
310
+
311
+ integer_end = p
312
+
313
+ delegate.integer(data.byteslice(integer_begin...integer_end))
314
+ end
315
+ when 15 then
316
+ # line 29 "lib/xrb/fallback/query.rl"
317
+ begin
318
+
319
+ delegate.append
320
+ end
321
+ when 10 then
322
+ # line 33 "lib/xrb/fallback/query.rl"
323
+ begin
324
+
325
+ value_begin = p
326
+ end
327
+ when 13 then
328
+ # line 45 "lib/xrb/fallback/query.rl"
329
+ begin
330
+
331
+ delegate.pair
332
+ end
333
+ when 4 then
334
+ # line 49 "lib/xrb/fallback/query.rl"
335
+ begin
336
+
337
+ encoded = 1;
338
+ end
339
+ when 3 then
340
+ # line 7 "lib/xrb/fallback/query.rl"
341
+ begin
342
+
343
+ string_begin = p
344
+ end
345
+ # line 19 "lib/xrb/fallback/query.rl"
346
+ begin
347
+
348
+ integer_begin = p
349
+ end
350
+ when 2 then
351
+ # line 7 "lib/xrb/fallback/query.rl"
352
+ begin
353
+
354
+ string_begin = p
355
+ end
356
+ # line 49 "lib/xrb/fallback/query.rl"
357
+ begin
358
+
359
+ encoded = 1;
360
+ end
361
+ when 8 then
362
+ # line 11 "lib/xrb/fallback/query.rl"
363
+ begin
364
+
365
+ string_end = p
366
+
367
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
368
+
369
+ encoded = false
370
+ end
371
+ # line 45 "lib/xrb/fallback/query.rl"
372
+ begin
373
+
374
+ delegate.pair
375
+ end
376
+ when 5 then
377
+ # line 19 "lib/xrb/fallback/query.rl"
378
+ begin
379
+
380
+ integer_begin = p
381
+ end
382
+ # line 7 "lib/xrb/fallback/query.rl"
383
+ begin
384
+
385
+ string_begin = p
386
+ end
387
+ when 14 then
388
+ # line 29 "lib/xrb/fallback/query.rl"
389
+ begin
390
+
391
+ delegate.append
392
+ end
393
+ # line 45 "lib/xrb/fallback/query.rl"
394
+ begin
395
+
396
+ delegate.pair
397
+ end
398
+ when 11 then
399
+ # line 33 "lib/xrb/fallback/query.rl"
400
+ begin
401
+
402
+ value_begin = p
403
+ end
404
+ # line 49 "lib/xrb/fallback/query.rl"
405
+ begin
406
+
407
+ encoded = 1;
408
+ end
409
+ when 12 then
410
+ # line 37 "lib/xrb/fallback/query.rl"
411
+ begin
412
+
413
+ value_end = p
414
+
415
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
416
+
417
+ encoded = false
418
+ end
419
+ # line 45 "lib/xrb/fallback/query.rl"
420
+ begin
421
+
422
+ delegate.pair
423
+ end
424
+ when 9 then
425
+ # line 33 "lib/xrb/fallback/query.rl"
426
+ begin
427
+
428
+ value_begin = p
429
+ end
430
+ # line 37 "lib/xrb/fallback/query.rl"
431
+ begin
432
+
433
+ value_end = p
434
+
435
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
436
+
437
+ encoded = false
438
+ end
439
+ # line 45 "lib/xrb/fallback/query.rl"
440
+ begin
441
+
442
+ delegate.pair
443
+ end
444
+ # line 444 "lib/xrb/fallback/query.rb"
445
+ end
446
+ end
447
+ end
448
+ if _goto_level <= _again
449
+ if cs == 0
450
+ _goto_level = _out
451
+ next
452
+ end
453
+ p += 1
454
+ if p != pe
455
+ _goto_level = _resume
456
+ next
457
+ end
458
+ end
459
+ if _goto_level <= _test_eof
460
+ if p == eof
461
+ case _query_eof_actions[cs]
462
+ when 13 then
463
+ # line 45 "lib/xrb/fallback/query.rl"
464
+ begin
465
+
466
+ delegate.pair
467
+ end
468
+ when 8 then
469
+ # line 11 "lib/xrb/fallback/query.rl"
470
+ begin
471
+
472
+ string_end = p
473
+
474
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
475
+
476
+ encoded = false
477
+ end
478
+ # line 45 "lib/xrb/fallback/query.rl"
479
+ begin
480
+
481
+ delegate.pair
482
+ end
483
+ when 14 then
484
+ # line 29 "lib/xrb/fallback/query.rl"
485
+ begin
486
+
487
+ delegate.append
488
+ end
489
+ # line 45 "lib/xrb/fallback/query.rl"
490
+ begin
491
+
492
+ delegate.pair
493
+ end
494
+ when 12 then
495
+ # line 37 "lib/xrb/fallback/query.rl"
496
+ begin
497
+
498
+ value_end = p
499
+
500
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
501
+
502
+ encoded = false
503
+ end
504
+ # line 45 "lib/xrb/fallback/query.rl"
505
+ begin
506
+
507
+ delegate.pair
508
+ end
509
+ when 9 then
510
+ # line 33 "lib/xrb/fallback/query.rl"
511
+ begin
512
+
513
+ value_begin = p
514
+ end
515
+ # line 37 "lib/xrb/fallback/query.rl"
516
+ begin
517
+
518
+ value_end = p
519
+
520
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
521
+
522
+ encoded = false
523
+ end
524
+ # line 45 "lib/xrb/fallback/query.rl"
525
+ begin
526
+
527
+ delegate.pair
528
+ end
529
+ # line 529 "lib/xrb/fallback/query.rb"
530
+ end
531
+ end
532
+
533
+ end
534
+ if _goto_level <= _out
535
+ break
536
+ end
537
+ end
538
+ end
539
+
540
+ # line 80 "lib/xrb/fallback/query.rl"
541
+
540
542
  if p != eof
541
543
  raise ParseError.new("could not consume all input", buffer, p)
542
544
  end
543
-
545
+
544
546
  return nil
545
547
  end
546
548
  end