code-ruby 3.0.13 → 3.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6baa3c7c3ef6b602529e2af4a36200029291ed89c115f1c1f3d750a8e815cc03
4
- data.tar.gz: aa9c876fb0aff915f895ec3d209d25ac06270e3809eadba8f5e71b37b9cb29db
3
+ metadata.gz: 2495002bb8e1d284386f2a90ff600370cfe0490a356688426682ec106727fbb3
4
+ data.tar.gz: e8dffdf7d8d0c0e62a091d2a7d305eae48dc74d024aa26c5a8dc393763147f13
5
5
  SHA512:
6
- metadata.gz: 444adc5d9b9a5223b82a921a888558a2f23dc40344a12b383137581b910ba4e33ea13873a2e5ce6698dc130ae77775cf9aa5b3e0e23f70947418301831df96b9
7
- data.tar.gz: bcf7ecebc28788a2cf7464e3a7b67f32b2bfb86ec3d6365ca58674914d852181d27f3a051b596665807acd67291c2026d227b98d33603260e3122417e04d6a76
6
+ metadata.gz: 55ceb13028c588110d3adec5539995ddd1f2dc4fd7173fd067a8e009a8093610adb150de78be46dfc57e605dbad0f03dd89e5693820be31c6d61c3440fb129ea
7
+ data.tar.gz: 6ae82061c1a129f1607eb348e18917e75c7d23accf7dca589da00ed3ae34eccf76af79826e430f5267b4a2011ce7c9df8a1709069f95f660c8dff22d16c0c37a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (3.0.13)
4
+ code-ruby (3.1.2)
5
5
  activesupport
6
6
  base64
7
7
  bigdecimal
@@ -20,7 +20,7 @@ PATH
20
20
  GEM
21
21
  remote: https://rubygems.org/
22
22
  specs:
23
- activesupport (8.1.2)
23
+ activesupport (8.1.3)
24
24
  base64
25
25
  bigdecimal
26
26
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -33,11 +33,11 @@ GEM
33
33
  securerandom (>= 0.3)
34
34
  tzinfo (~> 2.0, >= 2.0.5)
35
35
  uri (>= 0.13.1)
36
- addressable (2.8.9)
36
+ addressable (2.9.0)
37
37
  public_suffix (>= 2.0.2, < 8.0)
38
38
  ast (2.4.3)
39
39
  base64 (0.3.0)
40
- bigdecimal (4.0.1)
40
+ bigdecimal (4.1.2)
41
41
  bundler-audit (0.9.3)
42
42
  bundler (>= 1.2.0)
43
43
  thor (~> 1.0)
@@ -79,7 +79,7 @@ GEM
79
79
  dorian-to_struct (2.0.2)
80
80
  drb (2.2.3)
81
81
  geom2d (0.4.1)
82
- git (4.3.1)
82
+ git (4.3.2)
83
83
  activesupport (>= 5.0)
84
84
  addressable (~> 2.8)
85
85
  process_executer (~> 4.0)
@@ -89,23 +89,20 @@ GEM
89
89
  thor
90
90
  tilt
91
91
  hashdiff (1.2.1)
92
- hexapdf (1.6.0)
92
+ hexapdf (1.8.0)
93
93
  cmdparse (~> 3.0, >= 3.0.3)
94
94
  geom2d (~> 0.4, >= 0.4.1)
95
95
  openssl (>= 2.2.1)
96
96
  strscan (>= 3.1.2)
97
97
  i18n (1.14.8)
98
98
  concurrent-ruby (~> 1.0)
99
- icalendar (2.12.2)
99
+ icalendar (2.12.3)
100
100
  base64
101
101
  ice_cube (~> 0.16)
102
102
  logger
103
103
  ostruct
104
104
  ice_cube (0.17.0)
105
- json (2.18.1)
106
- json-schema (6.1.0)
107
- addressable (~> 2.8)
108
- bigdecimal (>= 3.1, < 5)
105
+ json (2.19.5)
109
106
  language-ruby (1.2.0)
110
107
  dorian-arguments
111
108
  zeitwerk
@@ -121,19 +118,16 @@ GEM
121
118
  net-imap
122
119
  net-pop
123
120
  net-smtp
124
- mcp (0.7.1)
125
- json-schema (>= 4.1)
126
121
  mini_mime (1.1.5)
127
- mini_racer (0.20.0)
122
+ mini_racer (0.21.0)
128
123
  libv8-node (~> 24.12.0.1)
129
- minitest (6.0.2)
124
+ minitest (6.0.6)
130
125
  drb (~> 2.0)
131
126
  prism (~> 1.5)
132
- mustermann (3.0.4)
133
- ruby2_keywords (~> 0.0.1)
127
+ mustermann (3.1.1)
134
128
  net-http (0.9.1)
135
129
  uri (>= 0.11.1)
136
- net-imap (0.6.3)
130
+ net-imap (0.6.4)
137
131
  date
138
132
  net-protocol
139
133
  net-pop (0.1.2)
@@ -142,34 +136,34 @@ GEM
142
136
  timeout
143
137
  net-smtp (0.5.1)
144
138
  net-protocol
145
- nokogiri (1.19.1-arm64-darwin)
139
+ nokogiri (1.19.3-arm64-darwin)
146
140
  racc (~> 1.4)
147
- nokogiri (1.19.1-x86_64-linux-gnu)
141
+ nokogiri (1.19.3-x86_64-linux-gnu)
148
142
  racc (~> 1.4)
149
- openssl (4.0.1)
143
+ openssl (4.0.2)
150
144
  ostruct (0.6.3)
151
- parallel (1.27.0)
152
- parser (3.3.10.2)
145
+ parallel (2.1.0)
146
+ parser (3.3.11.1)
153
147
  ast (~> 2.4.1)
154
148
  racc
155
149
  prettier_print (1.2.1)
156
150
  prism (1.9.0)
157
- process_executer (4.0.2)
151
+ process_executer (4.0.4)
158
152
  track_open_instances (~> 0.1)
159
- public_suffix (7.0.2)
153
+ public_suffix (7.0.5)
160
154
  racc (1.8.1)
161
- rack (3.2.5)
155
+ rack (3.2.6)
162
156
  rack-protection (4.2.1)
163
157
  base64 (>= 0.1.0)
164
158
  logger (>= 1.6.0)
165
159
  rack (>= 3.0.0, < 4)
166
- rack-session (2.1.1)
160
+ rack-session (2.1.2)
167
161
  base64 (>= 0.1.0)
168
162
  rack (>= 3.0.0)
169
163
  rainbow (3.1.1)
170
- rake (13.3.1)
164
+ rake (13.4.2)
171
165
  rchardet (1.10.0)
172
- regexp_parser (2.11.3)
166
+ regexp_parser (2.12.0)
173
167
  rexml (3.4.4)
174
168
  rspec (3.13.2)
175
169
  rspec-core (~> 3.13.0)
@@ -184,24 +178,23 @@ GEM
184
178
  diff-lcs (>= 1.2.0, < 2.0)
185
179
  rspec-support (~> 3.13.0)
186
180
  rspec-support (3.13.7)
187
- rubocop (1.85.0)
181
+ rubocop (1.86.2)
188
182
  json (~> 2.3)
189
183
  language_server-protocol (~> 3.17.0.2)
190
184
  lint_roller (~> 1.1.0)
191
- mcp (~> 0.6)
192
- parallel (~> 1.10)
185
+ parallel (>= 1.10)
193
186
  parser (>= 3.3.0.2)
194
187
  rainbow (>= 2.2.2, < 4.0)
195
188
  regexp_parser (>= 2.9.3, < 3.0)
196
189
  rubocop-ast (>= 1.49.0, < 2.0)
197
190
  ruby-progressbar (~> 1.7)
198
191
  unicode-display_width (>= 2.4.0, < 4.0)
199
- rubocop-ast (1.49.0)
192
+ rubocop-ast (1.49.1)
200
193
  parser (>= 3.3.7.2)
201
194
  prism (~> 1.7)
202
- rubocop-capybara (2.22.1)
195
+ rubocop-capybara (2.23.0)
203
196
  lint_roller (~> 1.1)
204
- rubocop (~> 1.72, >= 1.72.1)
197
+ rubocop (~> 1.81)
205
198
  rubocop-factory_bot (2.28.0)
206
199
  lint_roller (~> 1.1)
207
200
  rubocop (~> 1.72, >= 1.72.1)
@@ -209,7 +202,7 @@ GEM
209
202
  lint_roller (~> 1.1)
210
203
  rubocop (>= 1.75.0, < 2.0)
211
204
  rubocop-ast (>= 1.47.1, < 2.0)
212
- rubocop-rails (2.34.3)
205
+ rubocop-rails (2.35.0)
213
206
  activesupport (>= 4.2.0)
214
207
  lint_roller (~> 1.1)
215
208
  rack (>= 1.1)
@@ -225,11 +218,10 @@ GEM
225
218
  lint_roller (~> 1.1)
226
219
  rubocop (~> 1.72, >= 1.72.1)
227
220
  rubocop-rspec (~> 3.5)
228
- ruby-prof (2.0.3)
221
+ ruby-prof (2.0.4)
229
222
  base64
230
223
  ostruct
231
224
  ruby-progressbar (1.13.0)
232
- ruby2_keywords (0.0.5)
233
225
  securerandom (0.4.1)
234
226
  sinatra (4.2.1)
235
227
  logger (>= 1.6.0)
@@ -238,7 +230,7 @@ GEM
238
230
  rack-protection (= 4.2.1)
239
231
  rack-session (>= 2.0.0, < 3)
240
232
  tilt (~> 2.0)
241
- strscan (3.1.7)
233
+ strscan (3.1.8)
242
234
  syntax_tree (6.3.0)
243
235
  prettier_print (>= 1.2.0)
244
236
  syntax_tree-haml (4.0.3)
@@ -253,7 +245,7 @@ GEM
253
245
  unicode-display_width (>= 1.1.1, < 4)
254
246
  thor (1.5.0)
255
247
  tilt (2.7.0)
256
- timeout (0.6.0)
248
+ timeout (0.6.1)
257
249
  track_open_instances (0.1.15)
258
250
  tzinfo (2.0.6)
259
251
  concurrent-ruby (~> 1.0)
@@ -264,7 +256,7 @@ GEM
264
256
  w_syntax_tree-erb (0.12.0)
265
257
  prettier_print (~> 1.2, >= 1.2.0)
266
258
  syntax_tree (~> 6.1, >= 6.1.1)
267
- webmock (3.26.1)
259
+ webmock (3.26.2)
268
260
  addressable (>= 2.8.0)
269
261
  crack (>= 0.3.2)
270
262
  hashdiff (>= 0.4.0, < 2.0.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.13
1
+ 3.1.2
data/lib/code/format.rb CHANGED
@@ -11,6 +11,7 @@ class Code
11
11
  MAX_INLINE_CALL_ARGUMENTS_LENGTH = 80
12
12
  MAX_INLINE_BLOCK_BODY_LENGTH = 40
13
13
  CONTINUATION_PADDING = 4
14
+ BOOLEAN_WORD_OPERATORS = %w[and or].freeze
14
15
 
15
16
  class << self
16
17
  def format(parsed)
@@ -328,13 +329,30 @@ class Code
328
329
  end
329
330
 
330
331
  def format_dictionary_statement_code(statement_code)
331
- key = format_nested_statement(statement_code[:statement], indent: 0)
332
+ key =
333
+ format_dictionary_statement_key(statement_code[:statement]) ||
334
+ format_nested_statement(statement_code[:statement], indent: 0)
332
335
  return key unless statement_code.key?(:code)
333
336
 
334
337
  value = format_code_inline(statement_code[:code], indent: 0)
335
338
  "#{key}: #{value}"
336
339
  end
337
340
 
341
+ def format_dictionary_statement_key(statement)
342
+ return unless statement.is_a?(Hash) && statement.key?(:string)
343
+
344
+ parts = Array(statement[:string])
345
+ return unless parts.one?
346
+
347
+ part = parts.first
348
+ return unless part.is_a?(Hash) && part.key?(:text)
349
+
350
+ text = part[:text].to_s
351
+ return unless text.match?(/\A[a-z_][a-z0-9_]*\z/)
352
+
353
+ text
354
+ end
355
+
338
356
  def format_call(call, indent:)
339
357
  name = call[:name]
340
358
  raw_arguments = call[:arguments].presence || []
@@ -444,8 +462,8 @@ class Code
444
462
  if right.include?("\n")
445
463
  first_line, *rest = right.lines(chomp: true)
446
464
  if multiline_operand_statement?(other[:statement]) ||
447
- !%w[and or].include?(operator)
448
- [ "#{expression} #{operator} #{first_line.lstrip}", *rest ].join("\n")
465
+ !BOOLEAN_WORD_OPERATORS.include?(operator)
466
+ ["#{expression} #{operator} #{first_line.lstrip}", *rest].join("\n")
449
467
  else
450
468
  [
451
469
  "#{expression}\n#{INDENT * (indent + 1)}#{operator} #{first_line.lstrip}",
@@ -456,7 +474,7 @@ class Code
456
474
  right_lines =
457
475
  if right.include?("\n")
458
476
  right.lines(chomp: true).map(&:lstrip)
459
- elsif %w[and or].include?(operator)
477
+ elsif BOOLEAN_WORD_OPERATORS.include?(operator)
460
478
  right.split(" #{operator} ")
461
479
  else
462
480
  [right]
@@ -492,7 +510,7 @@ class Code
492
510
  expression
493
511
  .lines(chomp: true)[1..]
494
512
  .to_a
495
- .reject { |line| line.strip.empty? || line.strip.match?(/\A[\)\]\}]+\z/) }
513
+ .reject { |line| line.strip.empty? || line.strip.match?(/\A[\])}]+\z/) }
496
514
 
497
515
  return false if continuation_lines.empty?
498
516
 
@@ -502,7 +520,7 @@ class Code
502
520
  continuation_lines.any? do |line|
503
521
  next false unless line[/\A */].to_s.length == base_indent
504
522
 
505
- line.lstrip.match?(/\A(\+|-|\*|\/|%|<<|>>|\||\^|&|and\b|or\b)/)
523
+ line.lstrip.match?(%r{\A(\+|-|\*|/|%|<<|>>|\||\^|&|and\b|or\b)})
506
524
  end
507
525
  end
508
526
 
@@ -688,7 +706,13 @@ class Code
688
706
 
689
707
  if operator == "loop"
690
708
  body = format_code(while_statement[:body], indent: indent + 1)
691
- return "#{INDENT * indent}loop {\n#{body}\n#{INDENT * indent}}"
709
+ parameters =
710
+ Array(while_statement[:parameters]).map do |parameter|
711
+ format_parameter(parameter, indent: indent)
712
+ end
713
+ header = parameters.empty? ? "loop {" : "loop { |#{parameters.join(", ")}|"
714
+
715
+ return "#{INDENT * indent}#{header}\n#{body}\n#{INDENT * indent}}"
692
716
  end
693
717
 
694
718
  statement =
@@ -713,6 +737,7 @@ class Code
713
737
 
714
738
  return true if statement.key?(:dictionnary) || statement.key?(:list)
715
739
  return true if statement.key?(:call)
740
+
716
741
  if statement.key?(:left_operation)
717
742
  operation = statement[:left_operation]
718
743
  others = Array(operation[:others])
@@ -791,6 +816,8 @@ class Code
791
816
  index, token = split
792
817
  left = line[0...index]
793
818
  right = line[(index + token.length)..]
819
+ return [line] if token == "." && left.strip.empty?
820
+
794
821
  continuation = "#{indent}#{INDENT}#{right.lstrip}"
795
822
 
796
823
  first_line =
@@ -51,12 +51,20 @@ class Code
51
51
 
52
52
  @others.reduce(first) do |left, right|
53
53
  if right.call?
54
- right.statement.evaluate(**args, object: left)
54
+ right.statement.evaluate(
55
+ **args,
56
+ object: left,
57
+ previous_object: args.fetch(:object)
58
+ )
55
59
  elsif right.safe_call?
56
60
  if left.is_an?(Object::Nothing)
57
61
  Object::Nothing.new
58
62
  else
59
- right.statement.evaluate(**args, object: left)
63
+ right.statement.evaluate(
64
+ **args,
65
+ object: left,
66
+ previous_object: args.fetch(:object)
67
+ )
60
68
  end
61
69
  elsif (right.or? && left.truthy?) || (right.and? && left.falsy?)
62
70
  left
@@ -76,9 +84,18 @@ class Code
76
84
  list = Object::IdentifierList.new([first])
77
85
 
78
86
  (@others || []).each do |other|
79
- list.code_append(
80
- other.statement.resolve(**args, object: list.code_last)
81
- )
87
+ resolved =
88
+ other.statement.resolve(
89
+ **args,
90
+ object: list.code_last,
91
+ previous_object: args.fetch(:object)
92
+ )
93
+
94
+ if resolved.is_a?(Object::IdentifierList)
95
+ resolved.raw.each { |identifier| list.code_append(identifier) }
96
+ else
97
+ list.code_append(resolved)
98
+ end
82
99
  end
83
100
 
84
101
  list
@@ -13,9 +13,10 @@ class Code
13
13
 
14
14
  def evaluate(**args)
15
15
  left = @left&.evaluate(**args) || Object::Nothing.new
16
+ index_args = args.merge(object: args.fetch(:previous_object, args.fetch(:object)))
16
17
 
17
18
  (@statements || []).reduce(left) do |object, statement|
18
- object.code_fetch(statement.evaluate(**args))
19
+ object.code_fetch(statement.evaluate(**index_args))
19
20
  end
20
21
  end
21
22
 
@@ -29,8 +30,10 @@ class Code
29
30
  Object::IdentifierList.new([left])
30
31
  end
31
32
 
33
+ index_args = args.merge(object: args.fetch(:previous_object, args.fetch(:object)))
34
+
32
35
  (@statements || []).each do |statement|
33
- list.code_append(statement.evaluate(**args))
36
+ list.code_append(statement.evaluate(**index_args))
34
37
  end
35
38
 
36
39
  list
@@ -14,6 +14,8 @@ class Code
14
14
  @statement = Statement.new(parsed.delete(:statement)) if parsed.key?(
15
15
  :statement
16
16
  )
17
+ @parameters = parsed.delete(:parameters) { [] }.presence || []
18
+ @parameters.map! { |parameter| FunctionParameter.new(parameter) }
17
19
  @body = Code.new(parsed.delete(:body).presence)
18
20
  end
19
21
 
@@ -53,11 +55,15 @@ class Code
53
55
 
54
56
  def evaluate_infinite_loop(**args)
55
57
  last = Object::Nothing.new
58
+ index = 0
56
59
 
57
60
  loop do
61
+ bind_loop_parameters(index, **args)
58
62
  last = @body&.evaluate(**args) || Object::Nothing.new
63
+ index += 1
59
64
  rescue Error::Next, Error::Continue => e
60
65
  last = e.code_value
66
+ index += 1
61
67
  next
62
68
  rescue Error::Retry
63
69
  retry
@@ -74,6 +80,21 @@ class Code
74
80
 
75
81
  condition_truthy ? condition : !condition
76
82
  end
83
+
84
+ def bind_loop_parameters(index, **args)
85
+ return if @parameters.blank?
86
+
87
+ @parameters.each.with_index do |parameter, parameter_index|
88
+ value =
89
+ if parameter_index.zero?
90
+ Object::Integer.new(index)
91
+ else
92
+ Object::Nothing.new
93
+ end
94
+
95
+ args.fetch(:context).code_set(parameter.name, value)
96
+ end
97
+ end
77
98
  end
78
99
  end
79
100
  end
@@ -134,6 +134,11 @@ class Code
134
134
  code_arguments = args.fetch(:arguments, List.new).to_code
135
135
  globals = multi_fetch(args, *GLOBALS)
136
136
  code_value = code_arguments.code_first
137
+ stored_value = code_fetch(code_operator)
138
+
139
+ if stored_value.is_a?(Function)
140
+ return stored_value.call(**args, operator: nil, bound_self: self)
141
+ end
137
142
 
138
143
  case code_operator.to_s
139
144
  when "[]", "at", "get"
@@ -146,11 +151,11 @@ class Code
146
151
  sig(args)
147
152
  code_clear
148
153
  when "compact!"
149
- sig(args)
150
- code_compact!
154
+ sig(args) { (Function | Class).maybe }
155
+ code_compact!(code_value, **globals)
151
156
  when "compact"
152
- sig(args)
153
- code_compact
157
+ sig(args) { (Function | Class).maybe }
158
+ code_compact(code_value, **globals)
154
159
  when "delete"
155
160
  sig(args) { Object.repeat(1) }
156
161
  code_delete(*code_arguments.raw, **globals)
@@ -571,9 +576,13 @@ class Code
571
576
  )
572
577
  .truthy?
573
578
  .tap { index += 1 }
579
+ rescue Error::Next => e
580
+ e.code_value.truthy?.tap { index += 1 }
574
581
  end
575
582
  )
576
583
  end
584
+ rescue Error::Break => e
585
+ e.code_value
577
586
  end
578
587
 
579
588
  def code_clear
@@ -581,13 +590,50 @@ class Code
581
590
  self
582
591
  end
583
592
 
584
- def code_compact
585
- Dictionary.new(raw.dup.delete_if { |_, value| value.falsy? })
593
+ def code_compact(argument = nil, **globals)
594
+ code_argument = argument.to_code
595
+
596
+ Dictionary.new(
597
+ raw.reject.with_index do |(key, value), index|
598
+ if code_argument.nothing?
599
+ value.nothing?
600
+ elsif code_argument.is_a?(Class)
601
+ value.is_a?(code_argument.raw)
602
+ else
603
+ code_argument.call(
604
+ arguments: List.new([value, key, Integer.new(index), self]),
605
+ **globals
606
+ ).truthy?
607
+ end
608
+ rescue Error::Next => e
609
+ e.code_value.truthy?
610
+ end
611
+ )
612
+ rescue Error::Break => e
613
+ e.code_value
586
614
  end
587
615
 
588
- def code_compact!
589
- raw.delete_if { |_, value| value.falsy? }
616
+ def code_compact!(argument = nil, **globals)
617
+ code_argument = argument.to_code
618
+
619
+ raw.reject!.with_index do |(key, value), index|
620
+ if code_argument.nothing?
621
+ value.nothing?
622
+ elsif code_argument.is_a?(Class)
623
+ value.is_a?(code_argument.raw)
624
+ else
625
+ code_argument.call(
626
+ arguments: List.new([value, key, Integer.new(index), self]),
627
+ **globals
628
+ ).truthy?
629
+ end
630
+ rescue Error::Next => e
631
+ e.code_value.truthy?
632
+ end
633
+
590
634
  self
635
+ rescue Error::Break => e
636
+ e.code_value
591
637
  end
592
638
 
593
639
  def code_delete(*arguments, index: 0, **globals)
@@ -612,6 +658,8 @@ class Code
612
658
  **globals
613
659
  )
614
660
  end
661
+ rescue Error::Next => e
662
+ e.code_value
615
663
  end
616
664
  else
617
665
  Dictionary.new(
@@ -638,6 +686,8 @@ class Code
638
686
  .to_h
639
687
  )
640
688
  end
689
+ rescue Error::Break => e
690
+ e.code_value
641
691
  end
642
692
 
643
693
  def code_delete_if(argument, **globals)
@@ -652,10 +702,14 @@ class Code
652
702
  List.new([code_key, code_value, Integer.new(index), self]),
653
703
  **globals
654
704
  ).truthy?
705
+ rescue Error::Next => e
706
+ e.code_value.truthy?
655
707
  end
656
708
  end
657
709
 
658
710
  self
711
+ rescue Error::Break => e
712
+ e.code_value
659
713
  end
660
714
 
661
715
  def code_delete_unless(argument, **globals)
@@ -669,10 +723,14 @@ class Code
669
723
  arguments: List.new([key, value, Integer.new(index), self]),
670
724
  **globals
671
725
  ).falsy?
726
+ rescue Error::Next => e
727
+ e.code_value.falsy?
672
728
  end
673
729
  end
674
730
 
675
731
  self
732
+ rescue Error::Break => e
733
+ e.code_value
676
734
  end
677
735
 
678
736
  def code_dig(*arguments)
@@ -697,9 +755,13 @@ class Code
697
755
  arguments: List.new([key, value, Integer.new(index), self]),
698
756
  **globals
699
757
  )
758
+ rescue Error::Next => e
759
+ e.code_value
700
760
  end
701
761
 
702
762
  self
763
+ rescue Error::Break => e
764
+ e.code_value
703
765
  end
704
766
 
705
767
  def code_empty?
@@ -733,6 +795,8 @@ class Code
733
795
  **globals
734
796
  )
735
797
  end
798
+ rescue Error::Next => e
799
+ e.code_value
736
800
  end
737
801
  else
738
802
  Dictionary.new(
@@ -759,6 +823,8 @@ class Code
759
823
  .to_h
760
824
  )
761
825
  end
826
+ rescue Error::Break => e
827
+ e.code_value
762
828
  end
763
829
 
764
830
  def code_fetch_values(*arguments)
@@ -803,10 +869,14 @@ class Code
803
869
  arguments: List.new([key, value, Integer.new(index), self]),
804
870
  **globals
805
871
  ).truthy?
872
+ rescue Error::Next => e
873
+ e.code_value.truthy?
806
874
  end
807
875
  end
808
876
 
809
877
  self
878
+ rescue Error::Break => e
879
+ e.code_value
810
880
  end
811
881
 
812
882
  def code_keep_unless(argument, **globals)
@@ -826,6 +896,8 @@ class Code
826
896
  end
827
897
 
828
898
  self
899
+ rescue Error::Break => e
900
+ e.code_value
829
901
  end
830
902
 
831
903
  def code_key(value, function = nil, **globals)
@@ -838,7 +910,7 @@ class Code
838
910
  raw.key(code_value) ||
839
911
  function.call(arguments: List.new([code_value, self]), **globals)
840
912
  end
841
- rescue Error::Next => e
913
+ rescue Error::Next, Error::Break => e
842
914
  e.code_value
843
915
  end
844
916
 
@@ -883,6 +955,8 @@ class Code
883
955
  e.code_value.tap { index += 1 }
884
956
  end
885
957
  )
958
+ rescue Error::Break => e
959
+ e.code_value
886
960
  end
887
961
 
888
962
  def code_merge!(*arguments, **globals)
@@ -922,6 +996,8 @@ class Code
922
996
  end
923
997
 
924
998
  self
999
+ rescue Error::Break => e
1000
+ e.code_value
925
1001
  end
926
1002
 
927
1003
  def code_select!(argument, **globals)
@@ -942,6 +1018,8 @@ class Code
942
1018
  end
943
1019
 
944
1020
  self
1021
+ rescue Error::Break => e
1022
+ e.code_value
945
1023
  end
946
1024
 
947
1025
  def code_select(argument, **globals)
@@ -964,6 +1042,8 @@ class Code
964
1042
  end
965
1043
  )
966
1044
  end
1045
+ rescue Error::Break => e
1046
+ e.code_value
967
1047
  end
968
1048
 
969
1049
  def code_set(key, value)
@@ -1007,6 +1087,8 @@ class Code
1007
1087
  end
1008
1088
  .to_h
1009
1089
  )
1090
+ rescue Error::Break => e
1091
+ e.code_value
1010
1092
  end
1011
1093
 
1012
1094
  def code_values