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.
- checksums.yaml +4 -4
- data/README.md +100 -272
- data/lib/ibex/runtime/cst/green/node.rb +1 -1
- data/lib/ibex/runtime/cst/green/token.rb +1 -1
- data/lib/ibex/runtime/cst/green/trivia.rb +1 -1
- data/lib/ibex/runtime/cst/incremental/blender.rb +1 -1
- data/lib/ibex/runtime/cst/incremental/lexed_syntax.rb +2 -2
- data/lib/ibex/runtime/cst/incremental/parse_memo.rb +2 -2
- data/lib/ibex/runtime/cst/incremental/relexer.rb +3 -0
- data/lib/ibex/runtime/cst/incremental/session.rb +26 -2
- data/lib/ibex/runtime/cst/parse_result.rb +7 -7
- data/lib/ibex/runtime/cst/serialize.rb +6 -3
- data/lib/ibex/runtime/cst/syntax_node.rb +4 -4
- data/lib/ibex/runtime/cst/syntax_token.rb +5 -5
- data/lib/ibex/runtime/cst/typed_node.rb +1 -1
- data/lib/ibex/runtime/cst/validator.rb +40 -30
- data/lib/ibex/runtime/embedded_source.rb +98 -0
- data/lib/ibex/runtime/event.rb +7 -4
- data/lib/ibex/runtime/event_jsonl_tracer.rb +1 -1
- data/lib/ibex/runtime/event_sanitizer.rb +32 -26
- data/lib/ibex/runtime/generated_lexer.rb +23 -16
- data/lib/ibex/runtime/lexer_input.rb +1 -1
- data/lib/ibex/runtime/location_span.rb +15 -15
- data/lib/ibex/runtime/observation.rb +1 -1
- data/lib/ibex/runtime/parser.rb +309 -191
- data/lib/ibex/runtime/parser_sync_recovery.rb +19 -15
- data/lib/ibex/runtime/repair.rb +36 -5
- data/lib/ibex/runtime/repair_priority_queue.rb +10 -6
- data/lib/ibex/runtime/repair_search.rb +92 -29
- data/lib/ibex/runtime/syntax_repair.rb +490 -0
- data/lib/ibex/runtime/syntax_session.rb +416 -0
- data/lib/ibex/runtime/table_format.rb +1 -1
- data/lib/ibex/runtime/version.rb +1 -1
- data/lib/ibex/runtime.rb +2 -1
- data/lib/ibex/tables/compact.rb +16 -12
- data/lib/ibex/tables/compact_actions.rb +45 -33
- data/lib/ibex/tables/compact_productions.rb +18 -15
- data/sig/ibex/runtime/cst/green/node.rbs +2 -2
- data/sig/ibex/runtime/cst/green/token.rbs +2 -2
- data/sig/ibex/runtime/cst/green/trivia.rbs +2 -2
- data/sig/ibex/runtime/cst/incremental/blender.rbs +2 -2
- data/sig/ibex/runtime/cst/incremental/lexed_syntax.rbs +3 -3
- data/sig/ibex/runtime/cst/incremental/parse_memo.rbs +4 -4
- data/sig/ibex/runtime/cst/incremental/session.rbs +8 -2
- data/sig/ibex/runtime/cst/parse_result.rbs +9 -9
- data/sig/ibex/runtime/cst/serialize.rbs +8 -6
- data/sig/ibex/runtime/cst/syntax_node.rbs +6 -6
- data/sig/ibex/runtime/cst/syntax_token.rbs +10 -10
- data/sig/ibex/runtime/cst/typed_node.rbs +2 -2
- data/sig/ibex/runtime/cst/validator.rbs +46 -42
- data/sig/ibex/runtime/embedded_source.rbs +21 -0
- data/sig/ibex/runtime/event.rbs +7 -5
- data/sig/ibex/runtime/event_jsonl_tracer.rbs +1 -1
- data/sig/ibex/runtime/event_sanitizer.rbs +50 -44
- data/sig/ibex/runtime/generated_lexer.rbs +31 -24
- data/sig/ibex/runtime/lexer_input.rbs +2 -2
- data/sig/ibex/runtime/location_span.rbs +28 -28
- data/sig/ibex/runtime/observation.rbs +2 -2
- data/sig/ibex/runtime/parser.rbs +266 -252
- data/sig/ibex/runtime/parser_sync_recovery.rbs +15 -15
- data/sig/ibex/runtime/repair.rbs +28 -8
- data/sig/ibex/runtime/repair_priority_queue.rbs +9 -7
- data/sig/ibex/runtime/repair_search.rbs +38 -19
- data/sig/ibex/runtime/syntax_repair.rbs +177 -0
- data/sig/ibex/runtime/syntax_session.rbs +186 -0
- data/sig/ibex/tables/compact.rbs +12 -12
- data/sig/ibex/tables/compact_actions.rbs +10 -17
- data/sig/ibex/tables/compact_productions.rbs +19 -19
- metadata +12 -6
- data/lib/ibex/runtime/jsonl_tracer.rb +0 -75
- data/sig/ibex/runtime/jsonl_tracer.rbs +0 -42
data/sig/ibex/runtime/parser.rbs
CHANGED
|
@@ -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:
|
|
13
|
+
attr_reader token_value: runtime_value
|
|
12
14
|
|
|
13
15
|
attr_reader expected_tokens: Array[String]
|
|
14
16
|
|
|
15
|
-
attr_reader location:
|
|
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:
|
|
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:
|
|
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) ->
|
|
37
|
-
def location_value: (Symbol key) ->
|
|
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:
|
|
49
|
-
def initialize: (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location:
|
|
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,
|
|
52
|
-
def to_h: () -> Hash[Symbol,
|
|
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,
|
|
152
|
+
EMPTY_ROW: Hash[Integer, runtime_value]
|
|
151
153
|
|
|
152
154
|
EMPTY_LOCATION_NAMES: Hash[Symbol, Integer]
|
|
153
155
|
|
|
154
|
-
EMPTY_LOCATIONS: Array[
|
|
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:
|
|
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[
|
|
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:
|
|
194
|
+
@lookahead_location: runtime_value
|
|
193
195
|
|
|
194
|
-
@lookahead_value:
|
|
196
|
+
@lookahead_value: runtime_value
|
|
195
197
|
|
|
196
|
-
@lookahead:
|
|
198
|
+
@lookahead: runtime_value
|
|
197
199
|
|
|
198
|
-
@location_stack: Array[
|
|
200
|
+
@location_stack: Array[runtime_value]?
|
|
199
201
|
|
|
200
|
-
@racc_vstack: Array[
|
|
202
|
+
@racc_vstack: Array[runtime_value]
|
|
201
203
|
|
|
202
|
-
@vstack: Array[
|
|
204
|
+
@vstack: Array[runtime_value]
|
|
203
205
|
|
|
204
|
-
@value_stack: Array[
|
|
206
|
+
@value_stack: Array[runtime_value]
|
|
205
207
|
|
|
206
208
|
@state_stack: Array[Integer]
|
|
207
209
|
|
|
208
|
-
@source:
|
|
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,
|
|
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[
|
|
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,
|
|
260
|
+
@sync_recovery_token_data: Hash[String, runtime_value]?
|
|
259
261
|
|
|
260
|
-
@sync_recovery_context: Hash[Symbol,
|
|
262
|
+
@sync_recovery_context: Hash[Symbol, runtime_value]?
|
|
261
263
|
|
|
262
|
-
@trace_value_printer: (^(
|
|
264
|
+
@trace_value_printer: (^(runtime_value) -> runtime_value)?
|
|
263
265
|
|
|
264
|
-
@semantic_result_location:
|
|
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
|
|
305
|
-
#
|
|
306
|
-
|
|
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
|
-
#
|
|
318
|
-
|
|
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
|
-
#
|
|
324
|
-
|
|
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
|
-
#
|
|
330
|
-
|
|
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 () -> ([
|
|
339
|
-
def next_token: () -> ([
|
|
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,
|
|
344
|
-
def on_error: (Integer token_id,
|
|
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,
|
|
349
|
-
def on_shift: (Integer token_id,
|
|
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,
|
|
354
|
-
def on_shift_location: (Integer token_id,
|
|
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[
|
|
359
|
-
def on_reduce: (Integer production_id, Array[
|
|
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[
|
|
363
|
-
# Array[
|
|
364
|
-
def on_reduce_location: (Integer production_id, Array[
|
|
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,
|
|
369
|
-
def on_error_recover: (Integer token_id,
|
|
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,
|
|
373
|
-
#
|
|
374
|
-
def on_error_recover_location: (Integer token_id,
|
|
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,
|
|
378
|
-
def on_discard: (Integer token_id,
|
|
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 ((^(
|
|
382
|
-
def trace_value_printer=: ((^(
|
|
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) ->
|
|
417
|
-
def loc: (Integer | Symbol | String reference) ->
|
|
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 () ->
|
|
421
|
-
def result_loc: () ->
|
|
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[
|
|
452
|
-
def install_value_stack: (Array[
|
|
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,
|
|
461
|
-
def parser_state_count: (Hash[Symbol,
|
|
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 (
|
|
467
|
-
def drive_parser: (
|
|
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,
|
|
478
|
-
def drive_compact_fast_parser: (Hash[Symbol,
|
|
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,
|
|
481
|
-
def compact_fast_driver_eligible?: (Hash[Symbol,
|
|
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 () ->
|
|
487
|
-
def run_push_lookahead: () ->
|
|
499
|
+
# @rbs () -> runtime_value
|
|
500
|
+
def run_push_lookahead: () -> runtime_value
|
|
488
501
|
|
|
489
|
-
# @rbs () { () ->
|
|
490
|
-
def run_push_driver: () { () ->
|
|
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 ((^() ->
|
|
502
|
-
def prepare_parse: ((^() ->
|
|
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,
|
|
508
|
-
def resolve_initial_state: (Hash[Symbol,
|
|
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,
|
|
511
|
-
def validate_parser_table_format!: () -> Hash[Symbol,
|
|
523
|
+
# @rbs () -> Hash[Symbol, runtime_value]
|
|
524
|
+
def validate_parser_table_format!: () -> Hash[Symbol, runtime_value]
|
|
512
525
|
|
|
513
|
-
# @rbs (Hash[Symbol,
|
|
514
|
-
def validate_current_cst_tables!: (Hash[Symbol,
|
|
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,
|
|
521
|
-
def generated_action_contracts_validated?: (Hash[Symbol,
|
|
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,
|
|
524
|
-
def cache_generated_action_contracts!: (Hash[Symbol,
|
|
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,
|
|
533
|
-
def validate_generated_action_contracts!: (Hash[Symbol,
|
|
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,
|
|
536
|
-
def validate_composition_action_contract!: (Hash[Symbol,
|
|
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,
|
|
539
|
-
def validate_values_action_contract!: (Hash[Symbol,
|
|
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,
|
|
542
|
-
def validate_positional_action_contract!: (Hash[Symbol,
|
|
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,
|
|
545
|
-
def positional_action_contract?: (Hash[Symbol,
|
|
557
|
+
# @rbs (Hash[Symbol, runtime_value] production) -> bool
|
|
558
|
+
def positional_action_contract?: (Hash[Symbol, runtime_value] production) -> bool
|
|
546
559
|
|
|
547
|
-
# @rbs () ->
|
|
548
|
-
def action_for_current_state: () ->
|
|
560
|
+
# @rbs () -> runtime_value
|
|
561
|
+
def action_for_current_state: () -> runtime_value
|
|
549
562
|
|
|
550
|
-
# @rbs (
|
|
551
|
-
def perform: (
|
|
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,
|
|
557
|
-
def fast_reduction_eligible?: (Hash[Symbol,
|
|
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,
|
|
560
|
-
def fast_reduce: (Integer production_id, Hash[Symbol,
|
|
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,
|
|
563
|
-
|
|
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) ->
|
|
566
|
-
def shift: (Integer next_state) ->
|
|
579
|
+
# @rbs (Integer next_state) -> runtime_value
|
|
580
|
+
def shift: (Integer next_state) -> runtime_value
|
|
567
581
|
|
|
568
|
-
# @rbs (Integer production_id, ?Hash[Symbol,
|
|
569
|
-
def reduce: (Integer production_id, ?Hash[Symbol,
|
|
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,
|
|
572
|
-
def push_reduction_result: (Integer next_state,
|
|
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,
|
|
575
|
-
def trace_reduction: (Integer production_id, Integer length, Integer lhs,
|
|
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,
|
|
578
|
-
# Integer? pre_state, Integer? post_state, Integer next_state,
|
|
579
|
-
# LocationSpan? location) -> Hash[String,
|
|
580
|
-
def build_reduce_event_data: (Array[Proc]? observers, Integer production_id, Hash[Symbol,
|
|
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,
|
|
583
|
-
# Integer? pre_state, Integer? post_state, Integer next_state,
|
|
584
|
-
# LocationSpan? location) -> Hash[String,
|
|
585
|
-
def runtime_reduce_data: (Integer production_id, Hash[Symbol,
|
|
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 (
|
|
588
|
-
def accept_reduction: (
|
|
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,
|
|
591
|
-
# Array[
|
|
592
|
-
def reduction_value: (Integer production_id, Hash[Symbol,
|
|
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,
|
|
595
|
-
# Array[
|
|
596
|
-
def values_reduction_value: (Hash[Symbol,
|
|
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,
|
|
599
|
-
# Array[
|
|
600
|
-
def actionless_reduction_value: (Integer production_id, Hash[Symbol,
|
|
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,
|
|
603
|
-
def generated_location_action?: (Hash[Symbol,
|
|
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,
|
|
606
|
-
def generated_values_action?: (Hash[Symbol,
|
|
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,
|
|
609
|
-
def generated_positional_action?: (Hash[Symbol,
|
|
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,
|
|
612
|
-
def generated_composition_action?: (Hash[Symbol,
|
|
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 (
|
|
615
|
-
def generated_action_symbol?: (
|
|
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,
|
|
621
|
-
def capture_cst_error: (Integer token_id,
|
|
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 (
|
|
624
|
-
def finalize_cst: (
|
|
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 (
|
|
633
|
-
def cst_location_value: (
|
|
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,
|
|
636
|
-
def prepare_green_cst: (Hash[Symbol,
|
|
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,
|
|
639
|
-
def reset_cst_results: (Hash[Symbol,
|
|
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,
|
|
643
|
-
def shift_green_token: (Integer token_id,
|
|
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,
|
|
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,
|
|
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,
|
|
651
|
-
def reduce_green: (Integer production_id, Hash[Symbol,
|
|
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 (
|
|
654
|
-
def green_token_text: (
|
|
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 (
|
|
657
|
-
def green_location_trivia: (
|
|
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 (
|
|
660
|
-
def finalize_red_green_cst: (
|
|
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 (
|
|
675
|
-
def syntax_parse_result: (
|
|
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 (
|
|
684
|
-
def green_lexer_state: (
|
|
697
|
+
# @rbs (runtime_value location) -> Symbol
|
|
698
|
+
def green_lexer_state: (runtime_value location) -> Symbol
|
|
685
699
|
|
|
686
|
-
# @rbs (CST::NodeCache cache) { () ->
|
|
687
|
-
def with_syntax_only: (CST::NodeCache cache) { () ->
|
|
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 (
|
|
690
|
-
def parse_syntax_token_source: (
|
|
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[
|
|
696
|
-
def emit_incremental_event: (Symbol type, Hash[
|
|
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) ->
|
|
702
|
-
def recover: (?report: bool) ->
|
|
715
|
+
# @rbs (?report: bool) -> runtime_value
|
|
716
|
+
def recover: (?report: bool) -> runtime_value
|
|
703
717
|
|
|
704
|
-
# @rbs () ->
|
|
705
|
-
def continue_recovery: () ->
|
|
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,
|
|
711
|
-
def runtime_discard_data: (String token_display) -> Hash[String,
|
|
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) ->
|
|
714
|
-
def begin_recovery: (bool report) ->
|
|
727
|
+
# @rbs (bool report) -> runtime_value
|
|
728
|
+
def begin_recovery: (bool report) -> runtime_value
|
|
715
729
|
|
|
716
|
-
# @rbs (bool report) -> Hash[Symbol,
|
|
717
|
-
def recovery_context: (bool report) -> Hash[Symbol,
|
|
730
|
+
# @rbs (bool report) -> Hash[Symbol, runtime_value]
|
|
731
|
+
def recovery_context: (bool report) -> Hash[Symbol, runtime_value]
|
|
718
732
|
|
|
719
|
-
# @rbs (Hash[Symbol,
|
|
720
|
-
def publish_error_context: (Hash[Symbol,
|
|
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,
|
|
723
|
-
def notify_error_handler: (Hash[Symbol,
|
|
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,
|
|
729
|
-
# Array[Proc]? recovery_observers) ->
|
|
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,
|
|
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 (
|
|
735
|
-
# Integer state) -> Hash[String,
|
|
736
|
-
def runtime_original_token_data: (
|
|
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 (
|
|
739
|
-
# Integer original_state, Hash[String,
|
|
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: (
|
|
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 (
|
|
744
|
-
# Integer original_state, Array[
|
|
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: (
|
|
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:
|
|
749
|
-
# location:
|
|
750
|
-
def runtime_token_data: (token_id:
|
|
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,
|
|
753
|
-
def runtime_current_token_data: () -> Hash[String,
|
|
766
|
+
# @rbs () -> Hash[String, runtime_value]
|
|
767
|
+
def runtime_current_token_data: () -> Hash[String, runtime_value]
|
|
754
768
|
|
|
755
|
-
# @rbs (
|
|
756
|
-
def emit_accept_event: (
|
|
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,
|
|
759
|
-
def emit_reject_event: (String reason, Hash[String,
|
|
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:
|
|
797
|
-
def synthetic_repair_input: (RepairEdit edit, value:
|
|
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 (
|
|
800
|
-
def cst_repair_location: (
|
|
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 (
|
|
821
|
-
def repair_input: (
|
|
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 (
|
|
824
|
-
def repair_input_from_external: (
|
|
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 () ->
|
|
833
|
-
def read_external_token: () ->
|
|
846
|
+
# @rbs () -> runtime_value
|
|
847
|
+
def read_external_token: () -> runtime_value
|
|
834
848
|
|
|
835
|
-
# @rbs (
|
|
836
|
-
def internal_token_id: (
|
|
849
|
+
# @rbs (runtime_value external_token) -> Integer
|
|
850
|
+
def internal_token_id: (runtime_value external_token) -> Integer
|
|
837
851
|
|
|
838
|
-
# @rbs () -> Hash[Symbol,
|
|
839
|
-
def parser_tables: () -> Hash[Symbol,
|
|
852
|
+
# @rbs () -> Hash[Symbol, runtime_value]
|
|
853
|
+
def parser_tables: () -> Hash[Symbol, runtime_value]
|
|
840
854
|
|
|
841
|
-
# @rbs () -> Hash[Symbol,
|
|
842
|
-
def load_parser_tables: () -> Hash[Symbol,
|
|
855
|
+
# @rbs () -> Hash[Symbol, runtime_value]
|
|
856
|
+
def load_parser_tables: () -> Hash[Symbol, runtime_value]
|
|
843
857
|
|
|
844
|
-
# @rbs (
|
|
845
|
-
def error_action?: (
|
|
858
|
+
# @rbs (runtime_value action) -> bool
|
|
859
|
+
def error_action?: (runtime_value action) -> bool
|
|
846
860
|
|
|
847
|
-
# @rbs (
|
|
848
|
-
def configured_error_message: (
|
|
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) ->
|
|
860
|
-
def default_action: (Integer state) ->
|
|
873
|
+
# @rbs (Integer state) -> runtime_value
|
|
874
|
+
def default_action: (Integer state) -> runtime_value
|
|
861
875
|
|
|
862
|
-
# @rbs (Hash[Symbol,
|
|
863
|
-
def track_locations?: (Hash[Symbol,
|
|
876
|
+
# @rbs (Hash[Symbol, runtime_value] tables) -> bool
|
|
877
|
+
def track_locations?: (Hash[Symbol, runtime_value] tables) -> bool
|
|
864
878
|
|
|
865
|
-
# @rbs (Hash[Symbol,
|
|
866
|
-
def initialize_runtime_fast_path: (Hash[Symbol,
|
|
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,
|
|
877
|
-
def runtime_fast_path_eligible?: (Hash[Symbol,
|
|
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 (
|
|
911
|
-
def push_location: (
|
|
924
|
+
# @rbs (runtime_value location) -> void
|
|
925
|
+
def push_location: (runtime_value location) -> void
|
|
912
926
|
|
|
913
|
-
# @rbs (Integer length) -> Array[
|
|
914
|
-
def pop_reduction_locations: (Integer length) -> Array[
|
|
927
|
+
# @rbs (Integer length) -> Array[runtime_value]
|
|
928
|
+
def pop_reduction_locations: (Integer length) -> Array[runtime_value]
|
|
915
929
|
|
|
916
|
-
# @rbs (
|
|
917
|
-
def table_lookup: (
|
|
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 (
|
|
923
|
-
def trace_value_suffix: (
|
|
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
|