line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Do not edit this file - Generated by Perlito6 9.0 |
2
|
31
|
|
|
31
|
|
329
|
use v5; |
|
31
|
|
|
|
|
75
|
|
3
|
31
|
|
|
31
|
|
118
|
use utf8; |
|
31
|
|
|
|
|
45
|
|
|
31
|
|
|
|
|
176
|
|
4
|
31
|
|
|
31
|
|
594
|
use strict; |
|
31
|
|
|
|
|
51
|
|
|
31
|
|
|
|
|
485
|
|
5
|
31
|
|
|
31
|
|
92
|
use warnings; |
|
31
|
|
|
|
|
35
|
|
|
31
|
|
|
|
|
942
|
|
6
|
31
|
|
|
31
|
|
105
|
no warnings ('redefine', 'once', 'void', 'uninitialized', 'misc', 'recursion'); |
|
31
|
|
|
|
|
35
|
|
|
31
|
|
|
|
|
1181
|
|
7
|
31
|
|
|
31
|
|
122
|
use Perlito6::Perl5::Runtime; |
|
31
|
|
|
|
|
41
|
|
|
31
|
|
|
|
|
542
|
|
8
|
31
|
|
|
31
|
|
95
|
use Perlito6::Perl5::Prelude; |
|
31
|
|
|
|
|
40
|
|
|
31
|
|
|
|
|
103375
|
|
9
|
|
|
|
|
|
|
our $MATCH = Perlito6::Match->new(); |
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
package GLOBAL; |
12
|
|
|
|
|
|
|
sub new { shift; bless { @_ }, "GLOBAL" } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# use v6 |
15
|
|
|
|
|
|
|
; |
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
package Rul; |
18
|
0
|
|
|
0
|
|
0
|
sub new { shift; bless { @_ }, "Rul" } |
|
0
|
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
sub constant { |
20
|
9
|
|
|
9
|
|
7
|
my $str = $_[0]; |
21
|
9
|
|
|
|
|
15
|
((my $len) = Main::chars($str, )); |
22
|
9
|
50
|
|
|
|
16
|
if (($str eq chr(92))) { |
23
|
0
|
|
|
|
|
0
|
($str = chr(92) . chr(92)) |
24
|
|
|
|
|
|
|
}; |
25
|
9
|
50
|
|
|
|
13
|
if (($str eq chr(39))) { |
26
|
0
|
|
|
|
|
0
|
($str = chr(92) . chr(39)) |
27
|
|
|
|
|
|
|
}; |
28
|
9
|
50
|
|
|
|
16
|
if (($len)) { |
29
|
9
|
|
|
|
|
48
|
('( ' . chr(39) . $str . chr(39) . ' eq substr( ' . chr(36) . 'str, ' . chr(36) . 'MATCH.to, ' . $len . ') ' . chr(38) . chr(38) . ' ( ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . $len . ' + ' . chr(36) . 'MATCH.to )' . ')') |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
0
|
|
|
|
|
0
|
return scalar ('1') |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
; |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
package Rul::Quantifier; |
40
|
4
|
|
|
4
|
|
4
|
sub new { shift; bless { @_ }, "Rul::Quantifier" } |
|
4
|
|
|
|
|
37
|
|
41
|
0
|
|
|
0
|
|
0
|
sub term { $_[0]->{term} }; |
42
|
0
|
|
|
0
|
|
0
|
sub quant { $_[0]->{quant} }; |
43
|
0
|
|
|
0
|
|
0
|
sub greedy { $_[0]->{greedy} }; |
44
|
0
|
|
|
0
|
|
0
|
sub ws1 { $_[0]->{ws1} }; |
45
|
0
|
|
|
0
|
|
0
|
sub ws2 { $_[0]->{ws2} }; |
46
|
0
|
|
|
0
|
|
0
|
sub ws3 { $_[0]->{ws3} }; |
47
|
|
|
|
|
|
|
sub emit_perl6 { |
48
|
4
|
|
|
4
|
|
5
|
my $self = $_[0]; |
49
|
4
|
50
|
33
|
|
|
13
|
if (((($self->{quant} eq '')) && (($self->{greedy} eq '')))) { |
50
|
0
|
|
|
|
|
0
|
return scalar ($self->{term}->emit_perl6()) |
51
|
|
|
|
|
|
|
}; |
52
|
4
|
50
|
33
|
|
|
24
|
if (((($self->{quant} eq '+')) && (($self->{greedy} eq '')))) { |
53
|
4
|
|
|
|
|
11
|
$self->{term}->set_captures_to_array(); |
54
|
4
|
|
|
|
|
23
|
return scalar (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' ' . 'my ' . chr(36) . 'count ' . chr(61) . ' 0' . chr(59) . ' ' . 'while ' . $self->{term}->emit_perl6() . ' ' . chr(38) . chr(38) . ' (' . chr(36) . 'last_match_null < 2) ' . chr(123) . ' ' . 'if ' . chr(36) . 'last_pos ' . chr(61) . chr(61) . ' ' . chr(36) . 'MATCH.to() ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' ' . chr(36) . 'last_match_null + 1' . chr(59) . ' ' . chr(125) . ' ' . 'else ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' ' . chr(36) . 'count ' . chr(61) . ' ' . chr(36) . 'count + 1' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . chr(36) . 'count > 0' . chr(59) . ' ' . chr(125) . ')')) |
55
|
|
|
|
|
|
|
}; |
56
|
0
|
0
|
0
|
|
|
0
|
if (((($self->{quant} eq '*')) && (($self->{greedy} eq '')))) { |
57
|
0
|
|
|
|
|
0
|
$self->{term}->set_captures_to_array(); |
58
|
0
|
|
|
|
|
0
|
return scalar (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' ' . 'while ' . $self->{term}->emit_perl6() . ' ' . chr(38) . chr(38) . ' (' . chr(36) . 'last_match_null < 2) ' . chr(123) . ' ' . 'if ' . chr(36) . 'last_pos ' . chr(61) . chr(61) . ' ' . chr(36) . 'MATCH.to() ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' ' . chr(36) . 'last_match_null + 1' . chr(59) . ' ' . chr(125) . ' ' . 'else ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . '1 ' . chr(125) . ')')) |
59
|
|
|
|
|
|
|
}; |
60
|
0
|
0
|
0
|
|
|
0
|
if (((($self->{quant} eq chr(63))) && (($self->{greedy} eq '')))) { |
61
|
0
|
|
|
|
|
0
|
$self->{term}->set_captures_to_array(); |
62
|
0
|
|
|
|
|
0
|
return scalar (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' ' . 'if ' . chr(33) . '(do ' . chr(123) . $self->{term}->emit_perl6() . chr(125) . ') ' . chr(123) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . '1 ' . chr(125) . ')')) |
63
|
|
|
|
|
|
|
}; |
64
|
0
|
|
|
|
|
0
|
warn(('Rul::Quantifier: ' . Main::perl($self, ) . (' not implemented'))); |
65
|
|
|
|
|
|
|
$self->{term}->emit_perl6() |
66
|
0
|
|
|
|
|
0
|
}; |
67
|
|
|
|
|
|
|
sub set_captures_to_array { |
68
|
0
|
|
|
0
|
|
0
|
my $self = $_[0]; |
69
|
|
|
|
|
|
|
$self->{term}->set_captures_to_array() |
70
|
0
|
|
|
|
|
0
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
; |
74
|
|
|
|
|
|
|
{ |
75
|
|
|
|
|
|
|
package Rul::Or; |
76
|
8
|
|
|
8
|
|
6
|
sub new { shift; bless { @_ }, "Rul::Or" } |
|
8
|
|
|
|
|
42
|
|
77
|
0
|
|
|
0
|
|
0
|
sub or_list { $_[0]->{or_list} }; |
78
|
|
|
|
|
|
|
sub emit_perl6 { |
79
|
8
|
|
|
8
|
|
8
|
my $self = $_[0]; |
80
|
8
|
50
|
0
|
|
|
8
|
('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'pos1 ' . chr(61) . ' ' . chr(36) . 'MATCH.to' . chr(59) . ' (do ' . chr(123) . ' ' . Main::join(([ map { $_->emit_perl6() } @{( (defined $self->{or_list} ? $self->{or_list} : ($self->{or_list} ||= bless([], 'ARRAY'))) )} ]), chr(125) . ') ' . chr(124) . chr(124) . ' (do ' . chr(123) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'pos1' . chr(59) . ' ') . chr(125) . ') ' . chr(125) . ')') |
|
15
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
23
|
|
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
sub set_captures_to_array { |
83
|
4
|
|
|
4
|
|
6
|
my $self = $_[0]; |
84
|
4
|
50
|
0
|
|
|
3
|
[ map { $_->set_captures_to_array() } @{( (defined $self->{or_list} ? $self->{or_list} : ($self->{or_list} ||= bless([], 'ARRAY'))) )} ] |
|
11
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
14
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
; |
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
package Rul::Concat; |
91
|
15
|
|
|
15
|
|
11
|
sub new { shift; bless { @_ }, "Rul::Concat" } |
|
15
|
|
|
|
|
67
|
|
92
|
0
|
|
|
0
|
|
0
|
sub concat { $_[0]->{concat} }; |
93
|
|
|
|
|
|
|
sub emit_perl6 { |
94
|
15
|
|
|
15
|
|
14
|
my $self = $_[0]; |
95
|
15
|
50
|
0
|
|
|
13
|
('(' . Main::join(([ map { $_->emit_perl6() } @{( (defined $self->{concat} ? $self->{concat} : ($self->{concat} ||= bless([], 'ARRAY'))) )} ]), ' ' . chr(38) . chr(38) . ' ') . ')') |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
27
|
|
96
|
|
|
|
|
|
|
}; |
97
|
|
|
|
|
|
|
sub set_captures_to_array { |
98
|
11
|
|
|
11
|
|
9
|
my $self = $_[0]; |
99
|
11
|
50
|
0
|
|
|
9
|
[ map { $_->set_captures_to_array() } @{( (defined $self->{concat} ? $self->{concat} : ($self->{concat} ||= bless([], 'ARRAY'))) )} ] |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
19
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
; |
104
|
|
|
|
|
|
|
{ |
105
|
|
|
|
|
|
|
package Rul::Subrule; |
106
|
2
|
|
|
2
|
|
2
|
sub new { shift; bless { @_ }, "Rul::Subrule" } |
|
2
|
|
|
|
|
26
|
|
107
|
0
|
|
|
0
|
|
0
|
sub metasyntax { $_[0]->{metasyntax} }; |
108
|
0
|
|
|
0
|
|
0
|
sub captures { $_[0]->{captures} }; |
109
|
|
|
|
|
|
|
sub emit_perl6 { |
110
|
2
|
|
|
2
|
|
3
|
my $self = $_[0]; |
111
|
2
|
50
|
|
|
|
7
|
((my $meth) = (((1 + index($self->{metasyntax}, '.'))) ? $self->{metasyntax} : ((chr(36) . 'grammar.' . $self->{metasyntax})))); |
112
|
2
|
|
|
|
|
2
|
(my $code); |
113
|
2
|
50
|
|
|
|
4
|
if (($self->{captures} == 1)) { |
114
|
0
|
|
|
|
|
0
|
($code = ('if ' . chr(36) . 'm2 ' . chr(123) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'm2.to' . chr(59) . ' ' . chr(36) . 'MATCH' . chr(123) . chr(39) . $self->{metasyntax} . chr(39) . chr(125) . ' ' . chr(61) . ' ' . chr(36) . 'm2' . chr(59) . ' 1 ' . chr(125) . ' else ' . chr(123) . ' False ' . chr(125) . chr(59) . ' ')) |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
else { |
117
|
2
|
50
|
|
|
|
4
|
if (($self->{captures} > 1)) { |
118
|
0
|
|
|
|
|
0
|
($code = ('if ' . chr(36) . 'm2 ' . chr(123) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'm2.to' . chr(59) . ' ' . 'if exists ' . chr(36) . 'MATCH' . chr(123) . chr(39) . $self->{metasyntax} . chr(39) . chr(125) . ' ' . chr(123) . ' ' . '(' . chr(36) . 'MATCH' . chr(123) . chr(39) . $self->{metasyntax} . chr(39) . chr(125) . ').push( ' . chr(36) . 'm2 )' . chr(59) . ' ' . chr(125) . ' ' . 'else ' . chr(123) . ' ' . chr(36) . 'MATCH' . chr(123) . chr(39) . $self->{metasyntax} . chr(39) . chr(125) . ' ' . chr(61) . ' [ ' . chr(36) . 'm2 ]' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . '1 ' . chr(125) . ' else ' . chr(123) . ' False ' . chr(125) . chr(59) . ' ')) |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
else { |
121
|
2
|
|
|
|
|
3
|
($code = 'if ' . chr(36) . 'm2 ' . chr(123) . ' ' . chr(36) . 'MATCH.to ' . chr(61) . ' ' . chr(36) . 'm2.to' . chr(59) . ' 1 ' . chr(125) . ' else ' . chr(123) . ' False ' . chr(125) . chr(59) . ' ') |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
}; |
124
|
2
|
|
|
|
|
12
|
('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'm2 ' . chr(61) . ' ' . $meth . '(' . chr(36) . 'str, ' . chr(36) . 'MATCH.to)' . chr(59) . ' ' . $code . chr(125) . ')') |
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
sub set_captures_to_array { |
127
|
2
|
|
|
2
|
|
3
|
my $self = $_[0]; |
128
|
2
|
50
|
|
|
|
9
|
if (($self->{captures} > 0)) { |
129
|
0
|
|
|
|
|
0
|
($self->{captures} = ($self->{captures} + 1)) |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
; |
135
|
|
|
|
|
|
|
{ |
136
|
|
|
|
|
|
|
package Rul::Var; |
137
|
0
|
|
|
0
|
|
0
|
sub new { shift; bless { @_ }, "Rul::Var" } |
|
0
|
|
|
|
|
0
|
|
138
|
0
|
|
|
0
|
|
0
|
sub sigil { $_[0]->{sigil} }; |
139
|
0
|
|
|
0
|
|
0
|
sub twigil { $_[0]->{twigil} }; |
140
|
0
|
|
|
0
|
|
0
|
sub name { $_[0]->{name} }; |
141
|
|
|
|
|
|
|
sub emit_perl6 { |
142
|
0
|
|
|
0
|
|
0
|
my $self = $_[0]; |
143
|
0
|
|
|
|
|
0
|
((my $table) = do { |
144
|
0
|
|
|
|
|
0
|
(my $Hash_a = bless {}, 'HASH'); |
145
|
0
|
|
|
|
|
0
|
($Hash_a->{chr(36)} = chr(36)); |
146
|
0
|
|
|
|
|
0
|
($Hash_a->{chr(64)} = chr(36) . 'List_'); |
147
|
0
|
|
|
|
|
0
|
($Hash_a->{chr(37)} = chr(36) . 'Hash_'); |
148
|
0
|
|
|
|
|
0
|
($Hash_a->{chr(38)} = chr(36) . 'Code_'); |
149
|
0
|
|
|
|
|
0
|
$Hash_a |
150
|
|
|
|
|
|
|
}); |
151
|
|
|
|
|
|
|
($table->{$self->{sigil}} . $self->{name}) |
152
|
0
|
|
|
|
|
0
|
} |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
; |
156
|
|
|
|
|
|
|
{ |
157
|
|
|
|
|
|
|
package Rul::Constant; |
158
|
9
|
|
|
9
|
|
6
|
sub new { shift; bless { @_ }, "Rul::Constant" } |
|
9
|
|
|
|
|
58
|
|
159
|
0
|
|
|
0
|
|
0
|
sub constant { $_[0]->{constant} }; |
160
|
|
|
|
|
|
|
sub emit_perl6 { |
161
|
9
|
|
|
9
|
|
10
|
my $self = $_[0]; |
162
|
9
|
|
|
|
|
9
|
((my $str) = $self->{constant}); |
163
|
9
|
|
|
|
|
12
|
Rul::constant($str) |
164
|
|
|
|
|
|
|
}; |
165
|
|
|
|
|
|
|
sub set_captures_to_array { |
166
|
9
|
|
|
9
|
|
27
|
my $self = $_[0]; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
; |
172
|
|
|
|
|
|
|
{ |
173
|
|
|
|
|
|
|
package Rul::Dot; |
174
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::Dot" } |
|
0
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub emit_perl6 { |
176
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
177
|
0
|
|
|
|
|
|
('( ' . chr(39) . chr(39) . ' ne substr( ' . chr(36) . 'str, ' . chr(36) . 'MATCH.to, 1 ) ' . chr(38) . chr(38) . ' (' . chr(36) . 'MATCH.to ' . chr(61) . ' 1 + ' . chr(36) . 'MATCH.to)' . ')') |
178
|
|
|
|
|
|
|
}; |
179
|
|
|
|
|
|
|
sub set_captures_to_array { |
180
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
; |
186
|
|
|
|
|
|
|
{ |
187
|
|
|
|
|
|
|
package Rul::SpecialChar; |
188
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::SpecialChar" } |
|
0
|
|
|
|
|
|
|
189
|
0
|
|
|
0
|
|
|
sub char { $_[0]->{char} }; |
190
|
|
|
|
|
|
|
sub emit_perl6 { |
191
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
192
|
0
|
|
|
|
|
|
((my $char) = $self->{char}); |
193
|
0
|
0
|
|
|
|
|
if (($char eq 'n')) { |
194
|
0
|
|
|
|
|
|
return scalar (Rul::Subrule->new(('metasyntax' => 'is_newline'), ('captures' => 0))->emit_perl6()) |
195
|
|
|
|
|
|
|
}; |
196
|
0
|
0
|
|
|
|
|
if (($char eq 'N')) { |
197
|
0
|
|
|
|
|
|
return scalar (Rul::Subrule->new(('metasyntax' => 'not_newline'), ('captures' => 0))->emit_perl6()) |
198
|
|
|
|
|
|
|
}; |
199
|
0
|
0
|
|
|
|
|
if (($char eq 'd')) { |
200
|
0
|
|
|
|
|
|
return scalar (Rul::Subrule->new(('metasyntax' => 'digit'), ('captures' => 0))->emit_perl6()) |
201
|
|
|
|
|
|
|
}; |
202
|
0
|
0
|
|
|
|
|
if (($char eq 's')) { |
203
|
0
|
|
|
|
|
|
return scalar (Rul::Subrule->new(('metasyntax' => 'space'), ('captures' => 0))->emit_perl6()) |
204
|
|
|
|
|
|
|
}; |
205
|
0
|
0
|
|
|
|
|
if (($char eq 't')) { |
206
|
0
|
|
|
|
|
|
return scalar (Rul::constant(chr(9))) |
207
|
|
|
|
|
|
|
}; |
208
|
0
|
|
|
|
|
|
return scalar (Rul::constant($char)) |
209
|
|
|
|
|
|
|
}; |
210
|
|
|
|
|
|
|
sub set_captures_to_array { |
211
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
; |
217
|
|
|
|
|
|
|
{ |
218
|
|
|
|
|
|
|
package Rul::Block; |
219
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::Block" } |
|
0
|
|
|
|
|
|
|
220
|
0
|
|
|
0
|
|
|
sub closure { $_[0]->{closure} }; |
221
|
|
|
|
|
|
|
sub emit_perl6 { |
222
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
223
|
0
|
|
|
|
|
|
('((do ' . chr(123) . ' ' . $self->{closure} . ' ' . chr(125) . ') ' . chr(124) . chr(124) . ' 1)') |
224
|
|
|
|
|
|
|
}; |
225
|
|
|
|
|
|
|
sub set_captures_to_array { |
226
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
; |
232
|
|
|
|
|
|
|
{ |
233
|
|
|
|
|
|
|
package Rul::InterpolateVar; |
234
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::InterpolateVar" } |
|
0
|
|
|
|
|
|
|
235
|
0
|
|
|
0
|
|
|
sub var { $_[0]->{var} }; |
236
|
|
|
|
|
|
|
sub emit_perl6 { |
237
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
238
|
0
|
|
|
|
|
|
Main::say((chr(35) . ' TODO: interpolate var ' . $self->{var}->emit_perl6() . '')); |
239
|
0
|
|
|
|
|
|
die() |
240
|
|
|
|
|
|
|
}; |
241
|
|
|
|
|
|
|
sub set_captures_to_array { |
242
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
; |
248
|
|
|
|
|
|
|
{ |
249
|
|
|
|
|
|
|
package Rul::NamedCapture; |
250
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::NamedCapture" } |
|
0
|
|
|
|
|
|
|
251
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
252
|
0
|
|
|
0
|
|
|
sub capture_ident { $_[0]->{capture_ident} }; |
253
|
|
|
|
|
|
|
sub emit_perl6 { |
254
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
255
|
0
|
|
|
|
|
|
Main::say((chr(35) . ' TODO: named capture ' . $self->{capture_ident} . ' ' . chr(61) . ' ' . $self->{rule_exp}->emit_perl6() . '')); |
256
|
0
|
|
|
|
|
|
die() |
257
|
|
|
|
|
|
|
}; |
258
|
|
|
|
|
|
|
sub set_captures_to_array { |
259
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
260
|
0
|
|
|
|
|
|
Main::say(chr(35) . ' TODO: named capture ') |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
; |
265
|
|
|
|
|
|
|
{ |
266
|
|
|
|
|
|
|
package Rul::Before; |
267
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::Before" } |
|
0
|
|
|
|
|
|
|
268
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
269
|
|
|
|
|
|
|
sub emit_perl6 { |
270
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
271
|
0
|
|
|
|
|
|
('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'tmp ' . chr(61) . ' ' . chr(36) . 'MATCH' . chr(59) . ' ' . chr(36) . 'MATCH ' . chr(61) . ' Perlito6::Match.new( ' . chr(39) . 'str' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'str, ' . chr(39) . 'from' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'tmp.to, ' . chr(39) . 'to' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'tmp.to, ' . chr(39) . 'bool' . chr(39) . ' ' . chr(61) . '> 1 )' . chr(59) . ' ' . chr(36) . 'MATCH.bool ' . chr(61) . ' ' . $self->{rule_exp}->emit_perl6() . chr(59) . ' ' . chr(36) . 'tmp.bool ' . chr(61) . ' ' . chr(63) . chr(36) . 'MATCH' . chr(59) . ' ' . chr(36) . 'MATCH ' . chr(61) . ' ' . chr(36) . 'tmp' . chr(59) . ' ' . chr(63) . chr(36) . 'MATCH' . chr(59) . ' ' . chr(125) . ')') |
272
|
|
|
|
|
|
|
}; |
273
|
|
|
|
|
|
|
sub set_captures_to_array { |
274
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
; |
280
|
|
|
|
|
|
|
{ |
281
|
|
|
|
|
|
|
package Rul::NotBefore; |
282
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::NotBefore" } |
|
0
|
|
|
|
|
|
|
283
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
284
|
|
|
|
|
|
|
sub emit_perl6 { |
285
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
286
|
0
|
|
|
|
|
|
('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'tmp ' . chr(61) . ' ' . chr(36) . 'MATCH' . chr(59) . ' ' . chr(36) . 'MATCH ' . chr(61) . ' Perlito6::Match.new( ' . chr(39) . 'str' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'str, ' . chr(39) . 'from' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'tmp.to, ' . chr(39) . 'to' . chr(39) . ' ' . chr(61) . '> ' . chr(36) . 'tmp.to, ' . chr(39) . 'bool' . chr(39) . ' ' . chr(61) . '> 1 )' . chr(59) . ' ' . chr(36) . 'MATCH.bool ' . chr(61) . ' ' . $self->{rule_exp}->emit_perl6() . chr(59) . ' ' . chr(36) . 'tmp.bool ' . chr(61) . ' ' . chr(33) . chr(36) . 'MATCH' . chr(59) . ' ' . chr(36) . 'MATCH ' . chr(61) . ' ' . chr(36) . 'tmp' . chr(59) . ' ' . chr(63) . chr(36) . 'MATCH' . chr(59) . ' ' . chr(125) . ')') |
287
|
|
|
|
|
|
|
}; |
288
|
|
|
|
|
|
|
sub set_captures_to_array { |
289
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
; |
295
|
|
|
|
|
|
|
{ |
296
|
|
|
|
|
|
|
package Rul::NegateCharClass; |
297
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::NegateCharClass" } |
|
0
|
|
|
|
|
|
|
298
|
0
|
|
|
0
|
|
|
sub chars { $_[0]->{chars} }; |
299
|
|
|
|
|
|
|
sub emit_perl6 { |
300
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
301
|
0
|
|
|
|
|
|
Main::say(('TODO NegateCharClass')); |
302
|
0
|
|
|
|
|
|
die() |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
; |
307
|
|
|
|
|
|
|
{ |
308
|
|
|
|
|
|
|
package Rul::CharClass; |
309
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::CharClass" } |
|
0
|
|
|
|
|
|
|
310
|
0
|
|
|
0
|
|
|
sub chars { $_[0]->{chars} }; |
311
|
|
|
|
|
|
|
sub emit_perl6 { |
312
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
313
|
0
|
|
|
|
|
|
Main::say(('TODO CharClass')); |
314
|
0
|
|
|
|
|
|
die() |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
; |
319
|
|
|
|
|
|
|
{ |
320
|
|
|
|
|
|
|
package Rul::Capture; |
321
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::Capture" } |
|
0
|
|
|
|
|
|
|
322
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
323
|
|
|
|
|
|
|
sub emit_perl6 { |
324
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
325
|
0
|
|
|
|
|
|
Main::say(('TODO RulCapture')); |
326
|
0
|
|
|
|
|
|
die() |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
; |
331
|
|
|
|
|
|
|
{ |
332
|
|
|
|
|
|
|
package Rul::CaptureResult; |
333
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::CaptureResult" } |
|
0
|
|
|
|
|
|
|
334
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
335
|
|
|
|
|
|
|
sub emit_perl6 { |
336
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
337
|
0
|
|
|
|
|
|
Main::say(('TODO Rul::CaptureResult')); |
338
|
0
|
|
|
|
|
|
die() |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
; |
343
|
|
|
|
|
|
|
{ |
344
|
|
|
|
|
|
|
package Rul::After; |
345
|
0
|
|
|
0
|
|
|
sub new { shift; bless { @_ }, "Rul::After" } |
|
0
|
|
|
|
|
|
|
346
|
0
|
|
|
0
|
|
|
sub rule_exp { $_[0]->{rule_exp} }; |
347
|
|
|
|
|
|
|
sub emit_perl6 { |
348
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
349
|
0
|
|
|
|
|
|
Main::say(('TODO Rul::After')); |
350
|
0
|
|
|
|
|
|
die() |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
1; |