myco 0.1.9 → 0.1.10
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.my.rb +50 -14
- data/lib/myco/bootstrap/add_method.rb +5 -5
- data/lib/myco/bootstrap/meme.rb +2 -1
- data/lib/myco/code_tools/AST.my.rb +211 -43
- data/lib/myco/code_tools/AST/ArgumentAssembly.my.rb +92 -48
- data/lib/myco/code_tools/AST/ArrayAssembly.my.rb +39 -27
- data/lib/myco/code_tools/AST/Block.my.rb +176 -112
- data/lib/myco/code_tools/AST/BlockArgument.my.rb +29 -17
- data/lib/myco/code_tools/AST/BlockLiteral.my.rb +37 -17
- data/lib/myco/code_tools/AST/BlockParameter.my.rb +25 -9
- data/lib/myco/code_tools/AST/BranchOperator.my.rb +95 -75
- data/lib/myco/code_tools/AST/ConstantAccess.my.rb +52 -32
- data/lib/myco/code_tools/AST/ConstantAssignment.my.rb +52 -36
- data/lib/myco/code_tools/AST/ConstantDefine.my.rb +50 -26
- data/lib/myco/code_tools/AST/DeclareCategory.my.rb +38 -18
- data/lib/myco/code_tools/AST/DeclareExtension.my.rb +29 -13
- data/lib/myco/code_tools/AST/DeclareFile.my.rb +51 -31
- data/lib/myco/code_tools/AST/DeclareMeme.my.rb +96 -68
- data/lib/myco/code_tools/AST/DeclareObject.my.rb +66 -42
- data/lib/myco/code_tools/AST/DeclareString.my.rb +39 -19
- data/lib/myco/code_tools/AST/DeclaredScope.my.rb +92 -64
- data/lib/myco/code_tools/AST/Invoke.my +8 -4
- data/lib/myco/code_tools/AST/Invoke.my.rb +74 -31
- data/lib/myco/code_tools/AST/InvokeMethod.my.rb +34 -14
- data/lib/myco/code_tools/AST/KeywordAssembly.my.rb +36 -24
- data/lib/myco/code_tools/AST/KeywordOptionalParameter.my.rb +28 -8
- data/lib/myco/code_tools/AST/KeywordRequiredParameter.my.rb +23 -7
- data/lib/myco/code_tools/AST/KeywordRestParameter.my.rb +23 -7
- data/lib/myco/code_tools/AST/LocalVariableAccessAmbiguous.my.rb +24 -12
- data/lib/myco/code_tools/AST/LocalVariableAssignment.my.rb +30 -10
- data/lib/myco/code_tools/AST/Node.my.rb +234 -102
- data/lib/myco/code_tools/AST/NumericLiteral.my.rb +18 -6
- data/lib/myco/code_tools/AST/OptionalParameter.my.rb +33 -13
- data/lib/myco/code_tools/AST/ParameterAssembly.my.rb +275 -211
- data/lib/myco/code_tools/AST/PipeOperator.my.rb +42 -18
- data/lib/myco/code_tools/AST/Quest.my.rb +65 -37
- data/lib/myco/code_tools/AST/RequiredParameter.my.rb +20 -4
- data/lib/myco/code_tools/AST/RestParameter.my.rb +20 -4
- data/lib/myco/code_tools/AST/Script.my.rb +51 -23
- data/lib/myco/code_tools/AST/Sequence.my.rb +22 -10
- data/lib/myco/code_tools/AST/SplatValue.my.rb +28 -16
- data/lib/myco/code_tools/AST/StringCompose.my.rb +23 -11
- data/lib/myco/code_tools/AST/StringLiteral.my.rb +19 -7
- data/lib/myco/code_tools/AST/SymbolCompose.my.rb +27 -15
- data/lib/myco/code_tools/AST/SymbolLiteral.my.rb +18 -6
- data/lib/myco/code_tools/AST/ToRuby.my.rb +581 -341
- data/lib/myco/code_tools/AST/misc.my.rb +87 -35
- data/lib/myco/code_tools/Parser.my.rb +39 -12
- data/lib/myco/code_tools/parser/MycoBuilder.my.rb +106 -90
- data/lib/myco/code_tools/parser/MycoCharacterClasses.my.rb +98 -50
- data/lib/myco/code_tools/parser/MycoGrammar.my +1 -6
- data/lib/myco/code_tools/parser/MycoGrammar.my.rb +2124 -1710
- data/lib/myco/code_tools/parser/MycoTokens.my +0 -5
- data/lib/myco/code_tools/parser/MycoTokens.my.rb +387 -156
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces.my.rb +55 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my.rb +321 -205
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Capture.my.rb +223 -127
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common.my.rb +188 -72
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common/Parser.my +48 -0
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Common/Parser.my.rb +365 -189
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Composite.my.rb +313 -233
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my.rb +99 -55
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb +493 -325
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream.my.rb +138 -114
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Stream/Parser.my.rb +56 -44
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String.my.rb +173 -93
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/String/Parser.my.rb +90 -70
- data/lib/myco/command.my.rb +85 -25
- data/lib/myco/command/inoculate.my.rb +219 -127
- data/lib/myco/core.my.rb +20 -4
- data/lib/myco/core/BasicDecorators.my.rb +211 -119
- data/lib/myco/core/BasicObject.my.rb +108 -44
- data/lib/myco/core/Category.my.rb +37 -13
- data/lib/myco/core/Decorator.my.rb +35 -27
- data/lib/myco/core/FileToplevel.my.rb +55 -27
- data/lib/myco/core/Loop.my.rb +16 -8
- data/lib/myco/core/Object.my.rb +34 -14
- data/lib/myco/core/Ruby.my.rb +13 -5
- data/lib/myco/core/Switch.my.rb +79 -47
- data/lib/myco/tools/BasicCommand.my.rb +79 -47
- data/lib/myco/tools/mycompile.my.rb +153 -69
- data/lib/myco/version.rb +1 -1
- metadata +34 -52
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my +0 -144
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my.rb +0 -221
- data/lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my +0 -35
- data/lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my.rb +0 -35
- data/lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my +0 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my.rb +0 -9
- data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my +0 -162
- data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my.rb +0 -353
- data/lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my +0 -10
- data/lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my.rb +0 -9
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Parser.test.my +0 -49
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Parser.test.my.rb +0 -119
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Patterns.test.my +0 -131
- data/lib/myco/code_tools/parser/pegleromyces/spec/Stream/Patterns.test.my.rb +0 -595
- data/lib/myco/code_tools/parser/pegleromyces/spec/String/Parser.test.my +0 -120
- data/lib/myco/code_tools/parser/pegleromyces/spec/String/Parser.test.my.rb +0 -350
- data/lib/myco/code_tools/parser/pegleromyces/spec/run.my +0 -14
- data/lib/myco/code_tools/parser/pegleromyces/spec/run.my.rb +0 -12
@@ -1,15 +1,59 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
4
|
-
declare_meme(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
declare_meme(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
declare_meme(
|
4
|
+
declare_meme(
|
5
|
+
:"pegleromyces/Common.my",
|
6
|
+
[:import],
|
7
|
+
::Object::Proc.new { |*| nil}
|
8
|
+
)
|
9
|
+
declare_meme(
|
10
|
+
:"pegleromyces/Capture.my",
|
11
|
+
[:import],
|
12
|
+
::Object::Proc.new { |*| nil}
|
13
|
+
)
|
14
|
+
declare_meme(
|
15
|
+
:"pegleromyces/Composite.my",
|
16
|
+
[:import],
|
17
|
+
::Object::Proc.new { |*| nil}
|
18
|
+
)
|
19
|
+
declare_meme(
|
20
|
+
:"pegleromyces/String.my",
|
21
|
+
[:import],
|
22
|
+
::Object::Proc.new { |*| nil}
|
23
|
+
)
|
24
|
+
declare_meme(
|
25
|
+
:"pegleromyces/Stream.my",
|
26
|
+
[:import],
|
27
|
+
::Object::Proc.new { |*| nil}
|
28
|
+
)
|
29
|
+
declare_meme(
|
30
|
+
:"pegleromyces/Grammar.my",
|
31
|
+
[:import],
|
32
|
+
::Object::Proc.new { |*| nil}
|
33
|
+
)
|
34
|
+
declare_meme(
|
35
|
+
:"pegleromyces/BytecodeHelpers.my",
|
36
|
+
[:import],
|
37
|
+
::Object::Proc.new { |*| nil}
|
38
|
+
)
|
39
|
+
declare_meme(
|
40
|
+
:"pegleromyces/Common/Parser.my",
|
41
|
+
[:import],
|
42
|
+
::Object::Proc.new { |*| nil}
|
43
|
+
)
|
44
|
+
declare_meme(
|
45
|
+
:"pegleromyces/String/Parser.my",
|
46
|
+
[:import],
|
47
|
+
::Object::Proc.new { |*| nil}
|
48
|
+
)
|
49
|
+
declare_meme(
|
50
|
+
:"pegleromyces/Stream/Parser.my",
|
51
|
+
[:import],
|
52
|
+
::Object::Proc.new { |*| nil}
|
53
|
+
)
|
54
|
+
declare_meme(
|
55
|
+
:"pegleromyces/Processor.my",
|
56
|
+
[:import],
|
57
|
+
::Object::Proc.new { |*| nil}
|
58
|
+
)
|
15
59
|
)}}.instance
|
@@ -2,218 +2,334 @@
|
|
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(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
declare_meme(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
self.g.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
self.g.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
self.g.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
self.g.
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
)
|
83
|
-
)
|
84
|
-
declare_meme(
|
85
|
-
|
86
|
-
|
87
|
-
self.g.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
)
|
107
|
-
declare_meme(
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
self.g.set_idx
|
134
|
-
self.g.dup_top
|
135
|
-
self.g.push_ivar(:@highest_idx)
|
136
|
-
self.g.send(
|
137
|
-
:>,
|
138
|
-
1
|
139
|
-
)
|
140
|
-
not_highest_idx_label = self.g.new_label
|
141
|
-
self.g.goto_if_false(not_highest_idx_label)
|
142
|
-
self.g.set_ivar(:@highest_idx)
|
143
|
-
not_highest_idx_label.__send__(:set!)
|
144
|
-
self.g.pop
|
145
|
-
)}
|
146
|
-
declare_meme(:rule_start, [], nil, ::Myco.cscope.dup) { |*| (
|
147
|
-
self.g.__send__(
|
148
|
-
:required_args=,
|
149
|
-
2
|
150
|
-
)
|
151
|
-
self.g.__send__(
|
152
|
-
:total_args=,
|
153
|
-
2
|
154
|
-
)
|
155
|
-
self.g.__send__(
|
156
|
-
:splat_index=,
|
157
|
-
nil
|
158
|
-
)
|
159
|
-
self.g.__send__(
|
160
|
-
:local_count=,
|
161
|
-
2
|
162
|
-
)
|
163
|
-
self.g.__send__(
|
164
|
-
:local_names=,
|
165
|
-
[
|
166
|
-
:subject,
|
167
|
-
:idx
|
168
|
-
]
|
169
|
-
)
|
170
|
-
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
5
|
+
declare_meme(
|
6
|
+
:debug_mode,
|
7
|
+
[:var],
|
8
|
+
::Object::Proc.new { |*| (false)}
|
9
|
+
)
|
10
|
+
declare_meme(
|
11
|
+
:overall_fail,
|
12
|
+
[:var],
|
13
|
+
::Object::Proc.new { |*| (self.new_label)}
|
14
|
+
)
|
15
|
+
declare_meme(
|
16
|
+
:g,
|
17
|
+
[],
|
18
|
+
::Object::Proc.new { |*| (self)}
|
19
|
+
)
|
20
|
+
declare_meme(
|
21
|
+
:puts_string,
|
22
|
+
[],
|
23
|
+
::Object::Proc.new { |string| (
|
24
|
+
self.g.push_rubinius
|
25
|
+
self.g.push_literal(string)
|
26
|
+
self.g.send(
|
27
|
+
:puts,
|
28
|
+
1,
|
29
|
+
true
|
30
|
+
)
|
31
|
+
self.g.pop
|
32
|
+
)}
|
33
|
+
)
|
34
|
+
declare_meme(
|
35
|
+
:inspect_top,
|
36
|
+
[],
|
37
|
+
::Object::Proc.new { |*| (
|
38
|
+
self.g.dup_top
|
39
|
+
self.g.push_rubinius
|
40
|
+
self.g.swap
|
41
|
+
self.g.send(
|
42
|
+
:p,
|
43
|
+
1,
|
44
|
+
true
|
45
|
+
)
|
46
|
+
self.g.pop
|
47
|
+
)}
|
48
|
+
)
|
49
|
+
declare_meme(
|
50
|
+
:set_subject,
|
51
|
+
[],
|
52
|
+
::Object::Proc.new { |*| (self.g.set_local(0))}
|
53
|
+
)
|
54
|
+
declare_meme(
|
55
|
+
:push_subject,
|
56
|
+
[],
|
57
|
+
::Object::Proc.new { |*| (self.g.push_local(0))}
|
58
|
+
)
|
59
|
+
declare_meme(
|
60
|
+
:set_idx,
|
61
|
+
[],
|
62
|
+
::Object::Proc.new { |*| (self.g.set_local(1))}
|
63
|
+
)
|
64
|
+
declare_meme(
|
65
|
+
:push_idx,
|
66
|
+
[],
|
67
|
+
::Object::Proc.new { |*| (self.g.push_local(1))}
|
68
|
+
)
|
69
|
+
declare_meme(
|
70
|
+
:set_captures,
|
71
|
+
[],
|
72
|
+
::Object::Proc.new { |*| (self.g.set_ivar(:@captures))}
|
73
|
+
)
|
74
|
+
declare_meme(
|
75
|
+
:push_captures,
|
76
|
+
[],
|
77
|
+
::Object::Proc.new { |*| (self.g.push_ivar(:@captures))}
|
78
|
+
)
|
79
|
+
declare_meme(
|
80
|
+
:set_memo_for,
|
81
|
+
[],
|
82
|
+
::Object::Proc.new { |name| (self.g.set_ivar(:"@memo_for_#{name}"))}
|
83
|
+
)
|
84
|
+
declare_meme(
|
85
|
+
:push_memo_for,
|
86
|
+
[],
|
87
|
+
::Object::Proc.new { |name| (self.g.push_ivar(:"@memo_for_#{name}"))}
|
88
|
+
)
|
89
|
+
declare_meme(
|
90
|
+
:pop_to_set_idx,
|
91
|
+
[],
|
92
|
+
::Object::Proc.new { |*| (
|
93
|
+
self.g.set_idx
|
94
|
+
self.g.pop
|
95
|
+
)}
|
96
|
+
)
|
97
|
+
declare_meme(
|
98
|
+
:push_temp_captures,
|
99
|
+
[],
|
100
|
+
::Object::Proc.new { |*| (
|
101
|
+
self.g.push_captures
|
102
|
+
self.g.make_array(0)
|
103
|
+
self.g.set_captures
|
104
|
+
self.g.pop
|
105
|
+
)}
|
106
|
+
)
|
107
|
+
declare_meme(
|
108
|
+
:pop_to_reject_captures,
|
109
|
+
[],
|
110
|
+
::Object::Proc.new { |*| (
|
111
|
+
self.g.set_captures
|
112
|
+
self.g.pop
|
113
|
+
)}
|
114
|
+
)
|
115
|
+
declare_meme(
|
116
|
+
:pop_to_accept_captures,
|
117
|
+
[],
|
118
|
+
::Object::Proc.new { |*| (
|
119
|
+
self.g.push_captures
|
120
|
+
self.g.send(
|
121
|
+
:concat,
|
122
|
+
1
|
123
|
+
)
|
124
|
+
self.g.set_captures
|
125
|
+
self.g.pop
|
126
|
+
)}
|
127
|
+
)
|
128
|
+
declare_meme(
|
129
|
+
:push_subject_at_idx,
|
130
|
+
[],
|
131
|
+
::Object::Proc.new { |*| (
|
132
|
+
self.g.push_subject
|
171
133
|
self.g.push_idx
|
172
|
-
self.g.
|
134
|
+
self.g.send(
|
135
|
+
:at,
|
136
|
+
1
|
137
|
+
)
|
138
|
+
)}
|
139
|
+
)
|
140
|
+
declare_meme(
|
141
|
+
:push_subject_chr_at_idx,
|
142
|
+
[],
|
143
|
+
::Object::Proc.new { |*| (
|
144
|
+
self.g.push_subject
|
145
|
+
self.g.push_idx
|
146
|
+
self.g.send(
|
147
|
+
:chr_at,
|
148
|
+
1
|
149
|
+
)
|
150
|
+
)}
|
151
|
+
)
|
152
|
+
declare_meme(
|
153
|
+
:push_new_table,
|
154
|
+
[],
|
155
|
+
::Object::Proc.new { |*| (
|
156
|
+
self.g.push_rubinius
|
157
|
+
self.g.find_const(:LookupTable)
|
158
|
+
self.g.send(
|
159
|
+
:new,
|
160
|
+
0
|
161
|
+
)
|
162
|
+
)}
|
163
|
+
)
|
164
|
+
declare_meme(
|
165
|
+
:memo_or_eq_new_hash,
|
166
|
+
[],
|
167
|
+
::Object::Proc.new { |name| (
|
168
|
+
memo_exists_label = self.g.new_label
|
169
|
+
self.g.push_memo_for(name)
|
170
|
+
self.g.goto_if_true(memo_exists_label)
|
171
|
+
self.g.push_new_table
|
172
|
+
self.g.set_memo_for(name)
|
173
|
+
self.g.pop
|
174
|
+
memo_exists_label.__send__(:set!)
|
175
|
+
)}
|
176
|
+
)
|
177
|
+
declare_meme(
|
178
|
+
:copy_result_to_memo,
|
179
|
+
[],
|
180
|
+
::Object::Proc.new { |name| (
|
181
|
+
self.g.dup_top
|
182
|
+
self.g.push_captures
|
183
|
+
self.g.make_array(2)
|
184
|
+
self.g.push_memo_for(name)
|
185
|
+
self.g.swap
|
186
|
+
self.g.push_idx
|
187
|
+
self.g.swap
|
188
|
+
self.g.send(
|
189
|
+
:[]=,
|
190
|
+
2
|
191
|
+
)
|
192
|
+
self.g.pop
|
193
|
+
)}
|
194
|
+
)
|
195
|
+
declare_meme(
|
196
|
+
:goto_if_memo_for_idx,
|
197
|
+
[],
|
198
|
+
::Object::Proc.new { |name, label| (
|
199
|
+
skip_label = self.g.new_label
|
200
|
+
self.g.push_memo_for(name)
|
201
|
+
self.g.push_idx
|
202
|
+
self.g.send(
|
203
|
+
:[],
|
204
|
+
1
|
205
|
+
)
|
206
|
+
self.g.dup_top
|
207
|
+
self.g.goto_if_nil(skip_label)
|
208
|
+
self.g.shift_array
|
209
|
+
self.g.swap
|
210
|
+
self.g.shift_array
|
211
|
+
self.g.set_captures
|
212
|
+
self.g.pop
|
213
|
+
self.g.pop
|
214
|
+
self.g.goto(label)
|
215
|
+
skip_label.__send__(:set!)
|
173
216
|
self.g.pop
|
174
|
-
self.g.puts_string("trying.. #{self.g.name}")
|
175
217
|
)}
|
176
|
-
)
|
177
|
-
declare_meme(
|
178
|
-
|
179
|
-
|
180
|
-
::
|
218
|
+
)
|
219
|
+
declare_meme(
|
220
|
+
:increment_idx,
|
221
|
+
[],
|
222
|
+
::Object::Proc.new { |*| (
|
181
223
|
self.g.push_idx
|
182
|
-
self.g.
|
224
|
+
self.g.send(
|
225
|
+
:+,
|
226
|
+
1
|
227
|
+
)
|
228
|
+
self.g.set_idx
|
229
|
+
self.g.dup_top
|
230
|
+
self.g.push_ivar(:@highest_idx)
|
231
|
+
self.g.send(
|
232
|
+
:>,
|
233
|
+
1
|
234
|
+
)
|
235
|
+
not_highest_idx_label = self.g.new_label
|
236
|
+
self.g.goto_if_false(not_highest_idx_label)
|
237
|
+
self.g.set_ivar(:@highest_idx)
|
238
|
+
not_highest_idx_label.__send__(:set!)
|
183
239
|
self.g.pop
|
184
|
-
self.g.puts_string("SUCCESS! #{self.g.name}")
|
185
240
|
)}
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
241
|
+
)
|
242
|
+
declare_meme(
|
243
|
+
:rule_start,
|
244
|
+
[],
|
245
|
+
::Object::Proc.new { |*| (
|
246
|
+
self.g.__send__(
|
247
|
+
:required_args=,
|
248
|
+
2
|
249
|
+
)
|
250
|
+
self.g.__send__(
|
251
|
+
:total_args=,
|
252
|
+
2
|
253
|
+
)
|
254
|
+
self.g.__send__(
|
255
|
+
:splat_index=,
|
256
|
+
nil
|
257
|
+
)
|
258
|
+
self.g.__send__(
|
259
|
+
:local_count=,
|
260
|
+
2
|
261
|
+
)
|
262
|
+
self.g.__send__(
|
263
|
+
:local_names=,
|
264
|
+
[
|
265
|
+
:subject,
|
266
|
+
:idx
|
267
|
+
]
|
268
|
+
)
|
269
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
270
|
+
self.g.push_idx
|
271
|
+
self.g.inspect_top
|
272
|
+
self.g.pop
|
273
|
+
self.g.puts_string("trying.. #{self.g.name}")
|
274
|
+
)}
|
275
|
+
)}
|
276
|
+
)
|
277
|
+
declare_meme(
|
278
|
+
:rule_finish,
|
279
|
+
[],
|
280
|
+
::Object::Proc.new { |*| (
|
281
|
+
overall_done = self.g.new_label
|
190
282
|
self.g.push_idx
|
191
|
-
self.g.
|
283
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
284
|
+
self.g.push_idx
|
285
|
+
self.g.inspect_top
|
286
|
+
self.g.pop
|
287
|
+
self.g.puts_string("SUCCESS! #{self.g.name}")
|
288
|
+
)}
|
289
|
+
self.g.goto(overall_done)
|
290
|
+
self.g.overall_fail.__send__(:set!)
|
291
|
+
self.g.push_nil
|
292
|
+
::Myco.branch_op(:"&&", self.g.debug_mode) {(
|
293
|
+
self.g.push_idx
|
294
|
+
self.g.inspect_top
|
295
|
+
self.g.pop
|
296
|
+
self.g.puts_string("failure: #{self.g.name}")
|
297
|
+
)}
|
298
|
+
overall_done.__send__(:set!)
|
299
|
+
self.g.ret
|
300
|
+
self.g.close
|
301
|
+
)}
|
302
|
+
)
|
303
|
+
declare_meme(
|
304
|
+
:push_literal_array,
|
305
|
+
[],
|
306
|
+
::Object::Proc.new { |ary| (
|
307
|
+
ary.each { |lit| (self.g.push_literal_or_array(lit))}
|
308
|
+
self.make_array(ary.size)
|
309
|
+
)}
|
310
|
+
)
|
311
|
+
declare_meme(
|
312
|
+
:push_literal_or_array,
|
313
|
+
[],
|
314
|
+
::Object::Proc.new { |item| (::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", item.__send__(
|
315
|
+
:is_a?,
|
316
|
+
::Myco.find_constant(:Array)
|
317
|
+
)) {self.push_literal_array(item)}) {self.push_literal(item)})}
|
318
|
+
)
|
319
|
+
declare_meme(
|
320
|
+
:capture,
|
321
|
+
[],
|
322
|
+
::Object::Proc.new { |*metadata| (
|
323
|
+
self.g.push_captures
|
324
|
+
self.g.push_idx
|
325
|
+
self.g.push_literal_array(metadata)
|
326
|
+
self.g.make_array(2)
|
327
|
+
self.g.send(
|
328
|
+
:push,
|
329
|
+
1
|
330
|
+
)
|
192
331
|
self.g.pop
|
193
|
-
|
194
|
-
|
195
|
-
overall_done.__send__(:set!)
|
196
|
-
self.g.ret
|
197
|
-
self.g.close
|
198
|
-
)}
|
199
|
-
declare_meme(:push_literal_array, [], nil, ::Myco.cscope.dup) { |ary| (
|
200
|
-
ary.each { |lit| (self.g.push_literal_or_array(lit))}
|
201
|
-
self.make_array(ary.size)
|
202
|
-
)}
|
203
|
-
declare_meme(:push_literal_or_array, [], nil, ::Myco.cscope.dup) { |item| (::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", item.__send__(
|
204
|
-
:is_a?,
|
205
|
-
::Myco.find_constant(:Array)
|
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
|
-
)}
|
332
|
+
)}
|
333
|
+
)
|
218
334
|
)}}
|
219
335
|
.tap { |__c__| __c__.__name__ = :BytecodeHelpers })}}.instance
|