ibex-runtime 0.2.0 → 0.4.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -272
  3. data/lib/ibex/runtime/cst/green/node.rb +1 -1
  4. data/lib/ibex/runtime/cst/green/token.rb +1 -1
  5. data/lib/ibex/runtime/cst/green/trivia.rb +1 -1
  6. data/lib/ibex/runtime/cst/incremental/blender.rb +1 -1
  7. data/lib/ibex/runtime/cst/incremental/lexed_syntax.rb +2 -2
  8. data/lib/ibex/runtime/cst/incremental/parse_memo.rb +2 -2
  9. data/lib/ibex/runtime/cst/incremental/relexer.rb +3 -0
  10. data/lib/ibex/runtime/cst/incremental/session.rb +26 -2
  11. data/lib/ibex/runtime/cst/parse_result.rb +7 -7
  12. data/lib/ibex/runtime/cst/serialize.rb +6 -3
  13. data/lib/ibex/runtime/cst/syntax_node.rb +4 -4
  14. data/lib/ibex/runtime/cst/syntax_token.rb +5 -5
  15. data/lib/ibex/runtime/cst/typed_node.rb +1 -1
  16. data/lib/ibex/runtime/cst/validator.rb +40 -30
  17. data/lib/ibex/runtime/embedded_source.rb +98 -0
  18. data/lib/ibex/runtime/event.rb +7 -4
  19. data/lib/ibex/runtime/event_jsonl_tracer.rb +1 -1
  20. data/lib/ibex/runtime/event_sanitizer.rb +32 -26
  21. data/lib/ibex/runtime/generated_lexer.rb +23 -16
  22. data/lib/ibex/runtime/lexer_input.rb +1 -1
  23. data/lib/ibex/runtime/location_span.rb +15 -15
  24. data/lib/ibex/runtime/observation.rb +1 -1
  25. data/lib/ibex/runtime/parser.rb +309 -191
  26. data/lib/ibex/runtime/parser_sync_recovery.rb +19 -15
  27. data/lib/ibex/runtime/repair.rb +36 -5
  28. data/lib/ibex/runtime/repair_priority_queue.rb +10 -6
  29. data/lib/ibex/runtime/repair_search.rb +92 -29
  30. data/lib/ibex/runtime/syntax_repair.rb +490 -0
  31. data/lib/ibex/runtime/syntax_session.rb +416 -0
  32. data/lib/ibex/runtime/table_format.rb +1 -1
  33. data/lib/ibex/runtime/version.rb +1 -1
  34. data/lib/ibex/runtime.rb +2 -1
  35. data/lib/ibex/tables/compact.rb +16 -12
  36. data/lib/ibex/tables/compact_actions.rb +45 -33
  37. data/lib/ibex/tables/compact_productions.rb +18 -15
  38. data/sig/ibex/runtime/cst/green/node.rbs +2 -2
  39. data/sig/ibex/runtime/cst/green/token.rbs +2 -2
  40. data/sig/ibex/runtime/cst/green/trivia.rbs +2 -2
  41. data/sig/ibex/runtime/cst/incremental/blender.rbs +2 -2
  42. data/sig/ibex/runtime/cst/incremental/lexed_syntax.rbs +3 -3
  43. data/sig/ibex/runtime/cst/incremental/parse_memo.rbs +4 -4
  44. data/sig/ibex/runtime/cst/incremental/session.rbs +8 -2
  45. data/sig/ibex/runtime/cst/parse_result.rbs +9 -9
  46. data/sig/ibex/runtime/cst/serialize.rbs +8 -6
  47. data/sig/ibex/runtime/cst/syntax_node.rbs +6 -6
  48. data/sig/ibex/runtime/cst/syntax_token.rbs +10 -10
  49. data/sig/ibex/runtime/cst/typed_node.rbs +2 -2
  50. data/sig/ibex/runtime/cst/validator.rbs +46 -42
  51. data/sig/ibex/runtime/embedded_source.rbs +21 -0
  52. data/sig/ibex/runtime/event.rbs +7 -5
  53. data/sig/ibex/runtime/event_jsonl_tracer.rbs +1 -1
  54. data/sig/ibex/runtime/event_sanitizer.rbs +50 -44
  55. data/sig/ibex/runtime/generated_lexer.rbs +31 -24
  56. data/sig/ibex/runtime/lexer_input.rbs +2 -2
  57. data/sig/ibex/runtime/location_span.rbs +28 -28
  58. data/sig/ibex/runtime/observation.rbs +2 -2
  59. data/sig/ibex/runtime/parser.rbs +266 -252
  60. data/sig/ibex/runtime/parser_sync_recovery.rbs +15 -15
  61. data/sig/ibex/runtime/repair.rbs +28 -8
  62. data/sig/ibex/runtime/repair_priority_queue.rbs +9 -7
  63. data/sig/ibex/runtime/repair_search.rbs +38 -19
  64. data/sig/ibex/runtime/syntax_repair.rbs +177 -0
  65. data/sig/ibex/runtime/syntax_session.rbs +186 -0
  66. data/sig/ibex/tables/compact.rbs +12 -12
  67. data/sig/ibex/tables/compact_actions.rbs +10 -17
  68. data/sig/ibex/tables/compact_productions.rbs +19 -19
  69. metadata +12 -6
  70. data/lib/ibex/runtime/jsonl_tracer.rb +0 -75
  71. data/sig/ibex/runtime/jsonl_tracer.rbs +0 -42
@@ -2,17 +2,19 @@
2
2
 
3
3
  module Ibex
4
4
  module Runtime
5
+ type runtime_value = untyped
6
+
5
7
  # Raised by the default parser error handler.
6
8
  class ParseError < StandardError
7
9
  attr_reader token_id: Integer?
8
10
 
9
11
  attr_reader token_name: String?
10
12
 
11
- attr_reader token_value: untyped
13
+ attr_reader token_value: runtime_value
12
14
 
13
15
  attr_reader expected_tokens: Array[String]
14
16
 
15
- attr_reader location: untyped
17
+ attr_reader location: runtime_value
16
18
 
17
19
  attr_reader state: Integer?
18
20
 
@@ -21,9 +23,9 @@ module Ibex
21
23
  attr_reader error_id: String?
22
24
 
23
25
  # rubocop:disable Layout/LineLength
24
- # @rbs (?String? message, ?token_id: Integer?, ?token_name: String?, ?token_value: untyped, ?expected_tokens: Array[String], ?location: untyped, ?state: Integer?, ?suggestions: Array[String], ?error_id: String?, ?detail: String?) -> void
26
+ # @rbs (?String? message, ?token_id: Integer?, ?token_name: String?, ?token_value: runtime_value, ?expected_tokens: Array[String], ?location: runtime_value, ?state: Integer?, ?suggestions: Array[String], ?error_id: String?, ?detail: String?) -> void
25
27
  # rubocop:enable Layout/LineLength
26
- def initialize: (?String? message, ?token_id: Integer?, ?token_name: String?, ?token_value: untyped, ?expected_tokens: Array[String], ?location: untyped, ?state: Integer?, ?suggestions: Array[String], ?error_id: String?, ?detail: String?) -> void
28
+ def initialize: (?String? message, ?token_id: Integer?, ?token_name: String?, ?token_value: runtime_value, ?expected_tokens: Array[String], ?location: runtime_value, ?state: Integer?, ?suggestions: Array[String], ?error_id: String?, ?detail: String?) -> void
27
29
 
28
30
  # @rbs () -> String
29
31
  def location_label: () -> String
@@ -33,8 +35,8 @@ module Ibex
33
35
  # @rbs () -> String
34
36
  def diagnostic_message: () -> String
35
37
 
36
- # @rbs (Symbol key) -> untyped
37
- def location_value: (Symbol key) -> untyped
38
+ # @rbs (Symbol key) -> runtime_value
39
+ def location_value: (Symbol key) -> runtime_value
38
40
  end
39
41
 
40
42
  # Raised when a configured parser-session resource budget is exhausted.
@@ -45,11 +47,11 @@ module Ibex
45
47
 
46
48
  attr_reader observed: Integer
47
49
 
48
- # @rbs (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location: untyped) -> void
49
- def initialize: (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location: untyped) -> void
50
+ # @rbs (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location: runtime_value) -> void
51
+ def initialize: (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location: runtime_value) -> void
50
52
 
51
- # @rbs () -> Hash[Symbol, untyped]
52
- def to_h: () -> Hash[Symbol, untyped]
53
+ # @rbs () -> Hash[Symbol, runtime_value]
54
+ def to_h: () -> Hash[Symbol, runtime_value]
53
55
  end
54
56
 
55
57
  # Drives a table-defined LR parser without native extensions.
@@ -147,11 +149,11 @@ module Ibex
147
149
 
148
150
  COMPACT_ACCEPTED: Object
149
151
 
150
- EMPTY_ROW: Hash[Integer, untyped]
152
+ EMPTY_ROW: Hash[Integer, runtime_value]
151
153
 
152
154
  EMPTY_LOCATION_NAMES: Hash[Symbol, Integer]
153
155
 
154
- EMPTY_LOCATIONS: Array[untyped]
156
+ EMPTY_LOCATIONS: Array[runtime_value]
155
157
 
156
158
  EMPTY_GREEN_TRIVIA: Array[CST::GreenTrivia]
157
159
 
@@ -169,7 +171,7 @@ module Ibex
169
171
 
170
172
  @runtime_event_sequence: Integer
171
173
 
172
- @runtime_lookahead_token_display: untyped
174
+ @runtime_lookahead_token_display: String?
173
175
 
174
176
  @runtime_observation_mutex: Mutex
175
177
 
@@ -179,7 +181,7 @@ module Ibex
179
181
 
180
182
  @repair_selected: bool
181
183
 
182
- @semantic_locations: Array[untyped]?
184
+ @semantic_locations: Array[runtime_value]?
183
185
 
184
186
  @incremental_reused_descendants: Integer
185
187
 
@@ -189,23 +191,23 @@ module Ibex
189
191
 
190
192
  @recovery_shifts: Integer
191
193
 
192
- @lookahead_location: untyped
194
+ @lookahead_location: runtime_value
193
195
 
194
- @lookahead_value: untyped
196
+ @lookahead_value: runtime_value
195
197
 
196
- @lookahead: untyped
198
+ @lookahead: runtime_value
197
199
 
198
- @location_stack: Array[untyped]?
200
+ @location_stack: Array[runtime_value]?
199
201
 
200
- @racc_vstack: Array[untyped]
202
+ @racc_vstack: Array[runtime_value]
201
203
 
202
- @vstack: Array[untyped]
204
+ @vstack: Array[runtime_value]
203
205
 
204
- @value_stack: Array[untyped]
206
+ @value_stack: Array[runtime_value]
205
207
 
206
208
  @state_stack: Array[Integer]
207
209
 
208
- @source: untyped
210
+ @source: runtime_value
209
211
 
210
212
  @yydebug_output: IO
211
213
 
@@ -235,7 +237,7 @@ module Ibex
235
237
 
236
238
  @runtime_fast_path: bool
237
239
 
238
- @runtime_parser_tables: Hash[Symbol, untyped]?
240
+ @runtime_parser_tables: Hash[Symbol, runtime_value]?
239
241
 
240
242
  @recovery_attempts: Integer
241
243
 
@@ -243,7 +245,7 @@ module Ibex
243
245
 
244
246
  @green_pending_skipped: Array[CST::GreenTrivia]
245
247
 
246
- @syntax_diagnostics: Array[untyped]
248
+ @syntax_diagnostics: Array[runtime_value]
247
249
 
248
250
  @syntax_root: CST::SyntaxNode?
249
251
 
@@ -255,13 +257,13 @@ module Ibex
255
257
 
256
258
  @sync_recovery_observers: Array[Proc]?
257
259
 
258
- @sync_recovery_token_data: Hash[String, untyped]?
260
+ @sync_recovery_token_data: Hash[String, runtime_value]?
259
261
 
260
- @sync_recovery_context: Hash[Symbol, untyped]?
262
+ @sync_recovery_context: Hash[Symbol, runtime_value]?
261
263
 
262
- @trace_value_printer: (^(untyped) -> untyped)?
264
+ @trace_value_printer: (^(runtime_value) -> runtime_value)?
263
265
 
264
- @semantic_result_location: untyped
266
+ @semantic_result_location: runtime_value
265
267
 
266
268
  @semantic_location_names: Hash[Symbol, Integer]?
267
269
 
@@ -270,6 +272,9 @@ module Ibex
270
272
  attr_reader incremental_reused_descendants: Integer
271
273
 
272
274
  # Start a syntax-only incremental session backed by a generated lexer.
275
+ # Parser production actions are suppressed, but generated lexer actions
276
+ # still execute. The generated class is trusted application code, not a
277
+ # sandbox.
273
278
  # @rbs (CST::SourceText source_text, ?resource_limits: ResourceLimits?, ?blender: bool) ->
274
279
  # CST::IncrementalParseSession
275
280
  def self.incremental_session: (CST::SourceText source_text, ?resource_limits: ResourceLimits?, ?blender: bool) -> CST::IncrementalParseSession
@@ -301,11 +306,15 @@ module Ibex
301
306
  # @rbs (ResourceLimits limits) -> ResourceLimits
302
307
  def resource_limits=: (ResourceLimits limits) -> ResourceLimits
303
308
 
304
- # Pull tokens from `next_token` and parse them.
305
- # @rbs () -> untyped
306
- def do_parse: () -> untyped
309
+ # Pull tokens from `next_token` and execute parser production actions.
310
+ # A generated-lexer `next_token` executes lexer actions; a handwritten
311
+ # implementation does not invoke the generated lexer.
312
+ # @rbs () -> runtime_value
313
+ def do_parse: () -> runtime_value
307
314
 
308
315
  # Parse through `next_token` and return both the semantic value and Red root.
316
+ # Parser production actions execute. Generated lexer actions execute only
317
+ # when `next_token` is supplied by the generated lexer.
309
318
  # @rbs () -> CST::ParseResult
310
319
  def parse_with_syntax: () -> CST::ParseResult
311
320
 
@@ -313,21 +322,25 @@ module Ibex
313
322
  # @rbs () -> CST::SyntaxNode?
314
323
  def syntax_root: () -> CST::SyntaxNode?
315
324
 
316
- # Parse tokens yielded by `receiver.method_id`.
317
- # @rbs (untyped receiver, Symbol method_id) -> untyped
318
- def yyparse: (untyped receiver, Symbol method_id) -> untyped
325
+ # Parse tokens yielded by `receiver.method_id` and execute parser
326
+ # production actions. This caller-fed path does not invoke generated
327
+ # lexer actions.
328
+ # @rbs (runtime_value receiver, Symbol method_id) -> runtime_value
329
+ def yyparse: (runtime_value receiver, Symbol method_id) -> runtime_value
319
330
 
320
331
  # Supply one token to a caller-driven parser session.
332
+ # Committed reductions execute parser production actions; this token-fed
333
+ # path does not invoke generated lexer actions.
321
334
  # Returns `:need_more` after consuming it, `[:accepted, result]` after
322
335
  # acceptance, or `[:rejected, result]` after recovery terminates.
323
- # rubocop:disable Layout/LineLength
324
- # @rbs (untyped token, ?untyped value, ?untyped location) -> (:need_more | [:accepted, untyped] | [:rejected, untyped])
325
- # rubocop:enable Layout/LineLength
326
- def push: (untyped token, ?untyped value, ?untyped location) -> (:need_more | [ :accepted, untyped ] | [ :rejected, untyped ])
336
+ # @rbs (runtime_value token, ?runtime_value value, ?runtime_value location) -> runtime_value
337
+ def push: (runtime_value token, ?runtime_value value, ?runtime_value location) -> runtime_value
327
338
 
328
339
  # Supply EOF to a caller-driven parser session and return its result.
329
- # @rbs (?location: untyped) -> untyped
330
- def finish: (?location: untyped) -> untyped
340
+ # Committed reductions execute parser production actions; this token-fed
341
+ # path does not invoke generated lexer actions.
342
+ # @rbs (?location: runtime_value) -> runtime_value
343
+ def finish: (?location: runtime_value) -> runtime_value
331
344
 
332
345
  # Discard a caller-driven session so this parser can accept a new one.
333
346
  # @rbs () -> nil
@@ -335,51 +348,51 @@ module Ibex
335
348
 
336
349
  # Override in pull parsers. Return `[token, value]`,
337
350
  # `[token, value, location]`, `false`, or `nil`.
338
- # @rbs () -> ([untyped, untyped] | [untyped, untyped, untyped] | false | nil)
339
- def next_token: () -> ([ untyped, untyped ] | [ untyped, untyped, untyped ] | false | nil)
351
+ # @rbs () -> ([runtime_value, runtime_value] | [runtime_value, runtime_value, runtime_value] | false | nil)
352
+ def next_token: () -> ([ runtime_value, runtime_value ] | [ runtime_value, runtime_value, runtime_value ] | false | nil)
340
353
 
341
354
  # Override to recover from syntax errors. The default raises unless a
342
355
  # bounded automatic repair has already been selected.
343
- # @rbs (Integer token_id, untyped value, Array[untyped] value_stack) -> untyped
344
- def on_error: (Integer token_id, untyped value, Array[untyped] value_stack) -> untyped
356
+ # @rbs (Integer token_id, runtime_value value, Array[runtime_value] value_stack) -> runtime_value
357
+ def on_error: (Integer token_id, runtime_value value, Array[runtime_value] value_stack) -> runtime_value
345
358
 
346
359
  # Called after an ordinary input token is shifted. Override to observe
347
360
  # the internal token id, semantic value, and destination state.
348
- # @rbs (Integer token_id, untyped value, Integer state) -> void
349
- def on_shift: (Integer token_id, untyped value, Integer state) -> void
361
+ # @rbs (Integer token_id, runtime_value value, Integer state) -> void
362
+ def on_shift: (Integer token_id, runtime_value value, Integer state) -> void
350
363
 
351
364
  # Location-aware shift observer. The compatible hook above retains its
352
365
  # original signature and runs first.
353
- # @rbs (Integer token_id, untyped value, Integer state, untyped location) -> void
354
- def on_shift_location: (Integer token_id, untyped value, Integer state, untyped location) -> void
366
+ # @rbs (Integer token_id, runtime_value value, Integer state, runtime_value location) -> void
367
+ def on_shift_location: (Integer token_id, runtime_value value, Integer state, runtime_value location) -> void
355
368
 
356
369
  # Called after a production's semantic action and goto are committed.
357
370
  # Override to observe its id, RHS values, and semantic result.
358
- # @rbs (Integer production_id, Array[untyped] values, untyped result) -> void
359
- def on_reduce: (Integer production_id, Array[untyped] values, untyped result) -> void
371
+ # @rbs (Integer production_id, Array[runtime_value] values, runtime_value result) -> void
372
+ def on_reduce: (Integer production_id, Array[runtime_value] values, runtime_value result) -> void
360
373
 
361
374
  # Location-aware reduction observer.
362
- # @rbs (Integer production_id, Array[untyped] values, untyped result,
363
- # Array[untyped] locations, untyped result_location) -> void
364
- def on_reduce_location: (Integer production_id, Array[untyped] values, untyped result, Array[untyped] locations, untyped result_location) -> void
375
+ # @rbs (Integer production_id, Array[runtime_value] values, runtime_value result,
376
+ # Array[runtime_value] locations, runtime_value result_location) -> void
377
+ def on_reduce_location: (Integer production_id, Array[runtime_value] values, runtime_value result, Array[runtime_value] locations, runtime_value result_location) -> void
365
378
 
366
379
  # Called after the synthetic error token enters a recovery state.
367
380
  # The payload describes the original error before recovery popped stacks.
368
- # @rbs (Integer token_id, untyped value, Array[untyped] value_stack) -> void
369
- def on_error_recover: (Integer token_id, untyped value, Array[untyped] value_stack) -> void
381
+ # @rbs (Integer token_id, runtime_value value, Array[runtime_value] value_stack) -> void
382
+ def on_error_recover: (Integer token_id, runtime_value value, Array[runtime_value] value_stack) -> void
370
383
 
371
384
  # Location-aware recovery observer.
372
- # @rbs (Integer token_id, untyped value, Array[untyped] value_stack,
373
- # untyped location, Integer state) -> void
374
- def on_error_recover_location: (Integer token_id, untyped value, Array[untyped] value_stack, untyped location, Integer state) -> void
385
+ # @rbs (Integer token_id, runtime_value value, Array[runtime_value] value_stack,
386
+ # runtime_value location, Integer state) -> void
387
+ def on_error_recover_location: (Integer token_id, runtime_value value, Array[runtime_value] value_stack, runtime_value location, Integer state) -> void
375
388
 
376
389
  # Called when yacc recovery discards an application token.
377
- # @rbs (Integer token_id, untyped value, untyped location, Symbol reason) -> void
378
- def on_discard: (Integer token_id, untyped value, untyped location, Symbol reason) -> void
390
+ # @rbs (Integer token_id, runtime_value value, runtime_value location, Symbol reason) -> void
391
+ def on_discard: (Integer token_id, runtime_value value, runtime_value location, Symbol reason) -> void
379
392
 
380
393
  # Install an opt-in value formatter for human-readable yydebug traces.
381
- # @rbs ((^(untyped) -> untyped)? printer) -> (^(untyped) -> untyped)?
382
- def trace_value_printer=: ((^(untyped) -> untyped)? printer) -> (^(untyped) -> untyped)?
394
+ # @rbs ((^(runtime_value) -> runtime_value)? printer) -> (^(runtime_value) -> runtime_value)?
395
+ def trace_value_printer=: ((^(runtime_value) -> runtime_value)? printer) -> (^(runtime_value) -> runtime_value)?
383
396
 
384
397
  # Called once after a repair is selected and before its edited token
385
398
  # prefix is replayed through normal parser actions.
@@ -413,12 +426,12 @@ module Ibex
413
426
 
414
427
  # Return the location of a one-based RHS position or named reference
415
428
  # while a semantic action is running.
416
- # @rbs (Integer | Symbol | String reference) -> untyped
417
- def loc: (Integer | Symbol | String reference) -> untyped
429
+ # @rbs (Integer | Symbol | String reference) -> runtime_value
430
+ def loc: (Integer | Symbol | String reference) -> runtime_value
418
431
 
419
432
  # Return the synthesized span of the reduction being evaluated.
420
- # @rbs () -> untyped
421
- def result_loc: () -> untyped
433
+ # @rbs () -> runtime_value
434
+ def result_loc: () -> runtime_value
422
435
 
423
436
  private
424
437
 
@@ -448,8 +461,8 @@ module Ibex
448
461
 
449
462
  # Keep the two historical value-stack names as read-compatible aliases.
450
463
  # Applications must not mutate or replace these internal arrays.
451
- # @rbs (Array[untyped] values) -> void
452
- def install_value_stack: (Array[untyped] values) -> void
464
+ # @rbs (Array[runtime_value] values) -> void
465
+ def install_value_stack: (Array[runtime_value] values) -> void
453
466
 
454
467
  # @rbs (Integer token_id) -> bool
455
468
  def exact_lookahead_accepted?: (Integer token_id) -> bool
@@ -457,14 +470,14 @@ module Ibex
457
470
  # @rbs (Integer stack_depth) -> Integer
458
471
  def exact_lookahead_step_budget: (Integer stack_depth) -> Integer
459
472
 
460
- # @rbs (Hash[Symbol, untyped] tables) -> Integer
461
- def parser_state_count: (Hash[Symbol, untyped] tables) -> Integer
473
+ # @rbs (Hash[Symbol, runtime_value] tables) -> Integer
474
+ def parser_state_count: (Hash[Symbol, runtime_value] tables) -> Integer
462
475
 
463
476
  # @rbs (Array[Integer] stack, Integer production_id) -> bool
464
477
  def exact_reduction_applied?: (Array[Integer] stack, Integer production_id) -> bool
465
478
 
466
- # @rbs (untyped source, ?initial_state: Integer?) -> untyped
467
- def drive_parser: (untyped source, ?initial_state: Integer?) -> untyped
479
+ # @rbs (runtime_value source, ?initial_state: Integer?) -> runtime_value
480
+ def drive_parser: (runtime_value source, ?initial_state: Integer?) -> runtime_value
468
481
 
469
482
  # Generated compact tables can keep the unobserved, location-free pull
470
483
  # loop on their frozen displacement arrays. Any extension boundary or
@@ -474,20 +487,20 @@ module Ibex
474
487
  # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
475
488
  # Direct comparisons avoid predicate-method dispatch inside the parser loop.
476
489
  # rubocop:disable Style/BitwisePredicate, Style/NumericPredicate
477
- # @rbs (Hash[Symbol, untyped] tables) -> (Object | [:accepted, untyped] | [:done, untyped])?
478
- def drive_compact_fast_parser: (Hash[Symbol, untyped] tables) -> (Object | [ :accepted, untyped ] | [ :done, untyped ])?
490
+ # @rbs (Hash[Symbol, runtime_value] tables) -> runtime_value
491
+ def drive_compact_fast_parser: (Hash[Symbol, runtime_value] tables) -> runtime_value
479
492
 
480
- # @rbs (Hash[Symbol, untyped]? tables) -> bool
481
- def compact_fast_driver_eligible?: (Hash[Symbol, untyped]? tables) -> bool
493
+ # @rbs (Hash[Symbol, runtime_value]? tables) -> bool
494
+ def compact_fast_driver_eligible?: (Hash[Symbol, runtime_value]? tables) -> bool
482
495
 
483
496
  # @rbs () -> void
484
497
  def start_push_session: () -> void
485
498
 
486
- # @rbs () -> (:need_more | [:accepted, untyped] | [:rejected, untyped])
487
- def run_push_lookahead: () -> (:need_more | [ :accepted, untyped ] | [ :rejected, untyped ])
499
+ # @rbs () -> runtime_value
500
+ def run_push_lookahead: () -> runtime_value
488
501
 
489
- # @rbs () { () -> untyped } -> untyped
490
- def run_push_driver: () { () -> untyped } -> untyped
502
+ # @rbs () { () -> runtime_value } -> runtime_value
503
+ def run_push_driver: () { () -> runtime_value } -> runtime_value
491
504
 
492
505
  # @rbs () -> void
493
506
  def ensure_driver_available_without_lock!: () -> void
@@ -498,30 +511,30 @@ module Ibex
498
511
  # @rbs () -> void
499
512
  def finish_push_session: () -> void
500
513
 
501
- # @rbs ((^() -> untyped)? source, ?initial_state: Integer?) -> void
502
- def prepare_parse: ((^() -> untyped)? source, ?initial_state: Integer?) -> void
514
+ # @rbs ((^() -> runtime_value)? source, ?initial_state: Integer?) -> void
515
+ def prepare_parse: ((^() -> runtime_value)? source, ?initial_state: Integer?) -> void
503
516
 
504
517
  # @rbs () -> void
505
518
  def reset_parse_recovery_state: () -> void
506
519
 
507
- # @rbs (Hash[Symbol, untyped] tables, Integer? requested) -> Integer
508
- def resolve_initial_state: (Hash[Symbol, untyped] tables, Integer? requested) -> Integer
520
+ # @rbs (Hash[Symbol, runtime_value] tables, Integer? requested) -> Integer
521
+ def resolve_initial_state: (Hash[Symbol, runtime_value] tables, Integer? requested) -> Integer
509
522
 
510
- # @rbs () -> Hash[Symbol, untyped]
511
- def validate_parser_table_format!: () -> Hash[Symbol, untyped]
523
+ # @rbs () -> Hash[Symbol, runtime_value]
524
+ def validate_parser_table_format!: () -> Hash[Symbol, runtime_value]
512
525
 
513
- # @rbs (Hash[Symbol, untyped] tables, Integer actual) -> void
514
- def validate_current_cst_tables!: (Hash[Symbol, untyped] tables, Integer actual) -> void
526
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
527
+ def validate_current_cst_tables!: (Hash[Symbol, runtime_value] tables) -> void
515
528
 
516
529
  # Generated parser tables are deeply frozen before they can cross a
517
530
  # Ractor boundary. Their action-marker contract only needs one scan per
518
531
  # parser class and exact table object, including across parser instances.
519
532
  # Mutable application tables remain intentionally uncached.
520
- # @rbs (Hash[Symbol, untyped] tables) -> bool
521
- def generated_action_contracts_validated?: (Hash[Symbol, untyped] tables) -> bool
533
+ # @rbs (Hash[Symbol, runtime_value] tables) -> bool
534
+ def generated_action_contracts_validated?: (Hash[Symbol, runtime_value] tables) -> bool
522
535
 
523
- # @rbs (Hash[Symbol, untyped] tables) -> void
524
- def cache_generated_action_contracts!: (Hash[Symbol, untyped] tables) -> void
536
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
537
+ def cache_generated_action_contracts!: (Hash[Symbol, runtime_value] tables) -> void
525
538
 
526
539
  # Ruby 3.0-3.3 expose the main Ractor as an object instead of exposing
527
540
  # Ractor.main?. Class instance variables cannot be read or written from
@@ -529,99 +542,100 @@ module Ibex
529
542
  # @rbs () -> bool
530
543
  def generated_action_contract_cache_accessible?: () -> bool
531
544
 
532
- # @rbs (Hash[Symbol, untyped] tables, Integer version) -> void
533
- def validate_generated_action_contracts!: (Hash[Symbol, untyped] tables, Integer version) -> void
545
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
546
+ def validate_generated_action_contracts!: (Hash[Symbol, runtime_value] tables) -> void
534
547
 
535
- # @rbs (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
536
- def validate_composition_action_contract!: (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
548
+ # @rbs (Hash[Symbol, runtime_value] production, Integer index) -> void
549
+ def validate_composition_action_contract!: (Hash[Symbol, runtime_value] production, Integer index) -> void
537
550
 
538
- # @rbs (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
539
- def validate_values_action_contract!: (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
551
+ # @rbs (Hash[Symbol, runtime_value] production, Integer index) -> void
552
+ def validate_values_action_contract!: (Hash[Symbol, runtime_value] production, Integer index) -> void
540
553
 
541
- # @rbs (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
542
- def validate_positional_action_contract!: (Hash[Symbol, untyped] production, Integer index, Integer version) -> void
554
+ # @rbs (Hash[Symbol, runtime_value] production, Integer index) -> void
555
+ def validate_positional_action_contract!: (Hash[Symbol, runtime_value] production, Integer index) -> void
543
556
 
544
- # @rbs (Hash[Symbol, untyped] production) -> bool
545
- def positional_action_contract?: (Hash[Symbol, untyped] production) -> bool
557
+ # @rbs (Hash[Symbol, runtime_value] production) -> bool
558
+ def positional_action_contract?: (Hash[Symbol, runtime_value] production) -> bool
546
559
 
547
- # @rbs () -> untyped
548
- def action_for_current_state: () -> untyped
560
+ # @rbs () -> runtime_value
561
+ def action_for_current_state: () -> runtime_value
549
562
 
550
- # @rbs (untyped action) -> untyped
551
- def perform: (untyped action) -> untyped
563
+ # @rbs (runtime_value action) -> runtime_value
564
+ def perform: (runtime_value action) -> runtime_value
552
565
 
553
566
  # @rbs (Integer next_state) -> [:continue]
554
567
  def fast_shift: (Integer next_state) -> [ :continue ]
555
568
 
556
- # @rbs (Hash[Symbol, untyped] production, untyped length) -> bool
557
- def fast_reduction_eligible?: (Hash[Symbol, untyped] production, untyped length) -> bool
569
+ # @rbs (Hash[Symbol, runtime_value] production, runtime_value length) -> bool
570
+ def fast_reduction_eligible?: (Hash[Symbol, runtime_value] production, runtime_value length) -> bool
558
571
 
559
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Integer length) -> [:continue]
560
- def fast_reduce: (Integer production_id, Hash[Symbol, untyped] production, Integer length) -> [ :continue ]
572
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Integer length) -> [:continue]
573
+ def fast_reduce: (Integer production_id, Hash[Symbol, runtime_value] production, Integer length) -> [ :continue ]
561
574
 
562
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Integer length, Symbol action) -> untyped
563
- def fast_values_reduce: (Integer production_id, Hash[Symbol, untyped] production, Integer length, Symbol action) -> untyped
575
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Integer length,
576
+ # Symbol action) -> runtime_value
577
+ def fast_values_reduce: (Integer production_id, Hash[Symbol, runtime_value] production, Integer length, Symbol action) -> runtime_value
564
578
 
565
- # @rbs (Integer next_state) -> untyped
566
- def shift: (Integer next_state) -> untyped
579
+ # @rbs (Integer next_state) -> runtime_value
580
+ def shift: (Integer next_state) -> runtime_value
567
581
 
568
- # @rbs (Integer production_id, ?Hash[Symbol, untyped]? prefetched_production) -> untyped
569
- def reduce: (Integer production_id, ?Hash[Symbol, untyped]? prefetched_production) -> untyped
582
+ # @rbs (Integer production_id, ?Hash[Symbol, runtime_value]? prefetched_production) -> runtime_value
583
+ def reduce: (Integer production_id, ?Hash[Symbol, runtime_value]? prefetched_production) -> runtime_value
570
584
 
571
- # @rbs (Integer next_state, untyped result, untyped location) -> void
572
- def push_reduction_result: (Integer next_state, untyped result, untyped location) -> void
585
+ # @rbs (Integer next_state, runtime_value result, runtime_value location) -> void
586
+ def push_reduction_result: (Integer next_state, runtime_value result, runtime_value location) -> void
573
587
 
574
- # @rbs (Integer production_id, Integer length, Integer lhs, untyped result, Integer next_state) -> void
575
- def trace_reduction: (Integer production_id, Integer length, Integer lhs, untyped result, Integer next_state) -> void
588
+ # @rbs (Integer production_id, Integer length, Integer lhs, runtime_value result, Integer next_state) -> void
589
+ def trace_reduction: (Integer production_id, Integer length, Integer lhs, runtime_value result, Integer next_state) -> void
576
590
 
577
- # @rbs (Array[Proc]? observers, Integer production_id, Hash[Symbol, untyped] production, Integer length,
578
- # Integer? pre_state, Integer? post_state, Integer next_state, untyped result,
579
- # LocationSpan? location) -> Hash[String, untyped]?
580
- def build_reduce_event_data: (Array[Proc]? observers, Integer production_id, Hash[Symbol, untyped] production, Integer length, Integer? pre_state, Integer? post_state, Integer next_state, untyped result, LocationSpan? location) -> Hash[String, untyped]?
591
+ # @rbs (Array[Proc]? observers, Integer production_id, Hash[Symbol, runtime_value] production, Integer length,
592
+ # Integer? pre_state, Integer? post_state, Integer next_state, runtime_value result,
593
+ # LocationSpan? location) -> Hash[String, runtime_value]?
594
+ def build_reduce_event_data: (Array[Proc]? observers, Integer production_id, Hash[Symbol, runtime_value] production, Integer length, Integer? pre_state, Integer? post_state, Integer next_state, runtime_value result, LocationSpan? location) -> Hash[String, runtime_value]?
581
595
 
582
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Integer length,
583
- # Integer? pre_state, Integer? post_state, Integer next_state, untyped result,
584
- # LocationSpan? location) -> Hash[String, untyped]
585
- def runtime_reduce_data: (Integer production_id, Hash[Symbol, untyped] production, Integer length, Integer? pre_state, Integer? post_state, Integer next_state, untyped result, LocationSpan? location) -> Hash[String, untyped]
596
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Integer length,
597
+ # Integer? pre_state, Integer? post_state, Integer next_state, runtime_value result,
598
+ # LocationSpan? location) -> Hash[String, runtime_value]
599
+ def runtime_reduce_data: (Integer production_id, Hash[Symbol, runtime_value] production, Integer length, Integer? pre_state, Integer? post_state, Integer next_state, runtime_value result, LocationSpan? location) -> Hash[String, runtime_value]
586
600
 
587
- # @rbs (untyped result) -> [:accepted, untyped]
588
- def accept_reduction: (untyped result) -> [ :accepted, untyped ]
601
+ # @rbs (runtime_value result) -> [:accepted, runtime_value]
602
+ def accept_reduction: (runtime_value result) -> [ :accepted, runtime_value ]
589
603
 
590
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Array[untyped] values,
591
- # Array[untyped] locations, LocationSpan? location) -> untyped
592
- def reduction_value: (Integer production_id, Hash[Symbol, untyped] production, Array[untyped] values, Array[untyped] locations, LocationSpan? location) -> untyped
604
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Array[runtime_value] values,
605
+ # Array[runtime_value] locations, LocationSpan? location) -> runtime_value
606
+ def reduction_value: (Integer production_id, Hash[Symbol, runtime_value] production, Array[runtime_value] values, Array[runtime_value] locations, LocationSpan? location) -> runtime_value
593
607
 
594
- # @rbs (Hash[Symbol, untyped] production, Symbol action, Array[untyped] values,
595
- # Array[untyped] locations, LocationSpan? location) -> untyped
596
- def values_reduction_value: (Hash[Symbol, untyped] production, Symbol action, Array[untyped] values, Array[untyped] locations, LocationSpan? location) -> untyped
608
+ # @rbs (Hash[Symbol, runtime_value] production, Symbol action, Array[runtime_value] values,
609
+ # Array[runtime_value] locations, LocationSpan? location) -> runtime_value
610
+ def values_reduction_value: (Hash[Symbol, runtime_value] production, Symbol action, Array[runtime_value] values, Array[runtime_value] locations, LocationSpan? location) -> runtime_value
597
611
 
598
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Array[untyped] values,
599
- # Array[untyped] locations, LocationSpan? location) -> untyped
600
- def actionless_reduction_value: (Integer production_id, Hash[Symbol, untyped] production, Array[untyped] values, Array[untyped] locations, LocationSpan? location) -> untyped
612
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Array[runtime_value] values,
613
+ # Array[runtime_value] locations, LocationSpan? location) -> runtime_value
614
+ def actionless_reduction_value: (Integer production_id, Hash[Symbol, runtime_value] production, Array[runtime_value] values, Array[runtime_value] locations, LocationSpan? location) -> runtime_value
601
615
 
602
- # @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
603
- def generated_location_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
616
+ # @rbs (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
617
+ def generated_location_action?: (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
604
618
 
605
- # @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
606
- def generated_values_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
619
+ # @rbs (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
620
+ def generated_values_action?: (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
607
621
 
608
- # @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
609
- def generated_positional_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
622
+ # @rbs (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
623
+ def generated_positional_action?: (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
610
624
 
611
- # @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
612
- def generated_composition_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
625
+ # @rbs (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
626
+ def generated_composition_action?: (Hash[Symbol, runtime_value] production, runtime_value action) -> bool
613
627
 
614
- # @rbs (untyped action) -> bool
615
- def generated_action_symbol?: (untyped action) -> bool
628
+ # @rbs (runtime_value action) -> bool
629
+ def generated_action_symbol?: (runtime_value action) -> bool
616
630
 
617
631
  # @rbs () -> bool
618
632
  def cst_enabled?: () -> bool
619
633
 
620
- # @rbs (Integer token_id, untyped value, untyped location, Symbol reason) -> void
621
- def capture_cst_error: (Integer token_id, untyped value, untyped location, Symbol reason) -> void
634
+ # @rbs (Integer token_id, runtime_value value, runtime_value location, Symbol reason) -> void
635
+ def capture_cst_error: (Integer token_id, runtime_value value, runtime_value location, Symbol reason) -> void
622
636
 
623
- # @rbs (untyped value) -> untyped
624
- def finalize_cst: (untyped value) -> untyped
637
+ # @rbs (runtime_value value) -> runtime_value
638
+ def finalize_cst: (runtime_value value) -> runtime_value
625
639
 
626
640
  # @rbs () -> nil
627
641
  def failed_cst: () -> nil
@@ -629,35 +643,35 @@ module Ibex
629
643
  # @rbs (ParseError error) -> nil
630
644
  def cst_lexical_failure: (ParseError error) -> nil
631
645
 
632
- # @rbs (untyped location, Symbol key) -> untyped
633
- def cst_location_value: (untyped location, Symbol key) -> untyped
646
+ # @rbs (runtime_value location, Symbol key) -> runtime_value
647
+ def cst_location_value: (runtime_value location, Symbol key) -> runtime_value
634
648
 
635
- # @rbs (Hash[Symbol, untyped] tables) -> void
636
- def prepare_green_cst: (Hash[Symbol, untyped] tables) -> void
649
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
650
+ def prepare_green_cst: (Hash[Symbol, runtime_value] tables) -> void
637
651
 
638
- # @rbs (Hash[Symbol, untyped] tables) -> void
639
- def reset_cst_results: (Hash[Symbol, untyped] tables) -> void
652
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
653
+ def reset_cst_results: (Hash[Symbol, runtime_value] tables) -> void
640
654
 
641
655
  # rubocop:disable Metrics/PerceivedComplexity -- generated locations have a deliberate allocation-free path.
642
- # @rbs (Integer token_id, untyped value, untyped location, Integer from_state) -> void
643
- def shift_green_token: (Integer token_id, untyped value, untyped location, Integer from_state) -> void
656
+ # @rbs (Integer token_id, runtime_value value, runtime_value location, Integer from_state) -> void
657
+ def shift_green_token: (Integer token_id, runtime_value value, runtime_value location, Integer from_state) -> void
644
658
 
645
659
  # @rbs (CST::GreenBuilder builder, CST::Kind kinds, Integer token_id, Integer from_state,
646
- # Array[CST::GreenTrivia] trailing, Array[CST::GreenTrivia] location_leading, untyped repair,
660
+ # Array[CST::GreenTrivia] trailing, Array[CST::GreenTrivia] location_leading, runtime_value repair,
647
661
  # String token_text, Symbol lexer_state) -> void
648
- def commit_green_token_shift: (CST::GreenBuilder builder, CST::Kind kinds, Integer token_id, Integer from_state, Array[CST::GreenTrivia] trailing, Array[CST::GreenTrivia] location_leading, untyped repair, String token_text, Symbol lexer_state) -> void
662
+ def commit_green_token_shift: (CST::GreenBuilder builder, CST::Kind kinds, Integer token_id, Integer from_state, Array[CST::GreenTrivia] trailing, Array[CST::GreenTrivia] location_leading, runtime_value repair, String token_text, Symbol lexer_state) -> void
649
663
 
650
- # @rbs (Integer production_id, Hash[Symbol, untyped] production, Integer length, Integer left_state) -> void
651
- def reduce_green: (Integer production_id, Hash[Symbol, untyped] production, Integer length, Integer left_state) -> void
664
+ # @rbs (Integer production_id, Hash[Symbol, runtime_value] production, Integer length, Integer left_state) -> void
665
+ def reduce_green: (Integer production_id, Hash[Symbol, runtime_value] production, Integer length, Integer left_state) -> void
652
666
 
653
- # @rbs (untyped value, untyped location) -> String
654
- def green_token_text: (untyped value, untyped location) -> String
667
+ # @rbs (runtime_value value, runtime_value location) -> String
668
+ def green_token_text: (runtime_value value, runtime_value location) -> String
655
669
 
656
- # @rbs (untyped location, Symbol key) -> Array[CST::GreenTrivia]
657
- def green_location_trivia: (untyped location, Symbol key) -> Array[CST::GreenTrivia]
670
+ # @rbs (runtime_value location, Symbol key) -> Array[CST::GreenTrivia]
671
+ def green_location_trivia: (runtime_value location, Symbol key) -> Array[CST::GreenTrivia]
658
672
 
659
- # @rbs (untyped value) -> untyped
660
- def finalize_red_green_cst: (untyped value) -> untyped
673
+ # @rbs (runtime_value value) -> runtime_value
674
+ def finalize_red_green_cst: (runtime_value value) -> runtime_value
661
675
 
662
676
  # @rbs () -> void
663
677
  def finalize_failed_green_cst: () -> void
@@ -671,8 +685,8 @@ module Ibex
671
685
  # @rbs (CST::GreenNode green, CST::Kind kinds, ?file: String?) -> void
672
686
  def install_syntax_root: (CST::GreenNode green, CST::Kind kinds, ?file: String?) -> void
673
687
 
674
- # @rbs (untyped value) -> CST::ParseResult
675
- def syntax_parse_result: (untyped value) -> CST::ParseResult
688
+ # @rbs (runtime_value value) -> CST::ParseResult
689
+ def syntax_parse_result: (runtime_value value) -> CST::ParseResult
676
690
 
677
691
  # @rbs () -> Array[Symbol]
678
692
  def syntax_token_states: () -> Array[Symbol]
@@ -680,83 +694,83 @@ module Ibex
680
694
  # @rbs (CST::GreenNode green) -> void
681
695
  def install_parse_memo: (CST::GreenNode green) -> void
682
696
 
683
- # @rbs (untyped location) -> Symbol
684
- def green_lexer_state: (untyped location) -> Symbol
697
+ # @rbs (runtime_value location) -> Symbol
698
+ def green_lexer_state: (runtime_value location) -> Symbol
685
699
 
686
- # @rbs (CST::NodeCache cache) { () -> untyped } -> untyped
687
- def with_syntax_only: (CST::NodeCache cache) { () -> untyped } -> untyped
700
+ # @rbs (CST::NodeCache cache) { () -> runtime_value } -> runtime_value
701
+ def with_syntax_only: (CST::NodeCache cache) { () -> runtime_value } -> runtime_value
688
702
 
689
- # @rbs (untyped source, CST::NodeCache cache) -> CST::SyntaxResult
690
- def parse_syntax_token_source: (untyped source, CST::NodeCache cache) -> CST::SyntaxResult
703
+ # @rbs (runtime_value source, CST::NodeCache cache) -> CST::SyntaxResult
704
+ def parse_syntax_token_source: (runtime_value source, CST::NodeCache cache) -> CST::SyntaxResult
691
705
 
692
706
  # @rbs (CST::ReusableSubtree subtree) -> void
693
707
  def push_reusable_green_subtree: (CST::ReusableSubtree subtree) -> void
694
708
 
695
- # @rbs (Symbol type, Hash[untyped, untyped] data) -> void
696
- def emit_incremental_event: (Symbol type, Hash[untyped, untyped] data) -> void
709
+ # @rbs (Symbol type, Hash[runtime_value, runtime_value] data) -> void
710
+ def emit_incremental_event: (Symbol type, Hash[runtime_value, runtime_value] data) -> void
697
711
 
698
712
  # @rbs () -> void
699
713
  def discard_green_lookahead: () -> void
700
714
 
701
- # @rbs (?report: bool) -> untyped
702
- def recover: (?report: bool) -> untyped
715
+ # @rbs (?report: bool) -> runtime_value
716
+ def recover: (?report: bool) -> runtime_value
703
717
 
704
- # @rbs () -> untyped
705
- def continue_recovery: () -> untyped
718
+ # @rbs () -> runtime_value
719
+ def continue_recovery: () -> runtime_value
706
720
 
707
721
  # @rbs () -> [:done, nil]
708
722
  def reject_recovery_eof: () -> [ :done, nil ]
709
723
 
710
- # @rbs (String token_display) -> Hash[String, untyped]
711
- def runtime_discard_data: (String token_display) -> Hash[String, untyped]
724
+ # @rbs (String token_display) -> Hash[String, runtime_value]
725
+ def runtime_discard_data: (String token_display) -> Hash[String, runtime_value]
712
726
 
713
- # @rbs (bool report) -> untyped
714
- def begin_recovery: (bool report) -> untyped
727
+ # @rbs (bool report) -> runtime_value
728
+ def begin_recovery: (bool report) -> runtime_value
715
729
 
716
- # @rbs (bool report) -> Hash[Symbol, untyped]
717
- def recovery_context: (bool report) -> Hash[Symbol, untyped]
730
+ # @rbs (bool report) -> Hash[Symbol, runtime_value]
731
+ def recovery_context: (bool report) -> Hash[Symbol, runtime_value]
718
732
 
719
- # @rbs (Hash[Symbol, untyped] context) -> [Hash[String, untyped]?, Array[Proc]?]
720
- def publish_error_context: (Hash[Symbol, untyped] context) -> [ Hash[String, untyped]?, Array[Proc]? ]
733
+ # @rbs (Hash[Symbol, runtime_value] context) -> [Hash[String, runtime_value]?, Array[Proc]?]
734
+ def publish_error_context: (Hash[Symbol, runtime_value] context) -> [ Hash[String, runtime_value]?, Array[Proc]? ]
721
735
 
722
- # @rbs (Hash[Symbol, untyped] context, untyped repair) -> void
723
- def notify_error_handler: (Hash[Symbol, untyped] context, untyped repair) -> void
736
+ # @rbs (Hash[Symbol, runtime_value] context, runtime_value repair) -> void
737
+ def notify_error_handler: (Hash[Symbol, runtime_value] context, runtime_value repair) -> void
724
738
 
725
739
  # @rbs (RepairPlan repair) -> [:continue]
726
740
  def commit_repair: (RepairPlan repair) -> [ :continue ]
727
741
 
728
- # @rbs (Hash[Symbol, untyped] context, Hash[String, untyped]? token_data,
729
- # Array[Proc]? recovery_observers) -> untyped
742
+ # @rbs (Hash[Symbol, runtime_value] context, Hash[String, runtime_value]? token_data,
743
+ # Array[Proc]? recovery_observers) -> runtime_value
730
744
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
731
745
  # Green restoration mirrors the existing state/value/location transactional fallback.
732
- def fallback_recovery: (Hash[Symbol, untyped] context, Hash[String, untyped]? token_data, Array[Proc]? recovery_observers) -> untyped
746
+ def fallback_recovery: (Hash[Symbol, runtime_value] context, Hash[String, runtime_value]? token_data, Array[Proc]? recovery_observers) -> runtime_value
733
747
 
734
- # @rbs (untyped token_id, untyped token_display, untyped value, untyped location,
735
- # Integer state) -> Hash[String, untyped]
736
- def runtime_original_token_data: (untyped token_id, untyped token_display, untyped value, untyped location, Integer state) -> Hash[String, untyped]
748
+ # @rbs (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location,
749
+ # Integer state) -> Hash[String, runtime_value]
750
+ def runtime_original_token_data: (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location, Integer state) -> Hash[String, runtime_value]
737
751
 
738
- # @rbs (untyped token_id, untyped token_display, untyped value, untyped location,
739
- # Integer original_state, Hash[String, untyped]? token_data,
752
+ # @rbs (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location,
753
+ # Integer original_state, Hash[String, runtime_value]? token_data,
740
754
  # Array[Proc]? observers) -> [:done, nil]
741
- def reject_without_recovery: (untyped token_id, untyped token_display, untyped value, untyped location, Integer original_state, Hash[String, untyped]? token_data, Array[Proc]? observers) -> [ :done, nil ]
755
+ def reject_without_recovery: (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location, Integer original_state, Hash[String, runtime_value]? token_data, Array[Proc]? observers) -> [ :done, nil ]
742
756
 
743
- # @rbs (untyped token_id, untyped token_display, untyped value, untyped location,
744
- # Integer original_state, Array[untyped] value_stack, Hash[String, untyped]? token_data,
757
+ # @rbs (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location,
758
+ # Integer original_state, Array[runtime_value] value_stack, Hash[String, runtime_value]? token_data,
745
759
  # String reason, Array[Proc]? observers) -> [:continue]
746
- def finish_recovery: (untyped token_id, untyped token_display, untyped value, untyped location, Integer original_state, Array[untyped] value_stack, Hash[String, untyped]? token_data, String reason, Array[Proc]? observers) -> [ :continue ]
760
+ def finish_recovery: (runtime_value token_id, runtime_value token_display, runtime_value value, runtime_value location, Integer original_state, Array[runtime_value] value_stack, Hash[String, runtime_value]? token_data, String reason, Array[Proc]? observers) -> [ :continue ]
747
761
 
748
- # @rbs (token_id: untyped, token_display: untyped, value: untyped,
749
- # location: untyped, state: Integer) -> Hash[String, untyped]
750
- def runtime_token_data: (token_id: untyped, token_display: untyped, value: untyped, location: untyped, state: Integer) -> Hash[String, untyped]
762
+ # @rbs (token_id: runtime_value, token_display: runtime_value, value: runtime_value,
763
+ # location: runtime_value, state: Integer) -> Hash[String, runtime_value]
764
+ def runtime_token_data: (token_id: runtime_value, token_display: runtime_value, value: runtime_value, location: runtime_value, state: Integer) -> Hash[String, runtime_value]
751
765
 
752
- # @rbs () -> Hash[String, untyped]
753
- def runtime_current_token_data: () -> Hash[String, untyped]
766
+ # @rbs () -> Hash[String, runtime_value]
767
+ def runtime_current_token_data: () -> Hash[String, runtime_value]
754
768
 
755
- # @rbs (untyped result_summary, String reason) -> void
756
- def emit_accept_event: (untyped result_summary, String reason) -> void
769
+ # @rbs (runtime_value result_summary, String reason) -> void
770
+ def emit_accept_event: (runtime_value result_summary, String reason) -> void
757
771
 
758
- # @rbs (String reason, Hash[String, untyped] token_data, ?observers: Array[Proc]?) -> void
759
- def emit_reject_event: (String reason, Hash[String, untyped] token_data, ?observers: Array[Proc]?) -> void
772
+ # @rbs (String reason, Hash[String, runtime_value] token_data, ?observers: Array[Proc]?) -> void
773
+ def emit_reject_event: (String reason, Hash[String, runtime_value] token_data, ?observers: Array[Proc]?) -> void
760
774
 
761
775
  # @rbs () -> bool
762
776
  def shift_error_token: () -> bool
@@ -793,11 +807,11 @@ module Ibex
793
807
  # @rbs () -> void
794
808
  def clear_repair_lookahead: () -> void
795
809
 
796
- # @rbs (RepairEdit edit, value: untyped, location: untyped) -> RepairInput
797
- def synthetic_repair_input: (RepairEdit edit, value: untyped, location: untyped) -> RepairInput
810
+ # @rbs (RepairEdit edit, value: runtime_value, location: runtime_value) -> RepairInput
811
+ def synthetic_repair_input: (RepairEdit edit, value: runtime_value, location: runtime_value) -> RepairInput
798
812
 
799
- # @rbs (untyped location, Symbol kind) -> Hash[Symbol, untyped]
800
- def cst_repair_location: (untyped location, Symbol kind) -> Hash[Symbol, untyped]
813
+ # @rbs (runtime_value location, Symbol kind) -> Hash[Symbol, runtime_value]
814
+ def cst_repair_location: (runtime_value location, Symbol kind) -> Hash[Symbol, runtime_value]
801
815
 
802
816
  # @rbs (RepairPlan plan) -> String
803
817
  def repair_trace: (RepairPlan plan) -> String
@@ -817,11 +831,11 @@ module Ibex
817
831
  # @rbs () -> String
818
832
  def materialize_lookahead_token_display!: () -> String
819
833
 
820
- # @rbs (untyped external_token, untyped value, untyped location) -> RepairInput
821
- def repair_input: (untyped external_token, untyped value, untyped location) -> RepairInput
834
+ # @rbs (runtime_value external_token, runtime_value value, runtime_value location) -> RepairInput
835
+ def repair_input: (runtime_value external_token, runtime_value value, runtime_value location) -> RepairInput
822
836
 
823
- # @rbs (untyped token) -> RepairInput
824
- def repair_input_from_external: (untyped token) -> RepairInput
837
+ # @rbs (runtime_value token) -> RepairInput
838
+ def repair_input_from_external: (runtime_value token) -> RepairInput
825
839
 
826
840
  # @rbs (RepairInput input) -> void
827
841
  def enqueue_or_assign_repair_input: (RepairInput input) -> void
@@ -829,23 +843,23 @@ module Ibex
829
843
  # @rbs (RepairInput input) -> void
830
844
  def assign_repair_input: (RepairInput input) -> void
831
845
 
832
- # @rbs () -> untyped
833
- def read_external_token: () -> untyped
846
+ # @rbs () -> runtime_value
847
+ def read_external_token: () -> runtime_value
834
848
 
835
- # @rbs (untyped external_token) -> Integer
836
- def internal_token_id: (untyped external_token) -> Integer
849
+ # @rbs (runtime_value external_token) -> Integer
850
+ def internal_token_id: (runtime_value external_token) -> Integer
837
851
 
838
- # @rbs () -> Hash[Symbol, untyped]
839
- def parser_tables: () -> Hash[Symbol, untyped]
852
+ # @rbs () -> Hash[Symbol, runtime_value]
853
+ def parser_tables: () -> Hash[Symbol, runtime_value]
840
854
 
841
- # @rbs () -> Hash[Symbol, untyped]
842
- def load_parser_tables: () -> Hash[Symbol, untyped]
855
+ # @rbs () -> Hash[Symbol, runtime_value]
856
+ def load_parser_tables: () -> Hash[Symbol, runtime_value]
843
857
 
844
- # @rbs (untyped action) -> bool
845
- def error_action?: (untyped action) -> bool
858
+ # @rbs (runtime_value action) -> bool
859
+ def error_action?: (runtime_value action) -> bool
846
860
 
847
- # @rbs (untyped configured) -> [String?, String?]
848
- def configured_error_message: (untyped configured) -> [ String?, String? ]
861
+ # @rbs (runtime_value configured) -> [String?, String?]
862
+ def configured_error_message: (runtime_value configured) -> [ String?, String? ]
849
863
 
850
864
  # @rbs (String actual, Array[String] expected) -> Array[String]
851
865
  def token_suggestions: (String actual, Array[String] expected) -> Array[String]
@@ -856,14 +870,14 @@ module Ibex
856
870
  # @rbs (String left, String right) -> Integer
857
871
  def edit_distance: (String left, String right) -> Integer
858
872
 
859
- # @rbs (Integer state) -> untyped
860
- def default_action: (Integer state) -> untyped
873
+ # @rbs (Integer state) -> runtime_value
874
+ def default_action: (Integer state) -> runtime_value
861
875
 
862
- # @rbs (Hash[Symbol, untyped] tables) -> bool
863
- def track_locations?: (Hash[Symbol, untyped] tables) -> bool
876
+ # @rbs (Hash[Symbol, runtime_value] tables) -> bool
877
+ def track_locations?: (Hash[Symbol, runtime_value] tables) -> bool
864
878
 
865
- # @rbs (Hash[Symbol, untyped] tables) -> void
866
- def initialize_runtime_fast_path: (Hash[Symbol, untyped] tables) -> void
879
+ # @rbs (Hash[Symbol, runtime_value] tables) -> void
880
+ def initialize_runtime_fast_path: (Hash[Symbol, runtime_value] tables) -> void
867
881
 
868
882
  # @rbs (?Class? singleton) -> void
869
883
  def install_runtime_fast_path_tracker!: (?Class? singleton) -> void
@@ -873,8 +887,8 @@ module Ibex
873
887
 
874
888
  # The generic driver remains authoritative whenever a public runtime
875
889
  # extension can observe a committed shift or reduction.
876
- # @rbs (Hash[Symbol, untyped] tables) -> bool
877
- def runtime_fast_path_eligible?: (Hash[Symbol, untyped] tables) -> bool
890
+ # @rbs (Hash[Symbol, runtime_value] tables) -> bool
891
+ def runtime_fast_path_eligible?: (Hash[Symbol, runtime_value] tables) -> bool
878
892
 
879
893
  # @rbs () -> bool
880
894
  def runtime_fast_path_hooks_eligible?: () -> bool
@@ -907,20 +921,20 @@ module Ibex
907
921
  # Keep allocation out of the ordinary two-element lexer path. If a
908
922
  # location first appears after values have already shifted, backfill the
909
923
  # parallel prefix with nil exactly once.
910
- # @rbs (untyped location) -> void
911
- def push_location: (untyped location) -> void
924
+ # @rbs (runtime_value location) -> void
925
+ def push_location: (runtime_value location) -> void
912
926
 
913
- # @rbs (Integer length) -> Array[untyped]
914
- def pop_reduction_locations: (Integer length) -> Array[untyped]
927
+ # @rbs (Integer length) -> Array[runtime_value]
928
+ def pop_reduction_locations: (Integer length) -> Array[runtime_value]
915
929
 
916
- # @rbs (untyped table, Integer row, Integer column) -> untyped
917
- def table_lookup: (untyped table, Integer row, Integer column) -> untyped
930
+ # @rbs (runtime_value table, Integer row, Integer column) -> runtime_value
931
+ def table_lookup: (runtime_value table, Integer row, Integer column) -> runtime_value
918
932
 
919
933
  # @rbs (String message) -> void
920
934
  def trace: (String message) -> void
921
935
 
922
- # @rbs (untyped value, Integer symbol_id) -> String
923
- def trace_value_suffix: (untyped value, Integer symbol_id) -> String
936
+ # @rbs (runtime_value value, Integer symbol_id) -> String
937
+ def trace_value_suffix: (runtime_value value, Integer symbol_id) -> String
924
938
  end
925
939
  end
926
940
  end