ibex-runtime 0.2.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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +337 -0
- data/lib/ibex/runtime/ast_data.rb +23 -0
- data/lib/ibex/runtime/cst/annotation.rb +16 -0
- data/lib/ibex/runtime/cst/cursor.rb +68 -0
- data/lib/ibex/runtime/cst/diff.rb +80 -0
- data/lib/ibex/runtime/cst/editing.rb +56 -0
- data/lib/ibex/runtime/cst/editor.rb +94 -0
- data/lib/ibex/runtime/cst/green/builder.rb +211 -0
- data/lib/ibex/runtime/cst/green/cache.rb +150 -0
- data/lib/ibex/runtime/cst/green/node.rb +78 -0
- data/lib/ibex/runtime/cst/green/token.rb +91 -0
- data/lib/ibex/runtime/cst/green/trivia.rb +36 -0
- data/lib/ibex/runtime/cst/incremental/blender.rb +233 -0
- data/lib/ibex/runtime/cst/incremental/lexed_syntax.rb +28 -0
- data/lib/ibex/runtime/cst/incremental/parse_memo.rb +95 -0
- data/lib/ibex/runtime/cst/incremental/relexer.rb +134 -0
- data/lib/ibex/runtime/cst/incremental/session.rb +229 -0
- data/lib/ibex/runtime/cst/incremental/token_memo.rb +66 -0
- data/lib/ibex/runtime/cst/kind.rb +133 -0
- data/lib/ibex/runtime/cst/parse_result.rb +41 -0
- data/lib/ibex/runtime/cst/rewriter.rb +75 -0
- data/lib/ibex/runtime/cst/serialize.rb +127 -0
- data/lib/ibex/runtime/cst/serialized_tree.rb +44 -0
- data/lib/ibex/runtime/cst/source_text.rb +112 -0
- data/lib/ibex/runtime/cst/syntax_node.rb +432 -0
- data/lib/ibex/runtime/cst/syntax_token.rb +160 -0
- data/lib/ibex/runtime/cst/text_edit.rb +77 -0
- data/lib/ibex/runtime/cst/typed_node.rb +87 -0
- data/lib/ibex/runtime/cst/validator.rb +428 -0
- data/lib/ibex/runtime/cst.rb +38 -0
- data/lib/ibex/runtime/event.rb +44 -0
- data/lib/ibex/runtime/event_jsonl_tracer.rb +37 -0
- data/lib/ibex/runtime/event_sanitizer.rb +273 -0
- data/lib/ibex/runtime/generated_lexer.rb +514 -0
- data/lib/ibex/runtime/jsonl_tracer.rb +75 -0
- data/lib/ibex/runtime/lexer_input.rb +107 -0
- data/lib/ibex/runtime/location_span.rb +114 -0
- data/lib/ibex/runtime/observation.rb +82 -0
- data/lib/ibex/runtime/parser.rb +3027 -0
- data/lib/ibex/runtime/parser_sync_recovery.rb +108 -0
- data/lib/ibex/runtime/repair.rb +126 -0
- data/lib/ibex/runtime/repair_priority_queue.rb +60 -0
- data/lib/ibex/runtime/repair_search.rb +318 -0
- data/lib/ibex/runtime/resource_limits.rb +64 -0
- data/lib/ibex/runtime/table_format.rb +11 -0
- data/lib/ibex/runtime/version.rb +7 -0
- data/lib/ibex/runtime.rb +27 -0
- data/lib/ibex/tables/compact.rb +186 -0
- data/lib/ibex/tables/compact_actions.rb +135 -0
- data/lib/ibex/tables/compact_productions.rb +167 -0
- data/sig/ibex/runtime/ast_data.rbs +12 -0
- data/sig/ibex/runtime/cst/annotation.rbs +13 -0
- data/sig/ibex/runtime/cst/cursor.rbs +34 -0
- data/sig/ibex/runtime/cst/diff.rbs +29 -0
- data/sig/ibex/runtime/cst/editing.rbs +23 -0
- data/sig/ibex/runtime/cst/editor.rbs +43 -0
- data/sig/ibex/runtime/cst/green/builder.rbs +84 -0
- data/sig/ibex/runtime/cst/green/cache.rbs +60 -0
- data/sig/ibex/runtime/cst/green/node.rbs +49 -0
- data/sig/ibex/runtime/cst/green/token.rbs +59 -0
- data/sig/ibex/runtime/cst/green/trivia.rbs +29 -0
- data/sig/ibex/runtime/cst/incremental/blender.rbs +114 -0
- data/sig/ibex/runtime/cst/incremental/lexed_syntax.rbs +20 -0
- data/sig/ibex/runtime/cst/incremental/parse_memo.rbs +59 -0
- data/sig/ibex/runtime/cst/incremental/relexer.rbs +54 -0
- data/sig/ibex/runtime/cst/incremental/session.rbs +89 -0
- data/sig/ibex/runtime/cst/incremental/token_memo.rbs +31 -0
- data/sig/ibex/runtime/cst/kind.rbs +93 -0
- data/sig/ibex/runtime/cst/parse_result.rbs +35 -0
- data/sig/ibex/runtime/cst/rewriter.rbs +31 -0
- data/sig/ibex/runtime/cst/serialize.rbs +39 -0
- data/sig/ibex/runtime/cst/serialized_tree.rbs +34 -0
- data/sig/ibex/runtime/cst/source_text.rbs +51 -0
- data/sig/ibex/runtime/cst/syntax_node.rbs +195 -0
- data/sig/ibex/runtime/cst/syntax_token.rbs +112 -0
- data/sig/ibex/runtime/cst/text_edit.rbs +33 -0
- data/sig/ibex/runtime/cst/typed_node.rbs +50 -0
- data/sig/ibex/runtime/cst/validator.rbs +108 -0
- data/sig/ibex/runtime/cst.rbs +9 -0
- data/sig/ibex/runtime/event.rbs +26 -0
- data/sig/ibex/runtime/event_jsonl_tracer.rbs +25 -0
- data/sig/ibex/runtime/event_sanitizer.rbs +92 -0
- data/sig/ibex/runtime/generated_lexer.rbs +169 -0
- data/sig/ibex/runtime/jsonl_tracer.rbs +42 -0
- data/sig/ibex/runtime/lexer_input.rbs +44 -0
- data/sig/ibex/runtime/location_span.rbs +64 -0
- data/sig/ibex/runtime/observation.rbs +35 -0
- data/sig/ibex/runtime/parser.rbs +926 -0
- data/sig/ibex/runtime/parser_sync_recovery.rbs +60 -0
- data/sig/ibex/runtime/repair.rbs +92 -0
- data/sig/ibex/runtime/repair_priority_queue.rbs +27 -0
- data/sig/ibex/runtime/repair_search.rbs +114 -0
- data/sig/ibex/runtime/resource_limits.rbs +39 -0
- data/sig/ibex/runtime/table_format.rbs +11 -0
- data/sig/ibex/runtime/version.rbs +7 -0
- data/sig/ibex/runtime.rbs +6 -0
- data/sig/ibex/tables/compact.rbs +70 -0
- data/sig/ibex/tables/compact_actions.rbs +57 -0
- data/sig/ibex/tables/compact_productions.rbs +68 -0
- metadata +144 -0
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
# Generated from lib/ibex/runtime/parser.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Runtime
|
|
5
|
+
# Raised by the default parser error handler.
|
|
6
|
+
class ParseError < StandardError
|
|
7
|
+
attr_reader token_id: Integer?
|
|
8
|
+
|
|
9
|
+
attr_reader token_name: String?
|
|
10
|
+
|
|
11
|
+
attr_reader token_value: untyped
|
|
12
|
+
|
|
13
|
+
attr_reader expected_tokens: Array[String]
|
|
14
|
+
|
|
15
|
+
attr_reader location: untyped
|
|
16
|
+
|
|
17
|
+
attr_reader state: Integer?
|
|
18
|
+
|
|
19
|
+
attr_reader suggestions: Array[String]
|
|
20
|
+
|
|
21
|
+
attr_reader error_id: String?
|
|
22
|
+
|
|
23
|
+
# 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
|
|
25
|
+
# 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
|
|
27
|
+
|
|
28
|
+
# @rbs () -> String
|
|
29
|
+
def location_label: () -> String
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
# @rbs () -> String
|
|
34
|
+
def diagnostic_message: () -> String
|
|
35
|
+
|
|
36
|
+
# @rbs (Symbol key) -> untyped
|
|
37
|
+
def location_value: (Symbol key) -> untyped
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Raised when a configured parser-session resource budget is exhausted.
|
|
41
|
+
class ResourceLimitError < ParseError
|
|
42
|
+
attr_reader resource: Symbol
|
|
43
|
+
|
|
44
|
+
attr_reader limit: Integer
|
|
45
|
+
|
|
46
|
+
attr_reader observed: Integer
|
|
47
|
+
|
|
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
|
+
|
|
51
|
+
# @rbs () -> Hash[Symbol, untyped]
|
|
52
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Drives a table-defined LR parser without native extensions.
|
|
56
|
+
#
|
|
57
|
+
# Subclasses provide `.parser_tables`, returning `:tokens`, `:token_names`,
|
|
58
|
+
# `:actions`, `:gotos`, and `:productions`, with optional
|
|
59
|
+
# `:default_actions`, `:error_messages`, and `:recovery_sync_tokens`.
|
|
60
|
+
# Actions are represented by
|
|
61
|
+
# `[:shift, state]`, `[:reduce, production]`, `[:accept]`, or `[:error]`.
|
|
62
|
+
# Format-v2 and newer generated production entries mark their five-argument
|
|
63
|
+
# semantic methods with `location_action: true`. Format-v3 and newer
|
|
64
|
+
# composed actions additionally use `composition_action: true` for the
|
|
65
|
+
# six-argument contract carrying the lookahead location. Format-v4
|
|
66
|
+
# location-free generated methods use `values_action: true` for a
|
|
67
|
+
# one-argument values contract. Format-v5 additionally marks proven-safe
|
|
68
|
+
# zero-to-four-value methods with `positional_action: true`. V1 and
|
|
69
|
+
# unmarked application actions retain the historical two-argument
|
|
70
|
+
# contract. Markers are honored only for the generated `_ibex_action_N`
|
|
71
|
+
# Symbol shape, never for callables.
|
|
72
|
+
class Parser
|
|
73
|
+
# Keep direct singleton-hook mutation visible even when an application
|
|
74
|
+
# replaces Ruby's mutation callbacks without calling super.
|
|
75
|
+
module FastPathMutationTracker
|
|
76
|
+
# @rbs (Ibex::Runtime::Parser parser, UnboundMethod lookup) -> bool
|
|
77
|
+
def self.effective_for?: (Ibex::Runtime::Parser parser, UnboundMethod lookup) -> bool
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
# @rbs (Symbol name) -> void
|
|
82
|
+
def singleton_method_added: (Symbol name) -> void
|
|
83
|
+
|
|
84
|
+
# @rbs (Symbol name) -> void
|
|
85
|
+
def singleton_method_removed: (Symbol name) -> void
|
|
86
|
+
|
|
87
|
+
# @rbs (Symbol name) -> void
|
|
88
|
+
def singleton_method_undefined: (Symbol name) -> void
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Invalidates the generated-class hook cache when the parser class
|
|
92
|
+
# changes its own effective hook surface.
|
|
93
|
+
module FastPathClassMutationTracker
|
|
94
|
+
# @rbs (Symbol name) -> void
|
|
95
|
+
def method_added: (Symbol name) -> void
|
|
96
|
+
|
|
97
|
+
# @rbs (Symbol name) -> void
|
|
98
|
+
def method_removed: (Symbol name) -> void
|
|
99
|
+
|
|
100
|
+
# @rbs (Symbol name) -> void
|
|
101
|
+
def method_undefined: (Symbol name) -> void
|
|
102
|
+
|
|
103
|
+
# @rbs (*Module modules) -> self
|
|
104
|
+
def include: (*Module modules) -> self
|
|
105
|
+
|
|
106
|
+
# @rbs (*Module modules) -> self
|
|
107
|
+
def prepend: (*Module modules) -> self
|
|
108
|
+
|
|
109
|
+
private
|
|
110
|
+
|
|
111
|
+
# @rbs (Symbol name) -> void
|
|
112
|
+
def __ibex_invalidate_fast_path_hooks: (Symbol name) -> void
|
|
113
|
+
|
|
114
|
+
# @rbs () -> void
|
|
115
|
+
def __ibex_bump_fast_path_hook_version: () -> void
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
include Observation
|
|
119
|
+
|
|
120
|
+
include ParserSyncRecovery
|
|
121
|
+
|
|
122
|
+
ParseError: singleton(Ibex::Runtime::ParseError)
|
|
123
|
+
|
|
124
|
+
EOF_TOKEN: Integer
|
|
125
|
+
|
|
126
|
+
ERROR_TOKEN: Integer
|
|
127
|
+
|
|
128
|
+
GENERATED_ACTION_NAME: Regexp
|
|
129
|
+
|
|
130
|
+
NO_LOOKAHEAD: Object
|
|
131
|
+
|
|
132
|
+
RECOVERY_SHIFTS: Integer
|
|
133
|
+
|
|
134
|
+
FAST_PATH_HOOK_NAMES: Array[Symbol]
|
|
135
|
+
|
|
136
|
+
FAST_PATH_HOOK_REFERENCES: Hash[Symbol, Symbol]
|
|
137
|
+
|
|
138
|
+
ERROR_ACTION: [ :error ]
|
|
139
|
+
|
|
140
|
+
SYNC_RECOVER_ACTION: [ :sync_recover ]
|
|
141
|
+
|
|
142
|
+
CONTINUE_OUTCOME: [ :continue ]
|
|
143
|
+
|
|
144
|
+
REPAIR_PENDING_OUTCOME: [ :repair_pending ]
|
|
145
|
+
|
|
146
|
+
TERMINAL_OUTCOMES: Array[Symbol]
|
|
147
|
+
|
|
148
|
+
COMPACT_ACCEPTED: Object
|
|
149
|
+
|
|
150
|
+
EMPTY_ROW: Hash[Integer, untyped]
|
|
151
|
+
|
|
152
|
+
EMPTY_LOCATION_NAMES: Hash[Symbol, Integer]
|
|
153
|
+
|
|
154
|
+
EMPTY_LOCATIONS: Array[untyped]
|
|
155
|
+
|
|
156
|
+
EMPTY_GREEN_TRIVIA: Array[CST::GreenTrivia]
|
|
157
|
+
|
|
158
|
+
@unknown_token_id: Integer?
|
|
159
|
+
|
|
160
|
+
@unknown_token_name: String?
|
|
161
|
+
|
|
162
|
+
@push_status: :idle | :active | :finished
|
|
163
|
+
|
|
164
|
+
@driver_status: :idle | :pull | :push
|
|
165
|
+
|
|
166
|
+
@runtime_driver_thread: Thread?
|
|
167
|
+
|
|
168
|
+
@runtime_observers: Hash[Observation::Subscription, Proc]?
|
|
169
|
+
|
|
170
|
+
@runtime_event_sequence: Integer
|
|
171
|
+
|
|
172
|
+
@runtime_lookahead_token_display: untyped
|
|
173
|
+
|
|
174
|
+
@runtime_observation_mutex: Mutex
|
|
175
|
+
|
|
176
|
+
@repair_policy: RepairPolicy?
|
|
177
|
+
|
|
178
|
+
@repair_input_buffer: Array[RepairInput]?
|
|
179
|
+
|
|
180
|
+
@repair_selected: bool
|
|
181
|
+
|
|
182
|
+
@semantic_locations: Array[untyped]?
|
|
183
|
+
|
|
184
|
+
@incremental_reused_descendants: Integer
|
|
185
|
+
|
|
186
|
+
@accept_requested: bool
|
|
187
|
+
|
|
188
|
+
@semantic_error: bool
|
|
189
|
+
|
|
190
|
+
@recovery_shifts: Integer
|
|
191
|
+
|
|
192
|
+
@lookahead_location: untyped
|
|
193
|
+
|
|
194
|
+
@lookahead_value: untyped
|
|
195
|
+
|
|
196
|
+
@lookahead: untyped
|
|
197
|
+
|
|
198
|
+
@location_stack: Array[untyped]?
|
|
199
|
+
|
|
200
|
+
@racc_vstack: Array[untyped]
|
|
201
|
+
|
|
202
|
+
@vstack: Array[untyped]
|
|
203
|
+
|
|
204
|
+
@value_stack: Array[untyped]
|
|
205
|
+
|
|
206
|
+
@state_stack: Array[Integer]
|
|
207
|
+
|
|
208
|
+
@source: untyped
|
|
209
|
+
|
|
210
|
+
@yydebug_output: IO
|
|
211
|
+
|
|
212
|
+
@yydebug: bool
|
|
213
|
+
|
|
214
|
+
@green_reused_right_edge: bool
|
|
215
|
+
|
|
216
|
+
@syntax_parse_memo: CST::ParseMemo?
|
|
217
|
+
|
|
218
|
+
@green_initial_state: Integer
|
|
219
|
+
|
|
220
|
+
@green_parse_memo_valid: bool
|
|
221
|
+
|
|
222
|
+
@green_memo_stack: Array[CST::ParseMemo::Entry]
|
|
223
|
+
|
|
224
|
+
@green_token_states: Array[Symbol]
|
|
225
|
+
|
|
226
|
+
@green_cache_override: CST::NodeCache?
|
|
227
|
+
|
|
228
|
+
@syntax_only: bool
|
|
229
|
+
|
|
230
|
+
@runtime_fast_path_singleton_ancestors: Array[Module]?
|
|
231
|
+
|
|
232
|
+
@runtime_fast_path_hooks_mutated: bool
|
|
233
|
+
|
|
234
|
+
@runtime_fast_path_tracker_installed: bool
|
|
235
|
+
|
|
236
|
+
@runtime_fast_path: bool
|
|
237
|
+
|
|
238
|
+
@runtime_parser_tables: Hash[Symbol, untyped]?
|
|
239
|
+
|
|
240
|
+
@recovery_attempts: Integer
|
|
241
|
+
|
|
242
|
+
@resource_limits: ResourceLimits
|
|
243
|
+
|
|
244
|
+
@green_pending_skipped: Array[CST::GreenTrivia]
|
|
245
|
+
|
|
246
|
+
@syntax_diagnostics: Array[untyped]
|
|
247
|
+
|
|
248
|
+
@syntax_root: CST::SyntaxNode?
|
|
249
|
+
|
|
250
|
+
@green_cache: CST::NodeCache?
|
|
251
|
+
|
|
252
|
+
@green_kinds: CST::Kind?
|
|
253
|
+
|
|
254
|
+
@green_builder: CST::GreenBuilder?
|
|
255
|
+
|
|
256
|
+
@sync_recovery_observers: Array[Proc]?
|
|
257
|
+
|
|
258
|
+
@sync_recovery_token_data: Hash[String, untyped]?
|
|
259
|
+
|
|
260
|
+
@sync_recovery_context: Hash[Symbol, untyped]?
|
|
261
|
+
|
|
262
|
+
@trace_value_printer: (^(untyped) -> untyped)?
|
|
263
|
+
|
|
264
|
+
@semantic_result_location: untyped
|
|
265
|
+
|
|
266
|
+
@semantic_location_names: Hash[Symbol, Integer]?
|
|
267
|
+
|
|
268
|
+
attr_reader syntax_parse_memo: CST::ParseMemo?
|
|
269
|
+
|
|
270
|
+
attr_reader incremental_reused_descendants: Integer
|
|
271
|
+
|
|
272
|
+
# Start a syntax-only incremental session backed by a generated lexer.
|
|
273
|
+
# @rbs (CST::SourceText source_text, ?resource_limits: ResourceLimits?, ?blender: bool) ->
|
|
274
|
+
# CST::IncrementalParseSession
|
|
275
|
+
def self.incremental_session: (CST::SourceText source_text, ?resource_limits: ResourceLimits?, ?blender: bool) -> CST::IncrementalParseSession
|
|
276
|
+
|
|
277
|
+
# @rbs (?resource_limits: ResourceLimits) -> void
|
|
278
|
+
def initialize: (?resource_limits: ResourceLimits) -> void
|
|
279
|
+
|
|
280
|
+
# @rbs () -> bool
|
|
281
|
+
def yydebug: () -> bool
|
|
282
|
+
|
|
283
|
+
# @rbs (bool enabled) -> bool
|
|
284
|
+
def yydebug=: (bool enabled) -> bool
|
|
285
|
+
|
|
286
|
+
# @rbs (IO output) -> IO
|
|
287
|
+
def yydebug_output=: (IO output) -> IO
|
|
288
|
+
|
|
289
|
+
# @rbs () -> RepairPolicy?
|
|
290
|
+
def repair_policy: () -> RepairPolicy?
|
|
291
|
+
|
|
292
|
+
# @rbs () -> ResourceLimits
|
|
293
|
+
def resource_limits: () -> ResourceLimits
|
|
294
|
+
|
|
295
|
+
# Enable bounded automatic repair for the next parser session.
|
|
296
|
+
# Assign nil to restore the compatible yacc-only behavior.
|
|
297
|
+
# @rbs (RepairPolicy? policy) -> RepairPolicy?
|
|
298
|
+
def repair_policy=: (RepairPolicy? policy) -> RepairPolicy?
|
|
299
|
+
|
|
300
|
+
# Replace the limits used by future sessions.
|
|
301
|
+
# @rbs (ResourceLimits limits) -> ResourceLimits
|
|
302
|
+
def resource_limits=: (ResourceLimits limits) -> ResourceLimits
|
|
303
|
+
|
|
304
|
+
# Pull tokens from `next_token` and parse them.
|
|
305
|
+
# @rbs () -> untyped
|
|
306
|
+
def do_parse: () -> untyped
|
|
307
|
+
|
|
308
|
+
# Parse through `next_token` and return both the semantic value and Red root.
|
|
309
|
+
# @rbs () -> CST::ParseResult
|
|
310
|
+
def parse_with_syntax: () -> CST::ParseResult
|
|
311
|
+
|
|
312
|
+
# Return the Red source-file root built by the most recent CST parse.
|
|
313
|
+
# @rbs () -> CST::SyntaxNode?
|
|
314
|
+
def syntax_root: () -> CST::SyntaxNode?
|
|
315
|
+
|
|
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
|
|
319
|
+
|
|
320
|
+
# Supply one token to a caller-driven parser session.
|
|
321
|
+
# Returns `:need_more` after consuming it, `[:accepted, result]` after
|
|
322
|
+
# 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 ])
|
|
327
|
+
|
|
328
|
+
# Supply EOF to a caller-driven parser session and return its result.
|
|
329
|
+
# @rbs (?location: untyped) -> untyped
|
|
330
|
+
def finish: (?location: untyped) -> untyped
|
|
331
|
+
|
|
332
|
+
# Discard a caller-driven session so this parser can accept a new one.
|
|
333
|
+
# @rbs () -> nil
|
|
334
|
+
def reset_push: () -> nil
|
|
335
|
+
|
|
336
|
+
# Override in pull parsers. Return `[token, value]`,
|
|
337
|
+
# `[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)
|
|
340
|
+
|
|
341
|
+
# Override to recover from syntax errors. The default raises unless a
|
|
342
|
+
# 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
|
|
345
|
+
|
|
346
|
+
# Called after an ordinary input token is shifted. Override to observe
|
|
347
|
+
# 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
|
|
350
|
+
|
|
351
|
+
# Location-aware shift observer. The compatible hook above retains its
|
|
352
|
+
# 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
|
|
355
|
+
|
|
356
|
+
# Called after a production's semantic action and goto are committed.
|
|
357
|
+
# 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
|
|
360
|
+
|
|
361
|
+
# 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
|
|
365
|
+
|
|
366
|
+
# Called after the synthetic error token enters a recovery state.
|
|
367
|
+
# 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
|
|
370
|
+
|
|
371
|
+
# 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
|
|
375
|
+
|
|
376
|
+
# 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
|
|
379
|
+
|
|
380
|
+
# 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)?
|
|
383
|
+
|
|
384
|
+
# Called once after a repair is selected and before its edited token
|
|
385
|
+
# prefix is replayed through normal parser actions.
|
|
386
|
+
# @rbs (RepairPlan plan) -> void
|
|
387
|
+
def on_repair: (RepairPlan plan) -> void
|
|
388
|
+
|
|
389
|
+
# Return a human-readable name for an internal token id.
|
|
390
|
+
# @rbs (Integer token_id) -> String
|
|
391
|
+
def token_to_str: (Integer token_id) -> String
|
|
392
|
+
|
|
393
|
+
# Enter error recovery from a semantic action without calling `on_error`.
|
|
394
|
+
# @rbs () -> nil
|
|
395
|
+
def yyerror: () -> nil
|
|
396
|
+
|
|
397
|
+
# Leave error recovery immediately.
|
|
398
|
+
# @rbs () -> nil
|
|
399
|
+
def yyerrok: () -> nil
|
|
400
|
+
|
|
401
|
+
# Accept immediately after the current semantic action completes.
|
|
402
|
+
# @rbs () -> nil
|
|
403
|
+
def yyaccept: () -> nil
|
|
404
|
+
|
|
405
|
+
# Return token names accepted in the current parser state.
|
|
406
|
+
# @rbs () -> Array[String]
|
|
407
|
+
def expected_tokens: () -> Array[String]
|
|
408
|
+
|
|
409
|
+
# Return token names that survive all required default reductions.
|
|
410
|
+
# Semantic actions are not evaluated during this lookahead correction.
|
|
411
|
+
# @rbs () -> Array[String]
|
|
412
|
+
def expected_tokens_exact: () -> Array[String]
|
|
413
|
+
|
|
414
|
+
# Return the location of a one-based RHS position or named reference
|
|
415
|
+
# while a semantic action is running.
|
|
416
|
+
# @rbs (Integer | Symbol | String reference) -> untyped
|
|
417
|
+
def loc: (Integer | Symbol | String reference) -> untyped
|
|
418
|
+
|
|
419
|
+
# Return the synthesized span of the reduction being evaluated.
|
|
420
|
+
# @rbs () -> untyped
|
|
421
|
+
def result_loc: () -> untyped
|
|
422
|
+
|
|
423
|
+
private
|
|
424
|
+
|
|
425
|
+
alias __ibex_fast_path_on_shift on_shift
|
|
426
|
+
|
|
427
|
+
alias __ibex_fast_path_on_shift_location on_shift_location
|
|
428
|
+
|
|
429
|
+
alias __ibex_fast_path_on_reduce on_reduce
|
|
430
|
+
|
|
431
|
+
alias __ibex_fast_path_on_reduce_location on_reduce_location
|
|
432
|
+
|
|
433
|
+
alias __ibex_fast_path_token_to_str token_to_str
|
|
434
|
+
|
|
435
|
+
# Racc-generated parsers commonly define an application initializer
|
|
436
|
+
# without calling super. Complete only missing runtime state so those
|
|
437
|
+
# initializers retain values they deliberately configured.
|
|
438
|
+
# @rbs () -> void
|
|
439
|
+
def ensure_runtime_initialized!: () -> void
|
|
440
|
+
|
|
441
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
442
|
+
# The explicit branches keep every runtime ivar typed while preserving application-owned values.
|
|
443
|
+
# @rbs (ResourceLimits resource_limits, preserve_existing: bool) -> void
|
|
444
|
+
def initialize_runtime_state: (ResourceLimits resource_limits, preserve_existing: bool) -> void
|
|
445
|
+
|
|
446
|
+
# @rbs (ResourceLimits resource_limits) -> void
|
|
447
|
+
def validate_resource_limits!: (ResourceLimits resource_limits) -> void
|
|
448
|
+
|
|
449
|
+
# Keep the two historical value-stack names as read-compatible aliases.
|
|
450
|
+
# Applications must not mutate or replace these internal arrays.
|
|
451
|
+
# @rbs (Array[untyped] values) -> void
|
|
452
|
+
def install_value_stack: (Array[untyped] values) -> void
|
|
453
|
+
|
|
454
|
+
# @rbs (Integer token_id) -> bool
|
|
455
|
+
def exact_lookahead_accepted?: (Integer token_id) -> bool
|
|
456
|
+
|
|
457
|
+
# @rbs (Integer stack_depth) -> Integer
|
|
458
|
+
def exact_lookahead_step_budget: (Integer stack_depth) -> Integer
|
|
459
|
+
|
|
460
|
+
# @rbs (Hash[Symbol, untyped] tables) -> Integer
|
|
461
|
+
def parser_state_count: (Hash[Symbol, untyped] tables) -> Integer
|
|
462
|
+
|
|
463
|
+
# @rbs (Array[Integer] stack, Integer production_id) -> bool
|
|
464
|
+
def exact_reduction_applied?: (Array[Integer] stack, Integer production_id) -> bool
|
|
465
|
+
|
|
466
|
+
# @rbs (untyped source, ?initial_state: Integer?) -> untyped
|
|
467
|
+
def drive_parser: (untyped source, ?initial_state: Integer?) -> untyped
|
|
468
|
+
|
|
469
|
+
# Generated compact tables can keep the unobserved, location-free pull
|
|
470
|
+
# loop on their frozen displacement arrays. Any extension boundary or
|
|
471
|
+
# exceptional table shape returns control to the generic driver without
|
|
472
|
+
# replaying a committed action.
|
|
473
|
+
# rubocop:disable Metrics/AbcSize, Metrics/BlockNesting, Metrics/CyclomaticComplexity
|
|
474
|
+
# rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
475
|
+
# Direct comparisons avoid predicate-method dispatch inside the parser loop.
|
|
476
|
+
# 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 ])?
|
|
479
|
+
|
|
480
|
+
# @rbs (Hash[Symbol, untyped]? tables) -> bool
|
|
481
|
+
def compact_fast_driver_eligible?: (Hash[Symbol, untyped]? tables) -> bool
|
|
482
|
+
|
|
483
|
+
# @rbs () -> void
|
|
484
|
+
def start_push_session: () -> void
|
|
485
|
+
|
|
486
|
+
# @rbs () -> (:need_more | [:accepted, untyped] | [:rejected, untyped])
|
|
487
|
+
def run_push_lookahead: () -> (:need_more | [ :accepted, untyped ] | [ :rejected, untyped ])
|
|
488
|
+
|
|
489
|
+
# @rbs () { () -> untyped } -> untyped
|
|
490
|
+
def run_push_driver: () { () -> untyped } -> untyped
|
|
491
|
+
|
|
492
|
+
# @rbs () -> void
|
|
493
|
+
def ensure_driver_available_without_lock!: () -> void
|
|
494
|
+
|
|
495
|
+
# @rbs () -> void
|
|
496
|
+
def release_driver: () -> void
|
|
497
|
+
|
|
498
|
+
# @rbs () -> void
|
|
499
|
+
def finish_push_session: () -> void
|
|
500
|
+
|
|
501
|
+
# @rbs ((^() -> untyped)? source, ?initial_state: Integer?) -> void
|
|
502
|
+
def prepare_parse: ((^() -> untyped)? source, ?initial_state: Integer?) -> void
|
|
503
|
+
|
|
504
|
+
# @rbs () -> void
|
|
505
|
+
def reset_parse_recovery_state: () -> void
|
|
506
|
+
|
|
507
|
+
# @rbs (Hash[Symbol, untyped] tables, Integer? requested) -> Integer
|
|
508
|
+
def resolve_initial_state: (Hash[Symbol, untyped] tables, Integer? requested) -> Integer
|
|
509
|
+
|
|
510
|
+
# @rbs () -> Hash[Symbol, untyped]
|
|
511
|
+
def validate_parser_table_format!: () -> Hash[Symbol, untyped]
|
|
512
|
+
|
|
513
|
+
# @rbs (Hash[Symbol, untyped] tables, Integer actual) -> void
|
|
514
|
+
def validate_current_cst_tables!: (Hash[Symbol, untyped] tables, Integer actual) -> void
|
|
515
|
+
|
|
516
|
+
# Generated parser tables are deeply frozen before they can cross a
|
|
517
|
+
# Ractor boundary. Their action-marker contract only needs one scan per
|
|
518
|
+
# parser class and exact table object, including across parser instances.
|
|
519
|
+
# Mutable application tables remain intentionally uncached.
|
|
520
|
+
# @rbs (Hash[Symbol, untyped] tables) -> bool
|
|
521
|
+
def generated_action_contracts_validated?: (Hash[Symbol, untyped] tables) -> bool
|
|
522
|
+
|
|
523
|
+
# @rbs (Hash[Symbol, untyped] tables) -> void
|
|
524
|
+
def cache_generated_action_contracts!: (Hash[Symbol, untyped] tables) -> void
|
|
525
|
+
|
|
526
|
+
# Ruby 3.0-3.3 expose the main Ractor as an object instead of exposing
|
|
527
|
+
# Ractor.main?. Class instance variables cannot be read or written from
|
|
528
|
+
# another Ractor on those versions.
|
|
529
|
+
# @rbs () -> bool
|
|
530
|
+
def generated_action_contract_cache_accessible?: () -> bool
|
|
531
|
+
|
|
532
|
+
# @rbs (Hash[Symbol, untyped] tables, Integer version) -> void
|
|
533
|
+
def validate_generated_action_contracts!: (Hash[Symbol, untyped] tables, Integer version) -> void
|
|
534
|
+
|
|
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
|
|
537
|
+
|
|
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
|
|
540
|
+
|
|
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
|
|
543
|
+
|
|
544
|
+
# @rbs (Hash[Symbol, untyped] production) -> bool
|
|
545
|
+
def positional_action_contract?: (Hash[Symbol, untyped] production) -> bool
|
|
546
|
+
|
|
547
|
+
# @rbs () -> untyped
|
|
548
|
+
def action_for_current_state: () -> untyped
|
|
549
|
+
|
|
550
|
+
# @rbs (untyped action) -> untyped
|
|
551
|
+
def perform: (untyped action) -> untyped
|
|
552
|
+
|
|
553
|
+
# @rbs (Integer next_state) -> [:continue]
|
|
554
|
+
def fast_shift: (Integer next_state) -> [ :continue ]
|
|
555
|
+
|
|
556
|
+
# @rbs (Hash[Symbol, untyped] production, untyped length) -> bool
|
|
557
|
+
def fast_reduction_eligible?: (Hash[Symbol, untyped] production, untyped length) -> bool
|
|
558
|
+
|
|
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 ]
|
|
561
|
+
|
|
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
|
|
564
|
+
|
|
565
|
+
# @rbs (Integer next_state) -> untyped
|
|
566
|
+
def shift: (Integer next_state) -> untyped
|
|
567
|
+
|
|
568
|
+
# @rbs (Integer production_id, ?Hash[Symbol, untyped]? prefetched_production) -> untyped
|
|
569
|
+
def reduce: (Integer production_id, ?Hash[Symbol, untyped]? prefetched_production) -> untyped
|
|
570
|
+
|
|
571
|
+
# @rbs (Integer next_state, untyped result, untyped location) -> void
|
|
572
|
+
def push_reduction_result: (Integer next_state, untyped result, untyped location) -> void
|
|
573
|
+
|
|
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
|
|
576
|
+
|
|
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]?
|
|
581
|
+
|
|
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]
|
|
586
|
+
|
|
587
|
+
# @rbs (untyped result) -> [:accepted, untyped]
|
|
588
|
+
def accept_reduction: (untyped result) -> [ :accepted, untyped ]
|
|
589
|
+
|
|
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
|
|
593
|
+
|
|
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
|
|
597
|
+
|
|
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
|
|
601
|
+
|
|
602
|
+
# @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
603
|
+
def generated_location_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
604
|
+
|
|
605
|
+
# @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
606
|
+
def generated_values_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
607
|
+
|
|
608
|
+
# @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
609
|
+
def generated_positional_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
610
|
+
|
|
611
|
+
# @rbs (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
612
|
+
def generated_composition_action?: (Hash[Symbol, untyped] production, untyped action) -> bool
|
|
613
|
+
|
|
614
|
+
# @rbs (untyped action) -> bool
|
|
615
|
+
def generated_action_symbol?: (untyped action) -> bool
|
|
616
|
+
|
|
617
|
+
# @rbs () -> bool
|
|
618
|
+
def cst_enabled?: () -> bool
|
|
619
|
+
|
|
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
|
|
622
|
+
|
|
623
|
+
# @rbs (untyped value) -> untyped
|
|
624
|
+
def finalize_cst: (untyped value) -> untyped
|
|
625
|
+
|
|
626
|
+
# @rbs () -> nil
|
|
627
|
+
def failed_cst: () -> nil
|
|
628
|
+
|
|
629
|
+
# @rbs (ParseError error) -> nil
|
|
630
|
+
def cst_lexical_failure: (ParseError error) -> nil
|
|
631
|
+
|
|
632
|
+
# @rbs (untyped location, Symbol key) -> untyped
|
|
633
|
+
def cst_location_value: (untyped location, Symbol key) -> untyped
|
|
634
|
+
|
|
635
|
+
# @rbs (Hash[Symbol, untyped] tables) -> void
|
|
636
|
+
def prepare_green_cst: (Hash[Symbol, untyped] tables) -> void
|
|
637
|
+
|
|
638
|
+
# @rbs (Hash[Symbol, untyped] tables) -> void
|
|
639
|
+
def reset_cst_results: (Hash[Symbol, untyped] tables) -> void
|
|
640
|
+
|
|
641
|
+
# 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
|
|
644
|
+
|
|
645
|
+
# @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,
|
|
647
|
+
# 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
|
|
649
|
+
|
|
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
|
|
652
|
+
|
|
653
|
+
# @rbs (untyped value, untyped location) -> String
|
|
654
|
+
def green_token_text: (untyped value, untyped location) -> String
|
|
655
|
+
|
|
656
|
+
# @rbs (untyped location, Symbol key) -> Array[CST::GreenTrivia]
|
|
657
|
+
def green_location_trivia: (untyped location, Symbol key) -> Array[CST::GreenTrivia]
|
|
658
|
+
|
|
659
|
+
# @rbs (untyped value) -> untyped
|
|
660
|
+
def finalize_red_green_cst: (untyped value) -> untyped
|
|
661
|
+
|
|
662
|
+
# @rbs () -> void
|
|
663
|
+
def finalize_failed_green_cst: () -> void
|
|
664
|
+
|
|
665
|
+
# @rbs (ParseError error) -> void
|
|
666
|
+
def finalize_lexical_green_cst: (ParseError error) -> void
|
|
667
|
+
|
|
668
|
+
# @rbs () -> Array[CST::GreenTrivia]
|
|
669
|
+
def pending_green_trivia: () -> Array[CST::GreenTrivia]
|
|
670
|
+
|
|
671
|
+
# @rbs (CST::GreenNode green, CST::Kind kinds, ?file: String?) -> void
|
|
672
|
+
def install_syntax_root: (CST::GreenNode green, CST::Kind kinds, ?file: String?) -> void
|
|
673
|
+
|
|
674
|
+
# @rbs (untyped value) -> CST::ParseResult
|
|
675
|
+
def syntax_parse_result: (untyped value) -> CST::ParseResult
|
|
676
|
+
|
|
677
|
+
# @rbs () -> Array[Symbol]
|
|
678
|
+
def syntax_token_states: () -> Array[Symbol]
|
|
679
|
+
|
|
680
|
+
# @rbs (CST::GreenNode green) -> void
|
|
681
|
+
def install_parse_memo: (CST::GreenNode green) -> void
|
|
682
|
+
|
|
683
|
+
# @rbs (untyped location) -> Symbol
|
|
684
|
+
def green_lexer_state: (untyped location) -> Symbol
|
|
685
|
+
|
|
686
|
+
# @rbs (CST::NodeCache cache) { () -> untyped } -> untyped
|
|
687
|
+
def with_syntax_only: (CST::NodeCache cache) { () -> untyped } -> untyped
|
|
688
|
+
|
|
689
|
+
# @rbs (untyped source, CST::NodeCache cache) -> CST::SyntaxResult
|
|
690
|
+
def parse_syntax_token_source: (untyped source, CST::NodeCache cache) -> CST::SyntaxResult
|
|
691
|
+
|
|
692
|
+
# @rbs (CST::ReusableSubtree subtree) -> void
|
|
693
|
+
def push_reusable_green_subtree: (CST::ReusableSubtree subtree) -> void
|
|
694
|
+
|
|
695
|
+
# @rbs (Symbol type, Hash[untyped, untyped] data) -> void
|
|
696
|
+
def emit_incremental_event: (Symbol type, Hash[untyped, untyped] data) -> void
|
|
697
|
+
|
|
698
|
+
# @rbs () -> void
|
|
699
|
+
def discard_green_lookahead: () -> void
|
|
700
|
+
|
|
701
|
+
# @rbs (?report: bool) -> untyped
|
|
702
|
+
def recover: (?report: bool) -> untyped
|
|
703
|
+
|
|
704
|
+
# @rbs () -> untyped
|
|
705
|
+
def continue_recovery: () -> untyped
|
|
706
|
+
|
|
707
|
+
# @rbs () -> [:done, nil]
|
|
708
|
+
def reject_recovery_eof: () -> [ :done, nil ]
|
|
709
|
+
|
|
710
|
+
# @rbs (String token_display) -> Hash[String, untyped]
|
|
711
|
+
def runtime_discard_data: (String token_display) -> Hash[String, untyped]
|
|
712
|
+
|
|
713
|
+
# @rbs (bool report) -> untyped
|
|
714
|
+
def begin_recovery: (bool report) -> untyped
|
|
715
|
+
|
|
716
|
+
# @rbs (bool report) -> Hash[Symbol, untyped]
|
|
717
|
+
def recovery_context: (bool report) -> Hash[Symbol, untyped]
|
|
718
|
+
|
|
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]? ]
|
|
721
|
+
|
|
722
|
+
# @rbs (Hash[Symbol, untyped] context, untyped repair) -> void
|
|
723
|
+
def notify_error_handler: (Hash[Symbol, untyped] context, untyped repair) -> void
|
|
724
|
+
|
|
725
|
+
# @rbs (RepairPlan repair) -> [:continue]
|
|
726
|
+
def commit_repair: (RepairPlan repair) -> [ :continue ]
|
|
727
|
+
|
|
728
|
+
# @rbs (Hash[Symbol, untyped] context, Hash[String, untyped]? token_data,
|
|
729
|
+
# Array[Proc]? recovery_observers) -> untyped
|
|
730
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
731
|
+
# 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
|
|
733
|
+
|
|
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]
|
|
737
|
+
|
|
738
|
+
# @rbs (untyped token_id, untyped token_display, untyped value, untyped location,
|
|
739
|
+
# Integer original_state, Hash[String, untyped]? token_data,
|
|
740
|
+
# 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 ]
|
|
742
|
+
|
|
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,
|
|
745
|
+
# 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 ]
|
|
747
|
+
|
|
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]
|
|
751
|
+
|
|
752
|
+
# @rbs () -> Hash[String, untyped]
|
|
753
|
+
def runtime_current_token_data: () -> Hash[String, untyped]
|
|
754
|
+
|
|
755
|
+
# @rbs (untyped result_summary, String reason) -> void
|
|
756
|
+
def emit_accept_event: (untyped result_summary, String reason) -> void
|
|
757
|
+
|
|
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
|
|
760
|
+
|
|
761
|
+
# @rbs () -> bool
|
|
762
|
+
def shift_error_token: () -> bool
|
|
763
|
+
|
|
764
|
+
# @rbs () -> void
|
|
765
|
+
def ensure_stack_capacity!: () -> void
|
|
766
|
+
|
|
767
|
+
# @rbs () -> void
|
|
768
|
+
def consume_recovery_attempt!: () -> void
|
|
769
|
+
|
|
770
|
+
# @rbs () -> (RepairPlan | Object | nil)
|
|
771
|
+
def selected_repair: () -> (RepairPlan | Object | nil)
|
|
772
|
+
|
|
773
|
+
# @rbs (RepairPolicy policy) -> [Array[RepairInput], bool]
|
|
774
|
+
def repair_search_tokens: (RepairPolicy policy) -> [ Array[RepairInput], bool ]
|
|
775
|
+
|
|
776
|
+
# @rbs (RepairPlan plan) -> void
|
|
777
|
+
def apply_repair: (RepairPlan plan) -> void
|
|
778
|
+
|
|
779
|
+
# @rbs () -> RepairInput
|
|
780
|
+
def current_repair_input: () -> RepairInput
|
|
781
|
+
|
|
782
|
+
# @rbs (Array[RepairInput] source, Array[RepairEdit] edits) -> Array[RepairInput]
|
|
783
|
+
def replay_repair_edits: (Array[RepairInput] source, Array[RepairEdit] edits) -> Array[RepairInput]
|
|
784
|
+
|
|
785
|
+
# @rbs (Array[RepairInput] output, RepairInput input, Array[RepairEdit] edits) -> bool
|
|
786
|
+
def append_repair_edits: (Array[RepairInput] output, RepairInput input, Array[RepairEdit] edits) -> bool
|
|
787
|
+
|
|
788
|
+
# Retain a repair deletion in the concrete tree even though it is absent
|
|
789
|
+
# from the repaired token stream.
|
|
790
|
+
# @rbs (RepairInput input) -> void
|
|
791
|
+
def preserve_deleted_repair_input: (RepairInput input) -> void
|
|
792
|
+
|
|
793
|
+
# @rbs () -> void
|
|
794
|
+
def clear_repair_lookahead: () -> void
|
|
795
|
+
|
|
796
|
+
# @rbs (RepairEdit edit, value: untyped, location: untyped) -> RepairInput
|
|
797
|
+
def synthetic_repair_input: (RepairEdit edit, value: untyped, location: untyped) -> RepairInput
|
|
798
|
+
|
|
799
|
+
# @rbs (untyped location, Symbol kind) -> Hash[Symbol, untyped]
|
|
800
|
+
def cst_repair_location: (untyped location, Symbol kind) -> Hash[Symbol, untyped]
|
|
801
|
+
|
|
802
|
+
# @rbs (RepairPlan plan) -> String
|
|
803
|
+
def repair_trace: (RepairPlan plan) -> String
|
|
804
|
+
|
|
805
|
+
# @rbs () -> void
|
|
806
|
+
def read_lookahead: () -> void
|
|
807
|
+
|
|
808
|
+
# @rbs () -> void
|
|
809
|
+
def read_repair_lookahead: () -> void
|
|
810
|
+
|
|
811
|
+
# @rbs () -> void
|
|
812
|
+
def read_compatible_lookahead: () -> void
|
|
813
|
+
|
|
814
|
+
# @rbs () -> void
|
|
815
|
+
def materialize_compatible_lookahead: () -> void
|
|
816
|
+
|
|
817
|
+
# @rbs () -> String
|
|
818
|
+
def materialize_lookahead_token_display!: () -> String
|
|
819
|
+
|
|
820
|
+
# @rbs (untyped external_token, untyped value, untyped location) -> RepairInput
|
|
821
|
+
def repair_input: (untyped external_token, untyped value, untyped location) -> RepairInput
|
|
822
|
+
|
|
823
|
+
# @rbs (untyped token) -> RepairInput
|
|
824
|
+
def repair_input_from_external: (untyped token) -> RepairInput
|
|
825
|
+
|
|
826
|
+
# @rbs (RepairInput input) -> void
|
|
827
|
+
def enqueue_or_assign_repair_input: (RepairInput input) -> void
|
|
828
|
+
|
|
829
|
+
# @rbs (RepairInput input) -> void
|
|
830
|
+
def assign_repair_input: (RepairInput input) -> void
|
|
831
|
+
|
|
832
|
+
# @rbs () -> untyped
|
|
833
|
+
def read_external_token: () -> untyped
|
|
834
|
+
|
|
835
|
+
# @rbs (untyped external_token) -> Integer
|
|
836
|
+
def internal_token_id: (untyped external_token) -> Integer
|
|
837
|
+
|
|
838
|
+
# @rbs () -> Hash[Symbol, untyped]
|
|
839
|
+
def parser_tables: () -> Hash[Symbol, untyped]
|
|
840
|
+
|
|
841
|
+
# @rbs () -> Hash[Symbol, untyped]
|
|
842
|
+
def load_parser_tables: () -> Hash[Symbol, untyped]
|
|
843
|
+
|
|
844
|
+
# @rbs (untyped action) -> bool
|
|
845
|
+
def error_action?: (untyped action) -> bool
|
|
846
|
+
|
|
847
|
+
# @rbs (untyped configured) -> [String?, String?]
|
|
848
|
+
def configured_error_message: (untyped configured) -> [ String?, String? ]
|
|
849
|
+
|
|
850
|
+
# @rbs (String actual, Array[String] expected) -> Array[String]
|
|
851
|
+
def token_suggestions: (String actual, Array[String] expected) -> Array[String]
|
|
852
|
+
|
|
853
|
+
# @rbs (String token_name) -> String?
|
|
854
|
+
def normalized_token_word: (String token_name) -> String?
|
|
855
|
+
|
|
856
|
+
# @rbs (String left, String right) -> Integer
|
|
857
|
+
def edit_distance: (String left, String right) -> Integer
|
|
858
|
+
|
|
859
|
+
# @rbs (Integer state) -> untyped
|
|
860
|
+
def default_action: (Integer state) -> untyped
|
|
861
|
+
|
|
862
|
+
# @rbs (Hash[Symbol, untyped] tables) -> bool
|
|
863
|
+
def track_locations?: (Hash[Symbol, untyped] tables) -> bool
|
|
864
|
+
|
|
865
|
+
# @rbs (Hash[Symbol, untyped] tables) -> void
|
|
866
|
+
def initialize_runtime_fast_path: (Hash[Symbol, untyped] tables) -> void
|
|
867
|
+
|
|
868
|
+
# @rbs (?Class? singleton) -> void
|
|
869
|
+
def install_runtime_fast_path_tracker!: (?Class? singleton) -> void
|
|
870
|
+
|
|
871
|
+
# @rbs () -> void
|
|
872
|
+
def install_runtime_fast_path_class_tracker!: () -> void
|
|
873
|
+
|
|
874
|
+
# The generic driver remains authoritative whenever a public runtime
|
|
875
|
+
# 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
|
|
878
|
+
|
|
879
|
+
# @rbs () -> bool
|
|
880
|
+
def runtime_fast_path_hooks_eligible?: () -> bool
|
|
881
|
+
|
|
882
|
+
# @rbs () -> bool?
|
|
883
|
+
def cached_runtime_fast_path_hooks_eligibility: () -> bool?
|
|
884
|
+
|
|
885
|
+
# @rbs () -> bool
|
|
886
|
+
def runtime_fast_path_class_hooks_eligible?: () -> bool
|
|
887
|
+
|
|
888
|
+
# @rbs (UnboundMethod lookup, Symbol name, Symbol reference) -> bool
|
|
889
|
+
def runtime_method_unchanged?: (UnboundMethod lookup, Symbol name, Symbol reference) -> bool
|
|
890
|
+
|
|
891
|
+
# Ruby 3.0 and 3.1 do not preserve UnboundMethod#== for an inherited
|
|
892
|
+
# method and its alias even though both still identify the same body.
|
|
893
|
+
# @rbs (Method | UnboundMethod implementation, Method | UnboundMethod expected) -> bool
|
|
894
|
+
def runtime_methods_equivalent?: (Method | UnboundMethod implementation, Method | UnboundMethod expected) -> bool
|
|
895
|
+
|
|
896
|
+
# Bypass an application-defined `method` helper while retaining Ruby's
|
|
897
|
+
# complete singleton/prepend/subclass lookup semantics.
|
|
898
|
+
# @rbs (UnboundMethod lookup, Symbol name) -> Method?
|
|
899
|
+
def runtime_core_method: (UnboundMethod lookup, Symbol name) -> Method?
|
|
900
|
+
|
|
901
|
+
# Re-check after lexer and semantic-action callbacks because those are
|
|
902
|
+
# supported points at which an application can install instrumentation.
|
|
903
|
+
# A disabled fast path never becomes active again within the session.
|
|
904
|
+
# @rbs () -> void
|
|
905
|
+
def refresh_runtime_fast_path_after_user_code!: () -> void
|
|
906
|
+
|
|
907
|
+
# Keep allocation out of the ordinary two-element lexer path. If a
|
|
908
|
+
# location first appears after values have already shifted, backfill the
|
|
909
|
+
# parallel prefix with nil exactly once.
|
|
910
|
+
# @rbs (untyped location) -> void
|
|
911
|
+
def push_location: (untyped location) -> void
|
|
912
|
+
|
|
913
|
+
# @rbs (Integer length) -> Array[untyped]
|
|
914
|
+
def pop_reduction_locations: (Integer length) -> Array[untyped]
|
|
915
|
+
|
|
916
|
+
# @rbs (untyped table, Integer row, Integer column) -> untyped
|
|
917
|
+
def table_lookup: (untyped table, Integer row, Integer column) -> untyped
|
|
918
|
+
|
|
919
|
+
# @rbs (String message) -> void
|
|
920
|
+
def trace: (String message) -> void
|
|
921
|
+
|
|
922
|
+
# @rbs (untyped value, Integer symbol_id) -> String
|
|
923
|
+
def trace_value_suffix: (untyped value, Integer symbol_id) -> String
|
|
924
|
+
end
|
|
925
|
+
end
|
|
926
|
+
end
|