myco 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myco/code_tools/AST/ArgumentAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/ArrayAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/Block.my +104 -0
- data/lib/myco/code_tools/AST/Block.my.rb +126 -0
- data/lib/myco/code_tools/AST/BlockArgument.my.rb +4 -4
- data/lib/myco/code_tools/AST/BlockLiteral.my +15 -94
- data/lib/myco/code_tools/AST/BlockLiteral.my.rb +18 -121
- data/lib/myco/code_tools/AST/BlockParameter.my.rb +4 -4
- data/lib/myco/code_tools/AST/BranchOperator.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantAccess.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantAssignment.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantDefine.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantReopen.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareCategory.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareDecorator.my.rb +4 -4
- data/lib/myco/code_tools/AST/DeclareFile.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareMeme.my +3 -1
- data/lib/myco/code_tools/AST/DeclareMeme.my.rb +10 -6
- data/lib/myco/code_tools/AST/DeclareObject.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareString.my.rb +4 -4
- data/lib/myco/code_tools/AST/DynamicString.my.rb +4 -4
- data/lib/myco/code_tools/AST/DynamicSymbol.my.rb +4 -4
- data/lib/myco/code_tools/AST/Invoke.my +3 -4
- data/lib/myco/code_tools/AST/Invoke.my.rb +5 -15
- data/lib/myco/code_tools/AST/InvokeMethod.my.rb +4 -4
- data/lib/myco/code_tools/AST/KeywordAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/LocalVariableAccessAmbiguous.my.rb +4 -4
- data/lib/myco/code_tools/AST/LocalVariableAssignment.my.rb +4 -4
- data/lib/myco/code_tools/AST/MycoModuleScope.my +1 -1
- data/lib/myco/code_tools/AST/MycoModuleScope.my.rb +2 -2
- data/lib/myco/code_tools/AST/Node.my.rb +4 -4
- data/lib/myco/code_tools/AST/ParameterAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/PipeOperator.my +25 -0
- data/lib/myco/code_tools/AST/PipeOperator.my.rb +28 -0
- data/lib/myco/code_tools/AST/Quest.my.rb +7 -7
- data/lib/myco/code_tools/AST/Script.my.rb +4 -4
- data/lib/myco/code_tools/AST/{Body.my → Sequence.my} +2 -2
- data/lib/myco/code_tools/AST/{Body.my.rb → Sequence.my.rb} +6 -6
- data/lib/myco/code_tools/AST/SplatValue.my.rb +4 -4
- data/lib/myco/code_tools/AST/StringLiteral.my.rb +4 -4
- data/lib/myco/code_tools/AST/SymbolLiteral.my.rb +4 -4
- data/lib/myco/code_tools/AST/ToRuby.my +9 -3
- data/lib/myco/code_tools/AST/ToRuby.my.rb +7 -5
- data/lib/myco/code_tools/AST/misc.my.rb +17 -17
- data/lib/myco/code_tools/AST.my +5 -3
- data/lib/myco/code_tools/AST.my.rb +7 -6
- data/lib/myco/code_tools/Parser.my.rb +4 -4
- data/lib/myco/code_tools/parser/MycoBuilder.my.rb +1 -1
- data/lib/myco/code_tools/parser/MycoCharacterClasses.my.rb +2 -2
- data/lib/myco/code_tools/parser/MycoGrammar.my +68 -25
- data/lib/myco/code_tools/parser/MycoGrammar.my.rb +126 -51
- data/lib/myco/code_tools/parser/MycoTokens.my +3 -2
- data/lib/myco/code_tools/parser/MycoTokens.my.rb +11 -7
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Builder.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my +1 -1
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my.rb +3 -3
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my +11 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my.rb +11 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my +1 -1
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my.rb +3 -6
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Constructions.my.rb +40 -40
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my +3 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my.rb +9 -8
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Instructions.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Machine.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my.rb +44 -44
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb +4 -4
- data/lib/myco/tools/BasicCommand.my.rb +4 -4
- data/lib/myco/version.rb +1 -1
- metadata +16 -13
@@ -41,9 +41,10 @@ rule meme_expr:
|
|
41
41
|
# Expressions allowable as function arguments
|
42
42
|
rule arg_expr:
|
43
43
|
assignment
|
44
|
-
/
|
44
|
+
/ left_chained_operations
|
45
45
|
/ dyn_string
|
46
46
|
/ dyn_symstr
|
47
|
+
/ left_chained_piping
|
47
48
|
/ expr_atom
|
48
49
|
|
49
50
|
# TODO: make expr_atom not redundant with below rules
|
@@ -57,6 +58,7 @@ rule expr_atom:
|
|
57
58
|
/ paren_expr
|
58
59
|
/ constant
|
59
60
|
/ lit_simple
|
61
|
+
/ lit_other
|
60
62
|
/ lit_array
|
61
63
|
/ invoke
|
62
64
|
|
@@ -69,6 +71,7 @@ rule expr_atom_not_chained:
|
|
69
71
|
/ paren_expr
|
70
72
|
/ constant
|
71
73
|
/ lit_simple
|
74
|
+
/ lit_other
|
72
75
|
/ lit_array
|
73
76
|
/ invoke
|
74
77
|
|
@@ -80,6 +83,7 @@ rule expr_atom_not_string:
|
|
80
83
|
/ paren_expr
|
81
84
|
/ constant
|
82
85
|
/ lit_simple
|
86
|
+
/ lit_other
|
83
87
|
/ lit_array
|
84
88
|
/ invoke
|
85
89
|
|
@@ -96,6 +100,20 @@ rule lit_simple:
|
|
96
100
|
/ r(T.integer[:t0]) { ast.lit(t0, t0.integer) }
|
97
101
|
/ r(T.symbol[:t0]) { ast.lit(t0, t0.text.slice(::Range.new(1,-1)).to_sym) } # TODO: more succinct here
|
98
102
|
|
103
|
+
##
|
104
|
+
# Other literals
|
105
|
+
|
106
|
+
lit_other:
|
107
|
+
lit_block
|
108
|
+
|
109
|
+
rule lit_block:
|
110
|
+
r(T.op_toproc[:to] + block_body[:n1])
|
111
|
+
{ ast.blklit(to, n1) }
|
112
|
+
|
113
|
+
rule block_body:
|
114
|
+
r(C.spc_nl.* + param_list.-[:np] + C.spc_nl.* + meme_enclosed_expr_body[:nb])
|
115
|
+
{ ast.block(nb, np, nb) }
|
116
|
+
|
99
117
|
##
|
100
118
|
# Enclosed literals
|
101
119
|
|
@@ -176,7 +194,7 @@ rule declobj_sepd_exprs:
|
|
176
194
|
|
177
195
|
rule declobj_expr_body:
|
178
196
|
r(arg_sep_opt + declobj_sepd_exprs[:nlist] + T.declare_end[:te])
|
179
|
-
{ ast.
|
197
|
+
{ ast.sequence(nlist.first, nlist) }
|
180
198
|
/ r(arg_sep_opt + T.declare_end[:te])
|
181
199
|
{ ast.null(te) }
|
182
200
|
|
@@ -198,7 +216,7 @@ rule category:
|
|
198
216
|
r(category_name[:n0] + category_sepd_exprs.-[:nlist]
|
199
217
|
+ !!(arg_sep_opt + (T.catgry_begin / T.declare_end)))
|
200
218
|
{ ast.category(n0, n0.value,
|
201
|
-
(nlist &? ast.
|
219
|
+
(nlist &? ast.sequence(nlist.first, nlist) ?? ast.null(n0))) }
|
202
220
|
|
203
221
|
rule copen:
|
204
222
|
r(constant[:n0] + C.spc_nl.* + T.reopen[:tb] + C.spc_nl.* + T.declare_begin + declobj_expr_body[:n1])
|
@@ -252,24 +270,20 @@ rule invoke_assignment:
|
|
252
270
|
##
|
253
271
|
# Invoke - Results in a :lambig, :call, or :iter with a :call within
|
254
272
|
|
255
|
-
|
256
|
-
|
257
|
-
{ [np, nb] }
|
258
|
-
|
259
|
-
opt_arg_list: (r(C.spc.* + arg_list[:n]) { n }).-
|
260
|
-
opt_invoke_body: (r(C.spc_nl.* + invoke_body[:nx]) { nx }).-
|
273
|
+
opt_arg_list: (r(C.spc.* + arg_list[:n]) { n }).-
|
274
|
+
opt_block_body: (r(C.spc_nl.* + block_body[:n]) { n }).-
|
261
275
|
|
262
276
|
rule invoke:
|
263
|
-
r(T.identifier[:tn] + opt_arg_list[:na] +
|
264
|
-
{ ast.invoke(tn, null, tn.sym, na,
|
277
|
+
r(T.identifier[:tn] + opt_arg_list[:na] + opt_block_body[:nb])
|
278
|
+
{ ast.invoke(tn, null, tn.sym, na, nb) }
|
265
279
|
|
266
280
|
rule op_invoke: # Allow some binary operators to be invoked with a dot
|
267
|
-
r(op_invoke_id[:tn] + opt_arg_list[:na] +
|
268
|
-
{ ast.invoke(tn, null, tn.sym, na,
|
281
|
+
r(op_invoke_id[:tn] + opt_arg_list[:na] + opt_block_body[:nb])
|
282
|
+
{ ast.invoke(tn, null, tn.sym, na, nb) }
|
269
283
|
|
270
284
|
rule elem_invoke:
|
271
|
-
r(lit_array[:na] +
|
272
|
-
{ ast.invoke(na, null, :"[]", ast.argass(na, na.body),
|
285
|
+
r(lit_array[:na] + opt_block_body[:nb])
|
286
|
+
{ ast.invoke(na, null, :"[]", ast.argass(na, na.body), nb) }
|
273
287
|
|
274
288
|
rule op_invoke_id:
|
275
289
|
left_op_normal
|
@@ -395,7 +409,7 @@ left_op_normal:
|
|
395
409
|
/ T.op_mult / T.op_div / T.op_mod
|
396
410
|
/ T.op_plus / T.op_minus
|
397
411
|
/ T.op_compare
|
398
|
-
/ T.
|
412
|
+
/ T.op_r_pipe
|
399
413
|
|
400
414
|
left_op_branch:
|
401
415
|
T.op_and / T.op_or
|
@@ -411,12 +425,12 @@ rule left_op: left_op_normal / left_op_branch
|
|
411
425
|
# http://www.dalnefre.com/wp/2011/05/parsing-expression-grammars-part-4/
|
412
426
|
# for an easy-to-understand explanation of this problem and this solution.
|
413
427
|
#
|
414
|
-
rule
|
428
|
+
rule sepd_chained_operation:
|
415
429
|
r(C.spc_nl.* + left_op[:to] + C.spc_nl.* + expr_atom[:n1])
|
416
430
|
{ [to, n1] }
|
417
431
|
|
418
|
-
rule
|
419
|
-
r(expr_atom[:n0] +
|
432
|
+
rule left_chained_operations:
|
433
|
+
r(expr_atom[:n0] + sepd_chained_operation.+[:nlist])
|
420
434
|
{
|
421
435
|
nlist.unshift(n0)
|
422
436
|
nlist.flatten!
|
@@ -429,10 +443,13 @@ rule left_chained_atoms:
|
|
429
443
|
:t_op_and_q, :t_op_or_q, :t_op_void_q) |n0,op,n1| {
|
430
444
|
ast.branch_op(op, op.sym, n0, n1)
|
431
445
|
}
|
446
|
+
collapse(nlist, :t_op_r_pipe) |n0,op,n1| {
|
447
|
+
ast.pipe_op(op, n0, n1)
|
448
|
+
}
|
432
449
|
|
433
450
|
# There should only be one resulting node left
|
434
451
|
(nlist.count == 1)
|
435
|
-
|| raise("Failed to fully collapse
|
452
|
+
|| raise("Failed to fully collapse left_chained_operations: "nlist"")
|
436
453
|
|
437
454
|
nlist.first
|
438
455
|
}
|
@@ -445,7 +462,7 @@ rule left_invoke_op:
|
|
445
462
|
/ T.dot
|
446
463
|
|
447
464
|
# Achieve left-associativity through iteration.
|
448
|
-
# (see
|
465
|
+
# (see left_chained_operations).
|
449
466
|
#
|
450
467
|
rule sepd_chained_invocation:
|
451
468
|
r(C.spc_nl.* + left_invoke_op[:t0] + C.spc_nl.* + (invoke / op_invoke)[:n1])
|
@@ -457,7 +474,7 @@ rule left_chained_invocations:
|
|
457
474
|
r(expr_atom_not_chained[:n0] + sepd_chained_invocation.+[:nlist])
|
458
475
|
{
|
459
476
|
nlist.unshift(n0)
|
460
|
-
nlist.
|
477
|
+
nlist.flatten!
|
461
478
|
|
462
479
|
collapse(nlist, :t_dot, :t_quest) |n0,op,n1| {
|
463
480
|
(op.type == :t_dot)
|
@@ -472,6 +489,32 @@ rule left_chained_invocations:
|
|
472
489
|
nlist.first
|
473
490
|
}
|
474
491
|
|
492
|
+
##
|
493
|
+
# Piping invocations
|
494
|
+
|
495
|
+
pipeable: left_chained_invocations / invoke
|
496
|
+
|
497
|
+
rule sepd_chained_piping:
|
498
|
+
r(C.spc.+.token(:t_op_r_pipe)[:to] + pipeable[:n1])
|
499
|
+
{ [to, n1] }
|
500
|
+
|
501
|
+
rule left_chained_piping:
|
502
|
+
r(expr_atom[:n0] + sepd_chained_piping.+[:nlist])
|
503
|
+
{
|
504
|
+
nlist.unshift(n0)
|
505
|
+
nlist.flatten!
|
506
|
+
|
507
|
+
collapse(nlist, :t_op_r_pipe) |n0,op,n1| {
|
508
|
+
ast.pipe_op(op, n0, n1)
|
509
|
+
}
|
510
|
+
|
511
|
+
# There should only be one resulting node left
|
512
|
+
(nlist.count == 1)
|
513
|
+
|| raise("Failed to fully collapse left_chained_piping: "nlist"")
|
514
|
+
|
515
|
+
nlist.first
|
516
|
+
}
|
517
|
+
|
475
518
|
##
|
476
519
|
# Unary operators
|
477
520
|
|
@@ -510,17 +553,17 @@ rule meme_sepd_exprs:
|
|
510
553
|
|
511
554
|
rule meme_inline_expr_body:
|
512
555
|
r(inln_sep_opt + meme_inline_sepd_exprs[:nlist])
|
513
|
-
{ ast.
|
556
|
+
{ ast.sequence(nlist.first, nlist) }
|
514
557
|
|
515
558
|
rule meme_expr_body:
|
516
559
|
r(expr_sep_opt + meme_sepd_exprs[:nlist] + T.meme_end[:te])
|
517
|
-
{ ast.
|
560
|
+
{ ast.sequence(nlist.first, nlist) }
|
518
561
|
/ r(expr_sep_opt + T.meme_end[:te])
|
519
562
|
{ ast.null(te) }
|
520
563
|
|
521
564
|
rule paren_expr_body:
|
522
565
|
r(expr_sep_opt + meme_sepd_exprs[:nlist] + T.paren_end[:te])
|
523
|
-
{ nlist.count==1 &? nlist.first ?? ast.
|
566
|
+
{ nlist.count==1 &? nlist.first ?? ast.sequence(nlist.first, nlist) }
|
524
567
|
/ r(expr_sep_opt + T.paren_end[:te])
|
525
568
|
{ ast.null(te) }
|
526
569
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
4
4
|
declare_meme(:"MycoCharacterClasses.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
5
5
|
declare_meme(:"MycoTokens.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
-
::Myco.cscope.for_method_definition
|
6
|
+
::Myco.cscope.for_method_definition::MycoGrammar = (::Myco::Component.new([::Myco.find_constant(:Pegleromyces)::Grammar], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
7
7
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
8
|
-
::Myco.cscope.for_method_definition
|
9
|
-
::Myco.cscope.for_method_definition
|
8
|
+
::Myco.cscope.for_method_definition::C = (::Myco.find_constant(:MycoCharacterClasses))
|
9
|
+
::Myco.cscope.for_method_definition::T = (::Myco.find_constant(:MycoTokens))
|
10
10
|
__category__(:rules).component_eval {(
|
11
11
|
declare_meme(:root, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(self.declobj_expr_body.__send__(
|
12
12
|
:[],
|
@@ -45,13 +45,16 @@
|
|
45
45
|
declare_meme(:meme_expr, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.arg_expr)}
|
46
46
|
declare_meme(:arg_expr, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.assignment.__send__(
|
47
47
|
:/,
|
48
|
-
self.
|
48
|
+
self.left_chained_operations
|
49
49
|
).__send__(
|
50
50
|
:/,
|
51
51
|
self.dyn_string
|
52
52
|
).__send__(
|
53
53
|
:/,
|
54
54
|
self.dyn_symstr
|
55
|
+
).__send__(
|
56
|
+
:/,
|
57
|
+
self.left_chained_piping
|
55
58
|
).__send__(
|
56
59
|
:/,
|
57
60
|
self.expr_atom
|
@@ -77,6 +80,9 @@
|
|
77
80
|
).__send__(
|
78
81
|
:/,
|
79
82
|
self.lit_simple
|
83
|
+
).__send__(
|
84
|
+
:/,
|
85
|
+
self.lit_other
|
80
86
|
).__send__(
|
81
87
|
:/,
|
82
88
|
self.lit_array
|
@@ -102,6 +108,9 @@
|
|
102
108
|
).__send__(
|
103
109
|
:/,
|
104
110
|
self.lit_simple
|
111
|
+
).__send__(
|
112
|
+
:/,
|
113
|
+
self.lit_other
|
105
114
|
).__send__(
|
106
115
|
:/,
|
107
116
|
self.lit_array
|
@@ -124,6 +133,9 @@
|
|
124
133
|
).__send__(
|
125
134
|
:/,
|
126
135
|
self.lit_simple
|
136
|
+
).__send__(
|
137
|
+
:/,
|
138
|
+
self.lit_other
|
127
139
|
).__send__(
|
128
140
|
:/,
|
129
141
|
self.lit_array
|
@@ -189,6 +201,40 @@
|
|
189
201
|
)).to_sym
|
190
202
|
))}
|
191
203
|
))}
|
204
|
+
declare_meme(:lit_other, [], nil, ::Myco.cscope.dup) { |*| (self.lit_block)}
|
205
|
+
declare_meme(:lit_block, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:T).op_toproc.__send__(
|
206
|
+
:[],
|
207
|
+
:to
|
208
|
+
).__send__(
|
209
|
+
:+,
|
210
|
+
self.block_body.__send__(
|
211
|
+
:[],
|
212
|
+
:n1
|
213
|
+
)
|
214
|
+
)) { || (self.ast.blklit(
|
215
|
+
self.to,
|
216
|
+
self.__send__(:n1)
|
217
|
+
))})}
|
218
|
+
declare_meme(:block_body, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc_nl.__send__(:*).__send__(
|
219
|
+
:+,
|
220
|
+
self.param_list.__send__(:-).__send__(
|
221
|
+
:[],
|
222
|
+
:np
|
223
|
+
)
|
224
|
+
).__send__(
|
225
|
+
:+,
|
226
|
+
::Myco.find_constant(:C).spc_nl.__send__(:*)
|
227
|
+
).__send__(
|
228
|
+
:+,
|
229
|
+
self.meme_enclosed_expr_body.__send__(
|
230
|
+
:[],
|
231
|
+
:nb
|
232
|
+
)
|
233
|
+
)) { || (self.ast.block(
|
234
|
+
self.nb,
|
235
|
+
self.np,
|
236
|
+
self.nb
|
237
|
+
))})}
|
192
238
|
declare_meme(:lit_string, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:T).string_begin.__send__(
|
193
239
|
:+,
|
194
240
|
::Myco.find_constant(:T).string_body.__send__(
|
@@ -422,7 +468,7 @@
|
|
422
468
|
:[],
|
423
469
|
:te
|
424
470
|
)
|
425
|
-
)) { || (self.ast.
|
471
|
+
)) { || (self.ast.sequence(
|
426
472
|
self.nlist.first,
|
427
473
|
self.nlist
|
428
474
|
))}.__send__(
|
@@ -503,7 +549,7 @@
|
|
503
549
|
)) { || (self.ast.category(
|
504
550
|
self.__send__(:n0),
|
505
551
|
self.__send__(:n0).value,
|
506
|
-
::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", self.nlist) {self.ast.
|
552
|
+
::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", self.nlist) {self.ast.sequence(
|
507
553
|
self.nlist.first,
|
508
554
|
self.nlist
|
509
555
|
)}) {self.ast.null(self.__send__(:n0))}
|
@@ -686,25 +732,6 @@
|
|
686
732
|
)
|
687
733
|
self.lhs
|
688
734
|
)})}
|
689
|
-
declare_meme(:invoke_body, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc_nl.__send__(:*).__send__(
|
690
|
-
:+,
|
691
|
-
self.param_list.__send__(:-).__send__(
|
692
|
-
:[],
|
693
|
-
:np
|
694
|
-
)
|
695
|
-
).__send__(
|
696
|
-
:+,
|
697
|
-
::Myco.find_constant(:C).spc_nl.__send__(:*)
|
698
|
-
).__send__(
|
699
|
-
:+,
|
700
|
-
self.meme_enclosed_expr_body.__send__(
|
701
|
-
:[],
|
702
|
-
:nb
|
703
|
-
)
|
704
|
-
)) { || ([
|
705
|
-
self.np,
|
706
|
-
self.nb
|
707
|
-
])})}
|
708
735
|
declare_meme(:opt_arg_list, [], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc.__send__(:*).__send__(
|
709
736
|
:+,
|
710
737
|
self.arg_list.__send__(
|
@@ -712,13 +739,13 @@
|
|
712
739
|
:n
|
713
740
|
)
|
714
741
|
)) { || (self.n)}.__send__(:-))}
|
715
|
-
declare_meme(:
|
742
|
+
declare_meme(:opt_block_body, [], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc_nl.__send__(:*).__send__(
|
716
743
|
:+,
|
717
|
-
self.
|
744
|
+
self.block_body.__send__(
|
718
745
|
:[],
|
719
|
-
:
|
746
|
+
:n
|
720
747
|
)
|
721
|
-
)) { || (self.
|
748
|
+
)) { || (self.n)}.__send__(:-))}
|
722
749
|
declare_meme(:invoke, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:T).identifier.__send__(
|
723
750
|
:[],
|
724
751
|
:tn
|
@@ -730,16 +757,16 @@
|
|
730
757
|
)
|
731
758
|
).__send__(
|
732
759
|
:+,
|
733
|
-
self.
|
760
|
+
self.opt_block_body.__send__(
|
734
761
|
:[],
|
735
|
-
:
|
762
|
+
:nb
|
736
763
|
)
|
737
764
|
)) { || (self.ast.invoke(
|
738
765
|
self.tn,
|
739
766
|
nil,
|
740
767
|
self.tn.sym,
|
741
768
|
self.na,
|
742
|
-
|
769
|
+
self.nb
|
743
770
|
))})}
|
744
771
|
declare_meme(:op_invoke, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(self.op_invoke_id.__send__(
|
745
772
|
:[],
|
@@ -752,25 +779,25 @@
|
|
752
779
|
)
|
753
780
|
).__send__(
|
754
781
|
:+,
|
755
|
-
self.
|
782
|
+
self.opt_block_body.__send__(
|
756
783
|
:[],
|
757
|
-
:
|
784
|
+
:nb
|
758
785
|
)
|
759
786
|
)) { || (self.ast.invoke(
|
760
787
|
self.tn,
|
761
788
|
nil,
|
762
789
|
self.tn.sym,
|
763
790
|
self.na,
|
764
|
-
|
791
|
+
self.nb
|
765
792
|
))})}
|
766
793
|
declare_meme(:elem_invoke, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(self.lit_array.__send__(
|
767
794
|
:[],
|
768
795
|
:na
|
769
796
|
).__send__(
|
770
797
|
:+,
|
771
|
-
self.
|
798
|
+
self.opt_block_body.__send__(
|
772
799
|
:[],
|
773
|
-
:
|
800
|
+
:nb
|
774
801
|
)
|
775
802
|
)) { || (self.ast.invoke(
|
776
803
|
self.na,
|
@@ -780,7 +807,7 @@
|
|
780
807
|
self.na,
|
781
808
|
self.na.body
|
782
809
|
),
|
783
|
-
|
810
|
+
self.nb
|
784
811
|
))})}
|
785
812
|
declare_meme(:op_invoke_id, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.left_op_normal)}
|
786
813
|
declare_meme(:arg_sep, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:C).spc.__send__(:*).__send__(
|
@@ -1391,10 +1418,7 @@
|
|
1391
1418
|
::Myco.find_constant(:T).op_compare
|
1392
1419
|
).__send__(
|
1393
1420
|
:/,
|
1394
|
-
::Myco.find_constant(:T).
|
1395
|
-
).__send__(
|
1396
|
-
:/,
|
1397
|
-
::Myco.find_constant(:T).op_or
|
1421
|
+
::Myco.find_constant(:T).op_r_pipe
|
1398
1422
|
))}
|
1399
1423
|
declare_meme(:left_op_branch, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:T).op_and.__send__(
|
1400
1424
|
:/,
|
@@ -1413,7 +1437,7 @@
|
|
1413
1437
|
:/,
|
1414
1438
|
self.left_op_branch
|
1415
1439
|
))}
|
1416
|
-
declare_meme(:
|
1440
|
+
declare_meme(:sepd_chained_operation, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc_nl.__send__(:*).__send__(
|
1417
1441
|
:+,
|
1418
1442
|
self.left_op.__send__(
|
1419
1443
|
:[],
|
@@ -1432,12 +1456,12 @@
|
|
1432
1456
|
self.to,
|
1433
1457
|
self.__send__(:n1)
|
1434
1458
|
])})}
|
1435
|
-
declare_meme(:
|
1459
|
+
declare_meme(:left_chained_operations, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(self.expr_atom.__send__(
|
1436
1460
|
:[],
|
1437
1461
|
:n0
|
1438
1462
|
).__send__(
|
1439
1463
|
:+,
|
1440
|
-
self.
|
1464
|
+
self.sepd_chained_operation.__send__(:+).__send__(
|
1441
1465
|
:[],
|
1442
1466
|
:nlist
|
1443
1467
|
)
|
@@ -1476,10 +1500,18 @@
|
|
1476
1500
|
n0,
|
1477
1501
|
n1
|
1478
1502
|
))}
|
1503
|
+
self.collapse(
|
1504
|
+
self.nlist,
|
1505
|
+
:t_op_r_pipe
|
1506
|
+
) { |n0, op, n1| (self.ast.pipe_op(
|
1507
|
+
op,
|
1508
|
+
n0,
|
1509
|
+
n1
|
1510
|
+
))}
|
1479
1511
|
::Myco.branch_op(:"||", self.nlist.count.__send__(
|
1480
1512
|
:==,
|
1481
1513
|
1
|
1482
|
-
)) {self.raise("Failed to fully collapse
|
1514
|
+
)) {self.raise("Failed to fully collapse left_chained_operations: #{self.nlist}")}
|
1483
1515
|
self.nlist.first
|
1484
1516
|
)})}
|
1485
1517
|
declare_meme(:left_invoke_op, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:T).quest.__send__(
|
@@ -1534,7 +1566,7 @@
|
|
1534
1566
|
)
|
1535
1567
|
)) { || (
|
1536
1568
|
self.nlist.unshift(self.__send__(:n0))
|
1537
|
-
self.nlist.
|
1569
|
+
self.nlist.__send__(:flatten!)
|
1538
1570
|
self.collapse(
|
1539
1571
|
self.nlist,
|
1540
1572
|
:t_dot,
|
@@ -1559,6 +1591,49 @@
|
|
1559
1591
|
)) {self.raise("Failed to fully collapse left_chained_invocations: #{self.nlist}")}
|
1560
1592
|
self.nlist.first
|
1561
1593
|
)})}
|
1594
|
+
declare_meme(:pipeable, [], nil, ::Myco.cscope.dup) { |*| (self.left_chained_invocations.__send__(
|
1595
|
+
:/,
|
1596
|
+
self.invoke
|
1597
|
+
))}
|
1598
|
+
declare_meme(:sepd_chained_piping, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:C).spc.__send__(:+).token(:t_op_r_pipe).__send__(
|
1599
|
+
:[],
|
1600
|
+
:to
|
1601
|
+
).__send__(
|
1602
|
+
:+,
|
1603
|
+
self.pipeable.__send__(
|
1604
|
+
:[],
|
1605
|
+
:n1
|
1606
|
+
)
|
1607
|
+
)) { || ([
|
1608
|
+
self.to,
|
1609
|
+
self.__send__(:n1)
|
1610
|
+
])})}
|
1611
|
+
declare_meme(:left_chained_piping, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(self.expr_atom.__send__(
|
1612
|
+
:[],
|
1613
|
+
:n0
|
1614
|
+
).__send__(
|
1615
|
+
:+,
|
1616
|
+
self.sepd_chained_piping.__send__(:+).__send__(
|
1617
|
+
:[],
|
1618
|
+
:nlist
|
1619
|
+
)
|
1620
|
+
)) { || (
|
1621
|
+
self.nlist.unshift(self.__send__(:n0))
|
1622
|
+
self.nlist.__send__(:flatten!)
|
1623
|
+
self.collapse(
|
1624
|
+
self.nlist,
|
1625
|
+
:t_op_r_pipe
|
1626
|
+
) { |n0, op, n1| (self.ast.pipe_op(
|
1627
|
+
op,
|
1628
|
+
n0,
|
1629
|
+
n1
|
1630
|
+
))}
|
1631
|
+
::Myco.branch_op(:"||", self.nlist.count.__send__(
|
1632
|
+
:==,
|
1633
|
+
1
|
1634
|
+
)) {self.raise("Failed to fully collapse left_chained_piping: #{self.nlist}")}
|
1635
|
+
self.nlist.first
|
1636
|
+
)})}
|
1562
1637
|
declare_meme(:unary_operation, [[:rule, []]], nil, ::Myco.cscope.dup) { |*| (self.r(::Myco.find_constant(:T).op_not.__send__(
|
1563
1638
|
:[],
|
1564
1639
|
:to
|
@@ -1652,7 +1727,7 @@
|
|
1652
1727
|
:[],
|
1653
1728
|
:nlist
|
1654
1729
|
)
|
1655
|
-
)) { || (self.ast.
|
1730
|
+
)) { || (self.ast.sequence(
|
1656
1731
|
self.nlist.first,
|
1657
1732
|
self.nlist
|
1658
1733
|
))})}
|
@@ -1668,7 +1743,7 @@
|
|
1668
1743
|
:[],
|
1669
1744
|
:te
|
1670
1745
|
)
|
1671
|
-
)) { || (self.ast.
|
1746
|
+
)) { || (self.ast.sequence(
|
1672
1747
|
self.nlist.first,
|
1673
1748
|
self.nlist
|
1674
1749
|
))}.__send__(
|
@@ -1696,7 +1771,7 @@
|
|
1696
1771
|
)) { || (::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", self.nlist.count.__send__(
|
1697
1772
|
:==,
|
1698
1773
|
1
|
1699
|
-
)) {self.nlist.first}) {self.ast.
|
1774
|
+
)) {self.nlist.first}) {self.ast.sequence(
|
1700
1775
|
self.nlist.first,
|
1701
1776
|
self.nlist
|
1702
1777
|
)})}.__send__(
|
@@ -1847,5 +1922,5 @@
|
|
1847
1922
|
))}
|
1848
1923
|
))}
|
1849
1924
|
)}
|
1850
|
-
)}}.instance)
|
1925
|
+
)}}.instance)
|
1851
1926
|
)}}.instance
|
@@ -25,7 +25,7 @@ MycoTokens: Pegleromyces::Grammar {
|
|
25
25
|
|
26
26
|
token constant: C.upper + C.alnum.*
|
27
27
|
token identifier: C.lower + C.alnum.* + C.suffix.-
|
28
|
-
token symbol: str(':') + C.lower + C.alnum.*
|
28
|
+
token symbol: str(':') + (C.lower / C.upper) + C.alnum.* + C.suffix.-
|
29
29
|
token null: str('null')
|
30
30
|
token void: str('void')
|
31
31
|
token true: str('true')
|
@@ -35,7 +35,7 @@ MycoTokens: Pegleromyces::Grammar {
|
|
35
35
|
token integer: str('-').- + C.num.+
|
36
36
|
|
37
37
|
token dot: str('.')
|
38
|
-
token quest: str('.') +
|
38
|
+
token quest: str('.') + str('?')
|
39
39
|
token scope: str('::')
|
40
40
|
token assign: str('=')
|
41
41
|
token op_toproc: str('&')
|
@@ -53,6 +53,7 @@ MycoTokens: Pegleromyces::Grammar {
|
|
53
53
|
token op_void_q: str('??')
|
54
54
|
token op_compare: str('<=>') / str('=~') / str('==') /
|
55
55
|
str('<=') / str('>=') / str('<') / str('>')
|
56
|
+
token op_r_pipe: str('|>')
|
56
57
|
|
57
58
|
string_norm: !set("\\\"") + any
|
58
59
|
token string_body: string_norm.* + (str("\\") + any + string_norm.*).*
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
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
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.cscope.for_method_definition::MycoTokens = (::Myco::Component.new([::Myco.find_constant(:Pegleromyces)::Grammar], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
::Myco.cscope.for_method_definition
|
5
|
+
::Myco.cscope.for_method_definition::C = (::Myco.find_constant(:MycoCharacterClasses))
|
6
6
|
__category__(:main).component_eval {(
|
7
7
|
declare_meme(:const_sep, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str(","))}
|
8
8
|
declare_meme(:expr_sep, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str(";").__send__(
|
@@ -44,10 +44,16 @@
|
|
44
44
|
))}
|
45
45
|
declare_meme(:symbol, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str(":").__send__(
|
46
46
|
:+,
|
47
|
-
::Myco.find_constant(:C).lower
|
47
|
+
::Myco.find_constant(:C).lower.__send__(
|
48
|
+
:/,
|
49
|
+
::Myco.find_constant(:C).upper
|
50
|
+
)
|
48
51
|
).__send__(
|
49
52
|
:+,
|
50
53
|
::Myco.find_constant(:C).alnum.__send__(:*)
|
54
|
+
).__send__(
|
55
|
+
:+,
|
56
|
+
::Myco.find_constant(:C).suffix.__send__(:-)
|
51
57
|
))}
|
52
58
|
declare_meme(:null, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("null"))}
|
53
59
|
declare_meme(:void, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("void"))}
|
@@ -70,9 +76,6 @@
|
|
70
76
|
))}
|
71
77
|
declare_meme(:dot, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("."))}
|
72
78
|
declare_meme(:quest, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str(".").__send__(
|
73
|
-
:+,
|
74
|
-
::Myco.find_constant(:C).spc_nl.__send__(:*)
|
75
|
-
).__send__(
|
76
79
|
:+,
|
77
80
|
self.str("?")
|
78
81
|
))}
|
@@ -110,6 +113,7 @@
|
|
110
113
|
:/,
|
111
114
|
self.str(">")
|
112
115
|
))}
|
116
|
+
declare_meme(:op_r_pipe, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("|>"))}
|
113
117
|
declare_meme(:string_norm, [], nil, ::Myco.cscope.dup) { |*| (self.set("\\\"").__send__(:!).__send__(
|
114
118
|
:+,
|
115
119
|
self.any
|
@@ -167,4 +171,4 @@
|
|
167
171
|
declare_meme(:declstr_begin, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("@@@"))}
|
168
172
|
declare_meme(:declstr_end, [[:token, []]], nil, ::Myco.cscope.dup) { |*| (self.str("@@@"))}
|
169
173
|
)}
|
170
|
-
)}}.instance))
|
174
|
+
)}}.instance))}}.instance
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
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
|
4
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.cscope.for_method_definition::Builder = ::Myco::Component.new([::Myco.find_constant(:BasicObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
5
5
|
.tap { |__c__| __c__.__name__ = :Builder })}}.instance
|
@@ -136,7 +136,7 @@ BytecodeHelpers < BasicObject {
|
|
136
136
|
ary.each |lit| { g.push_literal_or_array(lit) }; make_array(ary.size)
|
137
137
|
|
138
138
|
push_literal_or_array: |item|
|
139
|
-
item.is_a?(
|
139
|
+
item.is_a?(Array)
|
140
140
|
&? push_literal_array(item)
|
141
141
|
?? push_literal(item)
|
142
142
|
}
|