atomy 0.1.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +13 -0
  3. data/LICENSE.md +201 -0
  4. data/bin/atomy +16 -133
  5. data/kernel/array.ay +6 -0
  6. data/kernel/atomy.ay +18 -0
  7. data/kernel/condition.ay +171 -271
  8. data/kernel/control-flow.ay +197 -192
  9. data/kernel/core.ay +120 -0
  10. data/kernel/data.ay +83 -39
  11. data/kernel/define.ay +84 -93
  12. data/kernel/doc.ay +282 -449
  13. data/kernel/dynamic.ay +25 -29
  14. data/kernel/file.ay +9 -0
  15. data/kernel/grammar.ay +267 -0
  16. data/kernel/hash.ay +17 -0
  17. data/kernel/interpolation.ay +59 -0
  18. data/kernel/io.ay +70 -244
  19. data/kernel/let-macro.ay +24 -0
  20. data/kernel/let-pattern.ay +24 -0
  21. data/kernel/loop.ay +80 -0
  22. data/kernel/mutation.ay +53 -0
  23. data/kernel/particles.ay +176 -39
  24. data/kernel/patterns.ay +527 -191
  25. data/kernel/pretty.ay +311 -277
  26. data/kernel/quotes.ay +29 -0
  27. data/kernel/range.ay +4 -0
  28. data/kernel/regexp.ay +23 -0
  29. data/kernel/repl.ay +83 -109
  30. data/kernel/stack-local.ay +21 -0
  31. data/lib/atomy.rb +37 -0
  32. data/lib/atomy/bootstrap.rb +256 -0
  33. data/lib/atomy/code/assign.rb +64 -0
  34. data/lib/atomy/code/block.rb +98 -0
  35. data/lib/atomy/code/class_variable.rb +17 -0
  36. data/lib/atomy/code/constant.rb +21 -0
  37. data/lib/atomy/code/define.rb +242 -0
  38. data/lib/atomy/code/define_function.rb +51 -0
  39. data/lib/atomy/code/define_method.rb +20 -0
  40. data/lib/atomy/code/false.rb +9 -0
  41. data/lib/atomy/code/instance_variable.rb +15 -0
  42. data/lib/atomy/code/integer.rb +13 -0
  43. data/lib/atomy/code/list.rb +17 -0
  44. data/lib/atomy/code/nil.rb +9 -0
  45. data/lib/atomy/code/pattern.rb +23 -0
  46. data/lib/atomy/code/pattern/and.rb +61 -0
  47. data/lib/atomy/code/pattern/quasi_quote.rb +185 -0
  48. data/lib/atomy/code/pattern/splat.rb +29 -0
  49. data/lib/atomy/code/pattern/wildcard.rb +37 -0
  50. data/lib/atomy/code/quasi_quote.rb +118 -0
  51. data/lib/atomy/code/quote.rb +13 -0
  52. data/lib/atomy/code/self.rb +9 -0
  53. data/lib/atomy/code/send.rb +110 -0
  54. data/lib/atomy/code/sequence.rb +23 -0
  55. data/lib/atomy/code/string_literal.rb +53 -0
  56. data/lib/atomy/code/symbol.rb +13 -0
  57. data/lib/atomy/code/true.rb +9 -0
  58. data/lib/atomy/code/undefined.rb +9 -0
  59. data/lib/atomy/code/variable.rb +17 -0
  60. data/lib/atomy/codeloader.rb +218 -0
  61. data/lib/atomy/compiler.rb +57 -0
  62. data/lib/atomy/errors.rb +54 -0
  63. data/lib/atomy/grammar.rb +2278 -0
  64. data/lib/atomy/locals.rb +75 -0
  65. data/lib/atomy/message_structure.rb +277 -0
  66. data/lib/atomy/method.rb +343 -0
  67. data/lib/atomy/module.rb +144 -0
  68. data/lib/atomy/node/constructable.rb +169 -0
  69. data/lib/atomy/node/equality.rb +113 -0
  70. data/lib/atomy/node/meta.rb +206 -0
  71. data/lib/atomy/node/pretty.rb +108 -0
  72. data/lib/atomy/parser.rb +21 -0
  73. data/lib/atomy/pattern.rb +26 -0
  74. data/lib/atomy/pattern/and.rb +59 -0
  75. data/lib/atomy/pattern/attribute.rb +16 -0
  76. data/lib/atomy/pattern/class_variable.rb +15 -0
  77. data/lib/atomy/pattern/equality.rb +42 -0
  78. data/lib/atomy/pattern/instance_variable.rb +15 -0
  79. data/lib/atomy/pattern/kind_of.rb +20 -0
  80. data/lib/atomy/pattern/or.rb +48 -0
  81. data/lib/atomy/pattern/quasi_quote.rb +164 -0
  82. data/lib/atomy/pattern/splat.rb +15 -0
  83. data/lib/atomy/pattern/wildcard.rb +18 -0
  84. data/lib/atomy/rubygems.rb +48 -0
  85. data/lib/atomy/version.rb +3 -0
  86. metadata +169 -134
  87. data/COPYING +0 -30
  88. data/README.md +0 -1
  89. data/kernel/block.ay +0 -30
  90. data/kernel/boot.ay +0 -10
  91. data/kernel/comparison.ay +0 -61
  92. data/kernel/concurrency.ay +0 -84
  93. data/kernel/cosmetics.ay +0 -3
  94. data/kernel/data-delta.ay +0 -105
  95. data/kernel/documentation.ay +0 -135
  96. data/kernel/errors.ay +0 -6
  97. data/kernel/format.ay +0 -13
  98. data/kernel/format/data.ay +0 -89
  99. data/kernel/format/formatter.ay +0 -345
  100. data/kernel/format/parser.ay +0 -13
  101. data/kernel/hashes.ay +0 -39
  102. data/kernel/namespaces.ay +0 -63
  103. data/kernel/node.ay +0 -48
  104. data/kernel/operators.ay +0 -28
  105. data/kernel/precision.ay +0 -148
  106. data/kernel/therie.ay +0 -204
  107. data/lib/ast/binary_send.rb +0 -44
  108. data/lib/ast/block.rb +0 -268
  109. data/lib/ast/constant.rb +0 -88
  110. data/lib/ast/internal/assign.rb +0 -19
  111. data/lib/ast/internal/block_pass.rb +0 -21
  112. data/lib/ast/internal/catch.rb +0 -247
  113. data/lib/ast/internal/class.rb +0 -30
  114. data/lib/ast/internal/class_variable.rb +0 -23
  115. data/lib/ast/internal/define.rb +0 -174
  116. data/lib/ast/internal/ensure.rb +0 -135
  117. data/lib/ast/internal/file.rb +0 -14
  118. data/lib/ast/internal/global_variable.rb +0 -20
  119. data/lib/ast/internal/if_then_else.rb +0 -24
  120. data/lib/ast/internal/instance_variable.rb +0 -17
  121. data/lib/ast/internal/let_macro.rb +0 -35
  122. data/lib/ast/internal/macro_quote.rb +0 -23
  123. data/lib/ast/internal/match.rb +0 -53
  124. data/lib/ast/internal/module.rb +0 -30
  125. data/lib/ast/internal/pattern.rb +0 -17
  126. data/lib/ast/internal/return.rb +0 -29
  127. data/lib/ast/internal/set.rb +0 -19
  128. data/lib/ast/internal/singleton_class.rb +0 -18
  129. data/lib/ast/internal/splat.rb +0 -14
  130. data/lib/ast/internal/when.rb +0 -24
  131. data/lib/ast/list.rb +0 -25
  132. data/lib/ast/macro.rb +0 -37
  133. data/lib/ast/node.rb +0 -599
  134. data/lib/ast/operator.rb +0 -21
  135. data/lib/ast/particle.rb +0 -13
  136. data/lib/ast/primitive.rb +0 -20
  137. data/lib/ast/quasi_quote.rb +0 -20
  138. data/lib/ast/quote.rb +0 -13
  139. data/lib/ast/send.rb +0 -104
  140. data/lib/ast/splice.rb +0 -32
  141. data/lib/ast/string.rb +0 -23
  142. data/lib/ast/unary.rb +0 -44
  143. data/lib/ast/unquote.rb +0 -45
  144. data/lib/ast/variable.rb +0 -64
  145. data/lib/atomy.kpeg.rb +0 -3995
  146. data/lib/code_loader.rb +0 -137
  147. data/lib/compiler/compiler.rb +0 -155
  148. data/lib/compiler/stages.rb +0 -81
  149. data/lib/formatter.kpeg.rb +0 -1394
  150. data/lib/macros.rb +0 -317
  151. data/lib/method.rb +0 -261
  152. data/lib/namespace.rb +0 -236
  153. data/lib/parser.rb +0 -28
  154. data/lib/patterns.rb +0 -276
  155. data/lib/patterns/any.rb +0 -21
  156. data/lib/patterns/attribute.rb +0 -59
  157. data/lib/patterns/block_pass.rb +0 -54
  158. data/lib/patterns/constant.rb +0 -33
  159. data/lib/patterns/default.rb +0 -44
  160. data/lib/patterns/head_tail.rb +0 -63
  161. data/lib/patterns/list.rb +0 -77
  162. data/lib/patterns/match.rb +0 -45
  163. data/lib/patterns/named.rb +0 -55
  164. data/lib/patterns/named_class.rb +0 -46
  165. data/lib/patterns/named_global.rb +0 -46
  166. data/lib/patterns/named_instance.rb +0 -46
  167. data/lib/patterns/particle.rb +0 -29
  168. data/lib/patterns/quasi_quote.rb +0 -184
  169. data/lib/patterns/quote.rb +0 -33
  170. data/lib/patterns/singleton_class.rb +0 -31
  171. data/lib/patterns/splat.rb +0 -57
  172. data/lib/util.rb +0 -37
@@ -1,44 +0,0 @@
1
- module Atomy
2
- module AST
3
- class BinarySend < Node
4
- children :lhs, :rhs
5
- attributes :operator
6
- slots [:private, "false"], :namespace?
7
- generate
8
-
9
- alias :method_name :operator
10
-
11
- def register_macro(body, let = false)
12
- Atomy::Macro.register(
13
- @operator,
14
- [@lhs, @rhs].collect do |n|
15
- Atomy::Macro.macro_pattern n
16
- end,
17
- body,
18
- let
19
- )
20
- end
21
-
22
- def message_name
23
- Atomy.namespaced(@namespace, @operator)
24
- end
25
-
26
- def prepare
27
- resolve.expand
28
- end
29
-
30
- def bytecode(g)
31
- pos(g)
32
- @lhs.compile(g)
33
- g.push_literal message_name.to_sym unless @namespace == "_"
34
- @rhs.compile(g)
35
- if @namespace == "_"
36
- g.send @operator.to_sym, 1
37
- else
38
- g.send :atomy_send, 2
39
- #g.call_custom method_name.to_sym, 1
40
- end
41
- end
42
- end
43
- end
44
- end
data/lib/ast/block.rb DELETED
@@ -1,268 +0,0 @@
1
- module Atomy
2
- module AST
3
- class Block < Rubinius::AST::Iter
4
- include NodeLike
5
- extend SentientNode
6
-
7
- children [:contents], [:arguments]
8
- generate
9
-
10
- def block_arguments
11
- BlockArguments.new @arguments
12
- end
13
-
14
- def block_body
15
- BlockBody.new @line, @contents
16
- end
17
-
18
- def body
19
- InlinedBody.new @line, @contents
20
- end
21
-
22
- alias :caller :body
23
-
24
- def bytecode(g)
25
- pos(g)
26
-
27
- state = g.state
28
- state.scope.nest_scope self
29
-
30
- blk = new_block_generator g, block_arguments
31
-
32
- blk.push_state self
33
- blk.state.push_super state.super
34
- blk.state.push_eval state.eval
35
-
36
- blk.state.push_name blk.name
37
-
38
- # Push line info down.
39
- pos(blk)
40
-
41
- block_arguments.bytecode(blk)
42
-
43
- blk.state.push_block
44
- blk.push_modifiers
45
- blk.break = nil
46
- blk.next = nil
47
- blk.redo = blk.new_label
48
- blk.redo.set!
49
-
50
- block_body.compile(blk)
51
-
52
- blk.pop_modifiers
53
- blk.state.pop_block
54
- blk.ret
55
- blk.close
56
- blk.pop_state
57
-
58
- blk.splat_index = block_arguments.splat_index
59
- blk.local_count = local_count
60
- blk.local_names = local_names
61
-
62
- g.create_block blk
63
-
64
- g.push_cpath_top
65
- g.find_const :Proc
66
- g.swap
67
- g.send :__from_block__, 1
68
- end
69
-
70
- def as_message(send)
71
- case send.receiver
72
- when Send
73
- if send.receiver.method_name == "[]"
74
- dup.tap do |b|
75
- b.arguments = send.receiver.arguments
76
- end.as_message(send.receiver)
77
- else
78
- send.receiver.dup.tap do |s|
79
- s.block = self
80
- end
81
- end
82
- when Variable, Unquote,
83
- Constant, ScopedConstant, ToplevelConstant
84
- send.receiver = send.receiver.to_send
85
- as_message(send)
86
- when List
87
- dup.tap do |b|
88
- b.arguments = send.receiver.elements
89
- end
90
- else
91
- unless send.method_name
92
- raise "unknown receiver for block: #{send.receiver.inspect}"
93
- end
94
- end
95
- end
96
- end
97
-
98
- class InlinedBody < Node
99
- children [:expressions]
100
- generate
101
-
102
- attr_accessor :parent
103
-
104
- def variables
105
- @variables ||= {}
106
- end
107
-
108
- def local_count
109
- @parent.local_names
110
- end
111
-
112
- def local_names
113
- @parent.local_names
114
- end
115
-
116
- def allocate_slot
117
- @parent.allocate_slot
118
- end
119
-
120
- def nest_scope(scope)
121
- scope.parent = self
122
- end
123
-
124
- def search_local(name)
125
- if variable = variables[name]
126
- variable.nested_reference
127
- else
128
- @parent.search_local(name)
129
- end
130
- end
131
-
132
- def pseudo_local(name)
133
- if variable = variables[name]
134
- variable.nested_reference
135
- elsif reference = @parent.search_local(name)
136
- reference.depth += 1
137
- reference
138
- end
139
- end
140
-
141
- def new_local(name)
142
- variables[name] =
143
- @parent.new_local(name + ":" + @parent.allocate_slot.to_s)
144
- end
145
-
146
- def new_nested_local(name)
147
- @parent.new_local(name).nested_reference
148
- end
149
-
150
- def empty?
151
- @expressions.empty?
152
- end
153
-
154
- def setup(g)
155
- g.state.scope.nest_scope self
156
-
157
- blk = g.state.block?
158
- ens = g.state.ensure?
159
- res = g.state.rescue?
160
- lop = g.state.loop?
161
- msn = g.state.masgn?
162
-
163
- g.push_state self
164
-
165
- g.state.push_block if blk
166
- g.state.push_ensure if ens
167
- g.state.push_rescue(res) if res
168
- g.state.push_loop if lop
169
- g.state.push_masgn if msn
170
- end
171
-
172
- def reset(g)
173
- g.pop_state
174
- end
175
-
176
- def bytecode(g)
177
- pos(g)
178
-
179
- setup(g)
180
-
181
- g.push_nil if empty?
182
-
183
- @expressions.each_with_index do |node,idx|
184
- g.pop unless idx == 0
185
- node.compile(g)
186
- end
187
-
188
- reset(g)
189
- end
190
- end
191
-
192
- class BlockArguments
193
- attr_reader :arguments
194
-
195
- def initialize(args)
196
- @arguments = args.collect(&:to_pattern)
197
- end
198
-
199
- def bytecode(g)
200
- return if @arguments.empty?
201
-
202
- if @arguments.last.kind_of?(Patterns::BlockPass)
203
- g.push_block_arg
204
- @arguments.pop.deconstruct(g)
205
- end
206
-
207
- g.cast_for_splat_block_arg
208
- @arguments.each do |a|
209
- if a.kind_of?(Patterns::Splat)
210
- a.pattern.deconstruct(g)
211
- return
212
- else
213
- g.shift_array
214
- a.match(g)
215
- end
216
- end
217
- g.pop
218
- end
219
-
220
- def local_names
221
- @arguments.collect { |a| a.local_names }.flatten
222
- end
223
-
224
- def size
225
- @arguments.size
226
- end
227
-
228
- def locals
229
- local_names.size
230
- end
231
-
232
- def required_args
233
- size
234
- end
235
-
236
- def total_args
237
- size
238
- end
239
-
240
- def splat_index
241
- @arguments.each do |a,i|
242
- return i if a.kind_of?(Patterns::Splat)
243
- end
244
- nil
245
- end
246
- end
247
-
248
- class BlockBody < Node
249
- children [:expressions]
250
- generate
251
-
252
- def empty?
253
- @expressions.empty?
254
- end
255
-
256
- def bytecode(g)
257
- pos(g)
258
-
259
- g.push_nil if empty?
260
-
261
- @expressions.each_with_index do |node,idx|
262
- g.pop unless idx == 0
263
- node.compile(g)
264
- end
265
- end
266
- end
267
- end
268
- end
data/lib/ast/constant.rb DELETED
@@ -1,88 +0,0 @@
1
- module Atomy
2
- module AST
3
- class Constant < Node
4
- attributes :identifier
5
- generate
6
-
7
- def name
8
- @identifier.to_sym
9
- end
10
-
11
- def bytecode(g)
12
- pos(g)
13
- g.push_const name
14
- end
15
-
16
- def assign(g, v)
17
- g.push_scope
18
- g.push_literal name
19
- v.compile(g)
20
- g.send :const_set, 2
21
- end
22
-
23
- def as_message(send)
24
- send.dup.tap do |s|
25
- s.method_name = @identifier
26
- end
27
- end
28
- end
29
-
30
- class ToplevelConstant < Node
31
- attributes :identifier
32
- generate
33
-
34
- def name
35
- @identifier.to_sym
36
- end
37
-
38
- def bytecode(g)
39
- pos(g)
40
- g.push_cpath_top
41
- g.find_const name
42
- end
43
-
44
- def assign(g, v)
45
- g.push_cpath_top
46
- g.push_literal name
47
- v.compile(g)
48
- g.send :const_set, 2
49
- end
50
-
51
- def as_message(send)
52
- send.dup.tap do |s|
53
- s.method_name = @identifier
54
- end
55
- end
56
- end
57
-
58
- class ScopedConstant < Node
59
- children :parent
60
- attributes :identifier
61
- generate
62
-
63
- def name
64
- @identifier.to_sym
65
- end
66
-
67
- def bytecode(g)
68
- pos(g)
69
- @parent.compile(g)
70
- g.find_const name
71
- end
72
-
73
- def assign(g, v)
74
- @parent.compile(g)
75
- g.push_literal name
76
- v.compile(g)
77
- g.send :const_set, 2
78
- end
79
-
80
- def as_message(send)
81
- send.dup.tap do |s|
82
- s.method_name = @identifier
83
- s.receiver = @parent
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,19 +0,0 @@
1
- module Atomy
2
- module AST
3
- class Assign < Node
4
- children :lhs, :rhs
5
- generate
6
-
7
- def bytecode(g)
8
- pos(g)
9
-
10
- if @lhs.respond_to?(:assign)
11
- @lhs.assign(g, @rhs)
12
- return
13
- end
14
-
15
- @lhs.to_pattern.assign(g, @rhs)
16
- end
17
- end
18
- end
19
- end
@@ -1,21 +0,0 @@
1
- module Atomy::AST
2
- class BlockPass < Node
3
- children :body
4
- generate
5
- def bytecode(g)
6
- @body.compile(g)
7
- nil_block = g.new_label
8
- g.dup
9
- g.is_nil
10
- g.git nil_block
11
-
12
- g.push_cpath_top
13
- g.find_const :Proc
14
-
15
- g.swap
16
- g.send :__from_block__, 1
17
-
18
- nil_block.set!
19
- end
20
- end
21
- end
@@ -1,247 +0,0 @@
1
- module Atomy
2
- module AST
3
- class Catch < Node
4
- children :body, [:handlers], :else?
5
- generate
6
-
7
- # via Rubinius::AST::Rescue
8
- def bytecode(g)
9
- pos(g)
10
-
11
- g.push_modifiers
12
- if @body.nil?
13
- if @else.nil?
14
- # Stupid. No body and no else.
15
- g.push :nil
16
- else
17
- # Only an else, run it.
18
- @else.compile(g)
19
- end
20
- else
21
- outer_retry = g.retry
22
-
23
- this_retry = g.new_label
24
- reraise = g.new_label
25
- els = g.new_label
26
- done = g.new_label
27
-
28
- # Save the current exception into a stack local
29
- g.push_exception_state
30
- outer_exc_state = g.new_stack_local
31
- g.set_stack_local outer_exc_state
32
- g.pop
33
-
34
- this_retry.set!
35
- ex = g.new_label
36
- g.setup_unwind ex, Rubinius::AST::RescueType
37
-
38
- # TODO: ?
39
- g.new_label.set!
40
-
41
- if current_break = g.break
42
- # Make a break available to use, which we'll use to
43
- # lazily generate a cleanup area
44
- g.break = g.new_label
45
- end
46
-
47
- # Setup a lazy cleanup area for next'ing out of the handler
48
- current_next = g.next
49
- g.next = g.new_label
50
-
51
- # Use a lazy label to patch up prematuraly leaving a begin
52
- # body via retry.
53
- if outer_retry
54
- g.retry = g.new_label
55
- end
56
-
57
- # Also handle redo unwinding through the rescue
58
- if current_redo = g.redo
59
- g.redo = g.new_label
60
- end
61
-
62
- @body.compile(g)
63
- g.pop_unwind
64
- g.goto els
65
-
66
- if current_break
67
- if g.break.used?
68
- g.break.set!
69
- g.pop_unwind
70
-
71
- # Reset the outer exception
72
- g.push_stack_local outer_exc_state
73
- g.restore_exception_state
74
-
75
- g.goto current_break
76
- end
77
-
78
- g.break = current_break
79
- end
80
-
81
- if g.next.used?
82
- g.next.set!
83
- g.pop_unwind
84
-
85
- # Reset the outer exception
86
- g.push_stack_local outer_exc_state
87
- g.restore_exception_state
88
-
89
- if current_next
90
- g.goto current_next
91
- else
92
- g.ret
93
- end
94
- end
95
-
96
- g.next = current_next
97
-
98
- if current_redo
99
- if g.redo.used?
100
- g.redo.set!
101
- g.pop_unwind
102
-
103
- # Reset the outer exception
104
- g.push_stack_local outer_exc_state
105
- g.restore_exception_state
106
-
107
- g.goto current_redo
108
- end
109
-
110
- g.redo = current_redo
111
- end
112
-
113
- if outer_retry
114
- if g.retry.used?
115
- g.retry.set!
116
- g.pop_unwind
117
-
118
- # Reset the outer exception
119
- g.push_stack_local outer_exc_state
120
- g.restore_exception_state
121
-
122
- g.goto outer_retry
123
- end
124
-
125
- g.retry = outer_retry
126
- end
127
-
128
- # We jump here if an exception has occured in the body
129
- ex.set!
130
-
131
- # Expose the retry label here only, not before this.
132
- g.retry = this_retry
133
-
134
- # Save exception state to use in reraise
135
- g.push_exception_state
136
-
137
- raised_exc_state = g.new_stack_local
138
- g.set_stack_local raised_exc_state
139
- g.pop
140
-
141
- # Save the current exception, so that calling #=== can't trample
142
- # it.
143
- g.push_current_exception
144
-
145
- @handlers.each_with_index do |p, i|
146
- last = i + 1 == @handlers.size
147
- n = last ? nil : g.new_label
148
- handler_bytecode(g, p.lhs.to_pattern, p.rhs, reraise, done, outer_exc_state, n)
149
- n.set! unless last
150
- end
151
-
152
- reraise.set!
153
-
154
- # Restore the exception state we saved and the reraise. The act
155
- # of checking if an exception matches can run any code, which
156
- # can easily trample on the current exception.
157
- #
158
- # Remove the direct exception so we can get to the state
159
- g.pop
160
-
161
- # Restore the state and reraise
162
- g.push_stack_local raised_exc_state
163
- g.restore_exception_state
164
- g.reraise
165
-
166
- els.set!
167
- if @else
168
- g.pop
169
- @else.compile(g)
170
- end
171
-
172
- done.set!
173
-
174
- g.push_stack_local outer_exc_state
175
- g.restore_exception_state
176
- end
177
- g.pop_modifiers
178
- end
179
-
180
- def handler_bytecode(g, pattern, expression, reraise, done, outer_exc_state, next_handler = nil)
181
- body = g.new_label
182
-
183
- g.dup
184
- pattern.matches?(g)
185
- g.git body
186
-
187
- if next_handler
188
- g.goto next_handler
189
- else
190
- g.goto reraise
191
- end
192
-
193
- body.set!
194
-
195
- pattern.deconstruct(g)
196
-
197
- current_break = g.break
198
- g.break = g.new_label
199
-
200
- current_next = g.next
201
- g.next = g.new_label
202
-
203
- g.state.push_rescue(outer_exc_state)
204
- expression.compile(g)
205
- g.state.pop_rescue
206
-
207
- g.clear_exception
208
- g.goto done
209
-
210
- if g.break.used?
211
- g.break.set!
212
- g.clear_exception
213
-
214
- # Reset the outer exception
215
- g.push_stack_local outer_exc_state
216
- g.restore_exception_state
217
-
218
- if current_break
219
- g.goto current_break
220
- else
221
- g.raise_break
222
- end
223
- end
224
-
225
- g.break = current_break
226
-
227
- if g.next.used?
228
- g.next.set!
229
-
230
- g.clear_exception
231
-
232
- # Reset the outer exception
233
- g.push_stack_local outer_exc_state
234
- g.restore_exception_state
235
-
236
- if current_next
237
- g.goto current_next
238
- else
239
- g.ret
240
- end
241
- end
242
-
243
- g.next = current_next
244
- end
245
- end
246
- end
247
- end