myco 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myco/bootstrap/instance.rb +13 -3
- data/lib/myco/code_tools/AST.my +0 -2
- data/lib/myco/code_tools/AST.my.rb +0 -1
- data/lib/myco/code_tools/AST/Block.my +15 -4
- data/lib/myco/code_tools/AST/Block.my.rb +16 -3
- data/lib/myco/code_tools/AST/DeclareMeme.my +44 -64
- data/lib/myco/code_tools/AST/DeclareMeme.my.rb +66 -74
- data/lib/myco/code_tools/AST/ToRuby.my +17 -20
- data/lib/myco/code_tools/AST/ToRuby.my.rb +24 -22
- data/lib/myco/code_tools/Parser.my +2 -1
- data/lib/myco/code_tools/Parser.my.rb +2 -1
- data/lib/myco/code_tools/parser/MycoBuilder.my +2 -2
- data/lib/myco/code_tools/parser/MycoBuilder.my.rb +2 -2
- data/lib/myco/code_tools/parser/MycoGrammar.my +28 -21
- data/lib/myco/code_tools/parser/MycoGrammar.my.rb +94 -56
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces.my +10 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces.my.rb +10 -9
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my +25 -3
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my.rb +38 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Capture.my +152 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Capture.my.rb +189 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common.my +84 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common.my.rb +114 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common/Parser.my +139 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/{BytecodeParser.my.rb → Common/Parser.my.rb} +17 -36
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Composite.my +229 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Composite.my.rb +296 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my +8 -25
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my.rb +9 -37
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my +139 -37
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my.rb +206 -36
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my +21 -12
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb +45 -24
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream.my +99 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream.my.rb +152 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream/Parser.my +37 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream/Parser.my.rb +57 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String.my +136 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String.my.rb +147 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String/Parser.my +45 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String/Parser.my.rb +85 -0
- data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my +31 -25
- data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my.rb +44 -25
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Parser.test.my +49 -0
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Parser.test.my.rb +119 -0
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Patterns.test.my +131 -0
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Patterns.test.my.rb +595 -0
- data/lib/myco/code_tools/parser/pegleromyces/spec/{BytecodeParser.test.my → String/Parser.test.my} +41 -2
- data/lib/myco/code_tools/parser/pegleromyces/spec/{BytecodeParser.test.my.rb → String/Parser.test.my.rb} +144 -3
- data/lib/myco/code_tools/parser/pegleromyces/spec/run.my +4 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/run.my.rb +4 -8
- data/lib/myco/core.my +1 -0
- data/lib/myco/core.my.rb +1 -0
- data/lib/myco/core/BasicObject.my +4 -2
- data/lib/myco/core/BasicObject.my.rb +2 -5
- data/lib/myco/core/Loop.my +5 -0
- data/lib/myco/core/Loop.my.rb +13 -0
- data/lib/myco/dev.rb +1 -0
- data/lib/myco/dev/profile.rb +12 -0
- data/lib/myco/version.rb +3 -3
- metadata +54 -59
- data/lib/myco/code_tools/AST/DeclareDecorator.my +0 -19
- data/lib/myco/code_tools/AST/DeclareDecorator.my.rb +0 -24
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Builder.my +0 -4
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Builder.my.rb +0 -5
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my +0 -420
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my.rb +0 -415
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my +0 -147
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Constructions.my +0 -183
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Constructions.my.rb +0 -370
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Instructions.my +0 -139
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Instructions.my.rb +0 -284
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Machine.my +0 -37
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Machine.my.rb +0 -24
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my +0 -123
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my.rb +0 -164
- data/lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my +0 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my.rb +0 -9
- data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my +0 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my.rb +0 -9
- data/lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my +0 -229
- data/lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my.rb +0 -663
- data/lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my +0 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my.rb +0 -9
- data/lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my +0 -13
- data/lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my.rb +0 -20
- data/lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my +0 -54
- data/lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my.rb +0 -215
@@ -3,6 +3,7 @@ BytecodeHelpers < BasicDecorators {
|
|
3
3
|
##
|
4
4
|
# Bytecode Generation Helper Methods
|
5
5
|
|
6
|
+
var debug_mode: false
|
6
7
|
var overall_fail: new_label
|
7
8
|
|
8
9
|
g: self # For consistency
|
@@ -35,6 +36,9 @@ BytecodeHelpers < BasicDecorators {
|
|
35
36
|
g.push_captures; g.send(:concat, 1); g.set_captures; g.pop
|
36
37
|
|
37
38
|
push_subject_at_idx:
|
39
|
+
g.push_subject; g.push_idx; g.send(:at, 1)
|
40
|
+
|
41
|
+
push_subject_chr_at_idx:
|
38
42
|
g.push_subject; g.push_idx; g.send(:chr_at, 1)
|
39
43
|
|
40
44
|
push_new_table:
|
@@ -114,7 +118,10 @@ BytecodeHelpers < BasicDecorators {
|
|
114
118
|
g.local_count = 2
|
115
119
|
g.local_names = [:subject, :idx]
|
116
120
|
|
117
|
-
|
121
|
+
g.debug_mode && (
|
122
|
+
g.push_idx; g.inspect_top; g.pop
|
123
|
+
g.puts_string("trying.. "g.name"")
|
124
|
+
)
|
118
125
|
}
|
119
126
|
|
120
127
|
# Wrap up a compiled parser method
|
@@ -123,13 +130,19 @@ BytecodeHelpers < BasicDecorators {
|
|
123
130
|
|
124
131
|
# end
|
125
132
|
g.push_idx
|
126
|
-
|
133
|
+
g.debug_mode && (
|
134
|
+
g.push_idx; g.inspect_top; g.pop
|
135
|
+
g.puts_string("SUCCESS! "g.name"")
|
136
|
+
)
|
127
137
|
g.goto(overall_done)
|
128
138
|
|
129
139
|
# fail
|
130
140
|
g.overall_fail.set!
|
131
141
|
g.push_nil
|
132
|
-
|
142
|
+
g.debug_mode && (
|
143
|
+
g.push_idx; g.inspect_top; g.pop
|
144
|
+
g.puts_string("failure: "g.name"")
|
145
|
+
)
|
133
146
|
|
134
147
|
overall_done.set!
|
135
148
|
g.ret
|
@@ -143,4 +156,13 @@ BytecodeHelpers < BasicDecorators {
|
|
143
156
|
item.is_a?(Array)
|
144
157
|
&? push_literal_array(item)
|
145
158
|
?? push_literal(item)
|
159
|
+
|
160
|
+
capture: |*metadata| {
|
161
|
+
g.push_captures
|
162
|
+
g.push_idx
|
163
|
+
g.push_literal_array(metadata)
|
164
|
+
g.make_array(2)
|
165
|
+
g.send(:push, 1)
|
166
|
+
g.pop
|
167
|
+
}
|
146
168
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.cscope.for_method_definition::BytecodeHelpers = ::Myco::Component.new([::Myco.find_constant(:BasicDecorators)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
+
declare_meme(:debug_mode, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (false)}
|
5
6
|
declare_meme(:overall_fail, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (self.new_label)}
|
6
7
|
declare_meme(:g, [], nil, ::Myco.cscope.dup) { |*| (self)}
|
7
8
|
declare_meme(:puts_string, [], nil, ::Myco.cscope.dup) { |string| (
|
@@ -57,6 +58,14 @@
|
|
57
58
|
self.g.pop
|
58
59
|
)}
|
59
60
|
declare_meme(:push_subject_at_idx, [], nil, ::Myco.cscope.dup) { |*| (
|
61
|
+
self.g.push_subject
|
62
|
+
self.g.push_idx
|
63
|
+
self.g.send(
|
64
|
+
:at,
|
65
|
+
1
|
66
|
+
)
|
67
|
+
)}
|
68
|
+
declare_meme(:push_subject_chr_at_idx, [], nil, ::Myco.cscope.dup) { |*| (
|
60
69
|
self.g.push_subject
|
61
70
|
self.g.push_idx
|
62
71
|
self.g.send(
|
@@ -158,13 +167,31 @@
|
|
158
167
|
:idx
|
159
168
|
]
|
160
169
|
)
|
170
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
171
|
+
self.g.push_idx
|
172
|
+
self.g.inspect_top
|
173
|
+
self.g.pop
|
174
|
+
self.g.puts_string("trying.. #{self.g.name}")
|
175
|
+
)}
|
161
176
|
)}
|
162
177
|
declare_meme(:rule_finish, [], nil, ::Myco.cscope.dup) { |*| (
|
163
178
|
overall_done = self.g.new_label
|
164
179
|
self.g.push_idx
|
180
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
181
|
+
self.g.push_idx
|
182
|
+
self.g.inspect_top
|
183
|
+
self.g.pop
|
184
|
+
self.g.puts_string("SUCCESS! #{self.g.name}")
|
185
|
+
)}
|
165
186
|
self.g.goto(overall_done)
|
166
187
|
self.g.overall_fail.__send__(:set!)
|
167
188
|
self.g.push_nil
|
189
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
190
|
+
self.g.push_idx
|
191
|
+
self.g.inspect_top
|
192
|
+
self.g.pop
|
193
|
+
self.g.puts_string("failure: #{self.g.name}")
|
194
|
+
)}
|
168
195
|
overall_done.__send__(:set!)
|
169
196
|
self.g.ret
|
170
197
|
self.g.close
|
@@ -177,5 +204,16 @@
|
|
177
204
|
:is_a?,
|
178
205
|
::Myco.find_constant(:Array)
|
179
206
|
)) {self.push_literal_array(item)}) {self.push_literal(item)})}
|
207
|
+
declare_meme(:capture, [], nil, ::Myco.cscope.dup) { |*metadata| (
|
208
|
+
self.g.push_captures
|
209
|
+
self.g.push_idx
|
210
|
+
self.g.push_literal_array(metadata)
|
211
|
+
self.g.make_array(2)
|
212
|
+
self.g.send(
|
213
|
+
:push,
|
214
|
+
1
|
215
|
+
)
|
216
|
+
self.g.pop
|
217
|
+
)}
|
180
218
|
)}}
|
181
219
|
.tap { |__c__| __c__.__name__ = :BytecodeHelpers })}}.instance
|
@@ -0,0 +1,152 @@
|
|
1
|
+
|
2
|
+
Capture < EmptyObject {
|
3
|
+
Patterns < EmptyObject {
|
4
|
+
UnaryBase < Common::Patterns::UnaryBase { }
|
5
|
+
|
6
|
+
NamedCapture < UnaryBase {
|
7
|
+
construct: Constructions::NamedCapture.new(
|
8
|
+
inner: inner.construct
|
9
|
+
captargs: [self.name]
|
10
|
+
)
|
11
|
+
}
|
12
|
+
NamedTextCapture < UnaryBase {
|
13
|
+
construct: Constructions::NamedTextCapture.new(
|
14
|
+
inner: inner.construct
|
15
|
+
captargs: [self.name]
|
16
|
+
)
|
17
|
+
}
|
18
|
+
NamedTokenCapture < UnaryBase {
|
19
|
+
construct: Constructions::NamedTokenCapture.new(
|
20
|
+
inner: inner.construct
|
21
|
+
captargs: [self.name]
|
22
|
+
)
|
23
|
+
}
|
24
|
+
Reduction < UnaryBase { var block, var args: []
|
25
|
+
construct: Constructions::Reduction.new(
|
26
|
+
inner: inner.construct
|
27
|
+
captargs: [self.code, *self.args]
|
28
|
+
)
|
29
|
+
}
|
30
|
+
|
31
|
+
RuleCall < UnaryBase { var name
|
32
|
+
construct: Constructions::RuleCall.new(name: name)
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
Constructions < EmptyObject {
|
37
|
+
UnaryBase < Common::Constructions::UnaryBase { }
|
38
|
+
|
39
|
+
NamedCapture < UnaryBase { var captargs }
|
40
|
+
NamedTextCapture < UnaryBase { var captargs }
|
41
|
+
NamedTokenCapture < UnaryBase { var captargs }
|
42
|
+
Reduction < UnaryBase { var captargs }
|
43
|
+
|
44
|
+
RuleCall < UnaryBase { var name }
|
45
|
+
}
|
46
|
+
|
47
|
+
Patterns << {
|
48
|
+
##
|
49
|
+
# Reduction and associated named captures implementation
|
50
|
+
|
51
|
+
Reduction << {
|
52
|
+
Environment < EmptyObject, BasicDecorators {
|
53
|
+
var captures # A Hash of capture names to values
|
54
|
+
var builder # The fallback delegate for methods that are not capture names
|
55
|
+
|
56
|
+
method_missing: |name, *args, &block|
|
57
|
+
captures.fetch(name) { builder.__send__(name, *args, &block) }
|
58
|
+
|
59
|
+
# Implement the action for the reduction in the '!' method.
|
60
|
+
# It will have access to the captures via method_missing.
|
61
|
+
"!": null
|
62
|
+
}
|
63
|
+
|
64
|
+
code: block.block.compiled_code
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
Constructions << {
|
69
|
+
UnaryBase << { const bytecode_can_capture?: true }
|
70
|
+
|
71
|
+
NamedCapture << { bytecode: |g| {
|
72
|
+
Rubinius::Type.object_respond_to?(inner, :inlaid) &? (
|
73
|
+
inner.inlaid = &{ g.capture(:m_split, captargs) }
|
74
|
+
g.capture(:m_start)
|
75
|
+
inner.bytecode(g)
|
76
|
+
g.capture(:m_end, captargs)
|
77
|
+
) ?? (
|
78
|
+
g.capture(:c_start)
|
79
|
+
inner.bytecode(g)
|
80
|
+
g.capture(:c_end, captargs)
|
81
|
+
)
|
82
|
+
}}
|
83
|
+
|
84
|
+
NamedTextCapture << { bytecode: |g| {
|
85
|
+
g.capture(:s_start)
|
86
|
+
inner.bytecode(g)
|
87
|
+
g.capture(:s_end, captargs)
|
88
|
+
}}
|
89
|
+
|
90
|
+
NamedTokenCapture << { bytecode: |g| {
|
91
|
+
g.capture(:t_start)
|
92
|
+
inner.bytecode(g)
|
93
|
+
g.capture(:t_end, captargs)
|
94
|
+
}}
|
95
|
+
|
96
|
+
Reduction << { bytecode: |g| {
|
97
|
+
g.capture(:r_start)
|
98
|
+
inner.bytecode(g)
|
99
|
+
g.capture(:r_end, captargs)
|
100
|
+
}}
|
101
|
+
|
102
|
+
RuleCall << { bytecode: |g| {
|
103
|
+
memoize = true
|
104
|
+
result_check = g.new_label
|
105
|
+
memo_result_check = g.new_label
|
106
|
+
local_success = g.new_label
|
107
|
+
local_fail = g.new_label
|
108
|
+
|
109
|
+
# Push @captures onto stack and set @captures to a new empty array
|
110
|
+
g.push_temp_captures
|
111
|
+
|
112
|
+
if(memoize) {
|
113
|
+
# Check if a memoized result exists;
|
114
|
+
# If one does, go straight to memo_result_check label
|
115
|
+
g.memo_or_eq_new_hash(name)
|
116
|
+
g.goto_if_memo_for_idx(name, memo_result_check)
|
117
|
+
}
|
118
|
+
|
119
|
+
# Call the method; sets @captures and returns the result_idx (or nil)
|
120
|
+
g.push_self
|
121
|
+
g.push_subject
|
122
|
+
g.push_idx
|
123
|
+
g.send(name, 2)
|
124
|
+
|
125
|
+
# Check result and memoize the result
|
126
|
+
result_check.set!
|
127
|
+
g.copy_result_to_memo(name)
|
128
|
+
g.dup_top
|
129
|
+
g.goto_if_true(local_success)
|
130
|
+
g.goto(local_fail)
|
131
|
+
|
132
|
+
if(memoize) {
|
133
|
+
# Check result, but skip memo copy
|
134
|
+
memo_result_check.set!
|
135
|
+
g.dup_top
|
136
|
+
g.goto_if_true(local_success)
|
137
|
+
g.goto(local_fail)
|
138
|
+
}
|
139
|
+
|
140
|
+
# Failure, reject index and captures
|
141
|
+
local_fail.set!
|
142
|
+
g.pop # reject idx (which is actually null here)
|
143
|
+
g.pop_to_reject_captures
|
144
|
+
g.goto(g.overall_fail)
|
145
|
+
|
146
|
+
# Success, accept new index and captures
|
147
|
+
local_success.set!
|
148
|
+
g.pop_to_set_idx # set to the new index given by the call's return value
|
149
|
+
g.pop_to_accept_captures
|
150
|
+
}}
|
151
|
+
}
|
152
|
+
}
|
@@ -0,0 +1,189 @@
|
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.cscope.for_method_definition::Capture = ::Myco::Component.new([::Myco.find_constant(:EmptyObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
+
::Myco.cscope.for_method_definition::Patterns = ::Myco::Component.new([::Myco.find_constant(:EmptyObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
6
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
7
|
+
::Myco.cscope.for_method_definition::UnaryBase = ::Myco::Component.new([::Myco.find_constant(:Common)::Patterns::UnaryBase], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
8
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
9
|
+
.tap { |__c__| __c__.__name__ = :UnaryBase }
|
10
|
+
::Myco.cscope.for_method_definition::NamedCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
11
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:construct, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Constructions)::NamedCapture.new({
|
12
|
+
:inner => self.inner.construct,
|
13
|
+
:captargs => [self.name]
|
14
|
+
}))})}}
|
15
|
+
.tap { |__c__| __c__.__name__ = :NamedCapture }
|
16
|
+
::Myco.cscope.for_method_definition::NamedTextCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
17
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:construct, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Constructions)::NamedTextCapture.new({
|
18
|
+
:inner => self.inner.construct,
|
19
|
+
:captargs => [self.name]
|
20
|
+
}))})}}
|
21
|
+
.tap { |__c__| __c__.__name__ = :NamedTextCapture }
|
22
|
+
::Myco.cscope.for_method_definition::NamedTokenCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
23
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:construct, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Constructions)::NamedTokenCapture.new({
|
24
|
+
:inner => self.inner.construct,
|
25
|
+
:captargs => [self.name]
|
26
|
+
}))})}}
|
27
|
+
.tap { |__c__| __c__.__name__ = :NamedTokenCapture }
|
28
|
+
::Myco.cscope.for_method_definition::Reduction = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
29
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
30
|
+
declare_meme(:block, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
31
|
+
declare_meme(:args, [[:var, []]], nil, ::Myco.cscope.dup) { |*| ([])}
|
32
|
+
declare_meme(:construct, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Constructions)::Reduction.new({
|
33
|
+
:inner => self.inner.construct,
|
34
|
+
:captargs => [
|
35
|
+
self.code,
|
36
|
+
*self.args
|
37
|
+
]
|
38
|
+
}))}
|
39
|
+
)}}
|
40
|
+
.tap { |__c__| __c__.__name__ = :Reduction }
|
41
|
+
::Myco.cscope.for_method_definition::RuleCall = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
42
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
43
|
+
declare_meme(:name, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
44
|
+
declare_meme(:construct, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Constructions)::RuleCall.new({:name => self.name}))}
|
45
|
+
)}}
|
46
|
+
.tap { |__c__| __c__.__name__ = :RuleCall }
|
47
|
+
)}}
|
48
|
+
.tap { |__c__| __c__.__name__ = :Patterns }
|
49
|
+
::Myco.cscope.for_method_definition::Constructions = ::Myco::Component.new([::Myco.find_constant(:EmptyObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
50
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
51
|
+
::Myco.cscope.for_method_definition::UnaryBase = ::Myco::Component.new([::Myco.find_constant(:Common)::Constructions::UnaryBase], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
52
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
53
|
+
.tap { |__c__| __c__.__name__ = :UnaryBase }
|
54
|
+
::Myco.cscope.for_method_definition::NamedCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
55
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:captargs, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil})}}
|
56
|
+
.tap { |__c__| __c__.__name__ = :NamedCapture }
|
57
|
+
::Myco.cscope.for_method_definition::NamedTextCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
58
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:captargs, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil})}}
|
59
|
+
.tap { |__c__| __c__.__name__ = :NamedTextCapture }
|
60
|
+
::Myco.cscope.for_method_definition::NamedTokenCapture = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
61
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:captargs, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil})}}
|
62
|
+
.tap { |__c__| __c__.__name__ = :NamedTokenCapture }
|
63
|
+
::Myco.cscope.for_method_definition::Reduction = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
64
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:captargs, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil})}}
|
65
|
+
.tap { |__c__| __c__.__name__ = :Reduction }
|
66
|
+
::Myco.cscope.for_method_definition::RuleCall = ::Myco::Component.new([::Myco.find_constant(:UnaryBase)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
67
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:name, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil})}}
|
68
|
+
.tap { |__c__| __c__.__name__ = :RuleCall }
|
69
|
+
)}}
|
70
|
+
.tap { |__c__| __c__.__name__ = :Constructions }
|
71
|
+
::Myco.find_constant(:Patterns).component_eval {(::Myco.find_constant(:Reduction).component_eval {(
|
72
|
+
::Myco.cscope.for_method_definition::Environment = ::Myco::Component.new([
|
73
|
+
::Myco.find_constant(:EmptyObject),
|
74
|
+
::Myco.find_constant(:BasicDecorators)
|
75
|
+
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
76
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
77
|
+
declare_meme(:captures, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
78
|
+
declare_meme(:builder, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
79
|
+
declare_meme(:method_missing, [], nil, ::Myco.cscope.dup) { |name, *args, &block| (self.captures.fetch(name) { || (self.builder.__send__(
|
80
|
+
name,
|
81
|
+
*args,
|
82
|
+
&block
|
83
|
+
))})}
|
84
|
+
declare_meme(:!, [], nil, ::Myco.cscope.dup) { |*| (nil)}
|
85
|
+
)}}
|
86
|
+
.tap { |__c__| __c__.__name__ = :Environment }
|
87
|
+
declare_meme(:code, [], nil, ::Myco.cscope.dup) { |*| (self.block.block.compiled_code)}
|
88
|
+
)})}
|
89
|
+
::Myco.find_constant(:Constructions).component_eval {(
|
90
|
+
::Myco.find_constant(:UnaryBase).component_eval {(declare_meme(:bytecode_can_capture?, [[:const, []]], nil, ::Myco.cscope.dup) { |*| (true)})}
|
91
|
+
::Myco.find_constant(:NamedCapture).component_eval {(declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", ::Myco.find_constant(:Rubinius)::Type.__send__(
|
92
|
+
:object_respond_to?,
|
93
|
+
self.inner,
|
94
|
+
:inlaid
|
95
|
+
)) {(
|
96
|
+
self.inner.__send__(
|
97
|
+
:inlaid=,
|
98
|
+
::Object::Proc.new { || (g.capture(
|
99
|
+
:m_split,
|
100
|
+
self.captargs
|
101
|
+
))}
|
102
|
+
)
|
103
|
+
g.capture(:m_start)
|
104
|
+
self.inner.bytecode(g)
|
105
|
+
g.capture(
|
106
|
+
:m_end,
|
107
|
+
self.captargs
|
108
|
+
)
|
109
|
+
)}) {(
|
110
|
+
g.capture(:c_start)
|
111
|
+
self.inner.bytecode(g)
|
112
|
+
g.capture(
|
113
|
+
:c_end,
|
114
|
+
self.captargs
|
115
|
+
)
|
116
|
+
)})})}
|
117
|
+
::Myco.find_constant(:NamedTextCapture).component_eval {(declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
118
|
+
g.capture(:s_start)
|
119
|
+
self.inner.bytecode(g)
|
120
|
+
g.capture(
|
121
|
+
:s_end,
|
122
|
+
self.captargs
|
123
|
+
)
|
124
|
+
)})}
|
125
|
+
::Myco.find_constant(:NamedTokenCapture).component_eval {(declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
126
|
+
g.capture(:t_start)
|
127
|
+
self.inner.bytecode(g)
|
128
|
+
g.capture(
|
129
|
+
:t_end,
|
130
|
+
self.captargs
|
131
|
+
)
|
132
|
+
)})}
|
133
|
+
::Myco.find_constant(:Reduction).component_eval {(declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
134
|
+
g.capture(:r_start)
|
135
|
+
self.inner.bytecode(g)
|
136
|
+
g.capture(
|
137
|
+
:r_end,
|
138
|
+
self.captargs
|
139
|
+
)
|
140
|
+
)})}
|
141
|
+
::Myco.find_constant(:RuleCall).component_eval {(declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
142
|
+
memoize = true
|
143
|
+
result_check = g.new_label
|
144
|
+
memo_result_check = g.new_label
|
145
|
+
local_success = g.new_label
|
146
|
+
local_fail = g.new_label
|
147
|
+
g.push_temp_captures
|
148
|
+
self.__send__(
|
149
|
+
:if,
|
150
|
+
memoize
|
151
|
+
) { || (
|
152
|
+
g.memo_or_eq_new_hash(self.name)
|
153
|
+
g.goto_if_memo_for_idx(
|
154
|
+
self.name,
|
155
|
+
memo_result_check
|
156
|
+
)
|
157
|
+
)}
|
158
|
+
g.push_self
|
159
|
+
g.push_subject
|
160
|
+
g.push_idx
|
161
|
+
g.send(
|
162
|
+
self.name,
|
163
|
+
2
|
164
|
+
)
|
165
|
+
result_check.__send__(:set!)
|
166
|
+
g.copy_result_to_memo(self.name)
|
167
|
+
g.dup_top
|
168
|
+
g.goto_if_true(local_success)
|
169
|
+
g.goto(local_fail)
|
170
|
+
self.__send__(
|
171
|
+
:if,
|
172
|
+
memoize
|
173
|
+
) { || (
|
174
|
+
memo_result_check.__send__(:set!)
|
175
|
+
g.dup_top
|
176
|
+
g.goto_if_true(local_success)
|
177
|
+
g.goto(local_fail)
|
178
|
+
)}
|
179
|
+
local_fail.__send__(:set!)
|
180
|
+
g.pop
|
181
|
+
g.pop_to_reject_captures
|
182
|
+
g.goto(g.overall_fail)
|
183
|
+
local_success.__send__(:set!)
|
184
|
+
g.pop_to_set_idx
|
185
|
+
g.pop_to_accept_captures
|
186
|
+
)})}
|
187
|
+
)}
|
188
|
+
)}}
|
189
|
+
.tap { |__c__| __c__.__name__ = :Capture })}}.instance
|