line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Do not edit this file - Generated by Perlito6 9.0 |
2
|
31
|
|
|
31
|
|
214
|
use v5; |
|
31
|
|
|
|
|
66
|
|
3
|
31
|
|
|
31
|
|
95
|
use utf8; |
|
31
|
|
|
|
|
26
|
|
|
31
|
|
|
|
|
112
|
|
4
|
31
|
|
|
31
|
|
488
|
use strict; |
|
31
|
|
|
|
|
35
|
|
|
31
|
|
|
|
|
582
|
|
5
|
31
|
|
|
31
|
|
84
|
use warnings; |
|
31
|
|
|
|
|
30
|
|
|
31
|
|
|
|
|
858
|
|
6
|
31
|
|
|
31
|
|
99
|
no warnings ('redefine', 'once', 'void', 'uninitialized', 'misc', 'recursion'); |
|
31
|
|
|
|
|
34
|
|
|
31
|
|
|
|
|
826
|
|
7
|
31
|
|
|
31
|
|
100
|
use Perlito6::Perl5::Runtime; |
|
31
|
|
|
|
|
28
|
|
|
31
|
|
|
|
|
524
|
|
8
|
31
|
|
|
31
|
|
94
|
use Perlito6::Perl5::Prelude; |
|
31
|
|
|
|
|
26
|
|
|
31
|
|
|
|
|
90910
|
|
9
|
|
|
|
|
|
|
our $MATCH = Perlito6::Match->new(); |
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
package GLOBAL; |
12
|
|
|
|
|
|
|
sub new { shift; bless { @_ }, "GLOBAL" } |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
package Perlito6::Precedence; |
15
|
1667
|
|
|
1667
|
0
|
1278
|
sub new { shift; bless { @_ }, "Perlito6::Precedence" } |
|
1667
|
|
|
|
|
5030
|
|
16
|
1667
|
|
|
1667
|
0
|
1972
|
sub get_token { $_[0]->{get_token} }; |
17
|
1667
|
|
|
1667
|
0
|
1612
|
sub reduce { $_[0]->{reduce} }; |
18
|
1667
|
|
|
1667
|
0
|
1513
|
sub end_token { $_[0]->{end_token} }; |
19
|
|
|
|
|
|
|
((my $Operator) = do { |
20
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
21
|
|
|
|
|
|
|
$Hash_a |
22
|
|
|
|
|
|
|
}); |
23
|
|
|
|
|
|
|
((my $Precedence) = do { |
24
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
25
|
|
|
|
|
|
|
$Hash_a |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
((my $Assoc) = do { |
28
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
29
|
|
|
|
|
|
|
$Hash_a |
30
|
|
|
|
|
|
|
}); |
31
|
|
|
|
|
|
|
((my $Allow_space_before) = do { |
32
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
33
|
|
|
|
|
|
|
$Hash_a |
34
|
|
|
|
|
|
|
}); |
35
|
|
|
|
|
|
|
sub is_assoc_type { |
36
|
1017
|
|
|
1017
|
0
|
1128
|
my $assoc_type = $_[0]; |
37
|
1017
|
|
|
|
|
790
|
my $op_name = $_[1]; |
38
|
1017
|
|
|
|
|
2515
|
return scalar ($Assoc->{$assoc_type}->{$op_name}) |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
sub is_fixity_type { |
41
|
1
|
|
|
1
|
0
|
2
|
my $fixity_type = $_[0]; |
42
|
1
|
|
|
|
|
2
|
my $op_name = $_[1]; |
43
|
1
|
|
|
|
|
5
|
return scalar ($Operator->{$fixity_type}->{$op_name}) |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
sub is_term { |
46
|
5599
|
|
|
5599
|
0
|
4078
|
my $token = $_[0]; |
47
|
5599
|
100
|
|
|
|
18928
|
((($token->[0] eq 'term')) || (($token->[0] eq 'postfix_or_term'))) |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
sub is_ident_middle { |
50
|
2144
|
|
|
2144
|
0
|
1820
|
my $c = $_[0]; |
51
|
2144
|
50
|
100
|
|
|
16439
|
(((((($c ge 'a')) && (($c le 'z')))) || (((($c ge '0')) && (($c le '9'))))) || (($c eq '_'))) |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
(my $List_Op = bless [], 'ARRAY'); |
54
|
|
|
|
|
|
|
(my $End_token); |
55
|
|
|
|
|
|
|
((my $List_Op_chars = bless [], 'ARRAY') = do { |
56
|
|
|
|
|
|
|
(my $List_a = bless [], 'ARRAY'); |
57
|
|
|
|
|
|
|
(my $List_v = bless [], 'ARRAY'); |
58
|
|
|
|
|
|
|
push( @{$List_a}, 3 ); |
59
|
|
|
|
|
|
|
push( @{$List_a}, 2 ); |
60
|
|
|
|
|
|
|
push( @{$List_a}, 1 ); |
61
|
|
|
|
|
|
|
$List_a |
62
|
|
|
|
|
|
|
}); |
63
|
|
|
|
|
|
|
sub op_parse { |
64
|
5014
|
|
|
5014
|
0
|
4167
|
my $self = $_[0]; |
65
|
5014
|
|
|
|
|
3497
|
my $str = $_[1]; |
66
|
5014
|
|
|
|
|
3413
|
my $pos = $_[2]; |
67
|
5014
|
|
|
|
|
3971
|
((my $from) = $pos); |
68
|
5014
|
|
|
|
|
3293
|
for my $tok ( @{(($End_token))} ) { |
|
5014
|
|
|
|
|
7155
|
|
69
|
37117
|
|
|
|
|
43307
|
((my $l) = Main::chars($tok, )); |
70
|
37117
|
|
|
|
|
30404
|
((my $s) = substr($str, $pos, $l)); |
71
|
37117
|
100
|
|
|
|
48420
|
if (($s eq $tok)) { |
72
|
1485
|
|
|
|
|
2091
|
((my $c1) = substr($str, (($pos + $l) - 1), 1)); |
73
|
1485
|
|
|
|
|
1466
|
((my $c2) = substr($str, ($pos + $l), 1)); |
74
|
1485
|
50
|
33
|
|
|
1850
|
if ((is_ident_middle($c1) && ((is_ident_middle($c2) || ($c2 eq '('))))) { |
|
|
|
66
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else { |
78
|
1485
|
|
|
|
|
1710
|
return scalar (Perlito6::Match->new(('str' => $str), ('from' => $from), ('to' => ($pos + 2)), ('bool' => 1), ('capture' => do { |
79
|
1485
|
|
|
|
|
1747
|
(my $List_a = bless [], 'ARRAY'); |
80
|
1485
|
|
|
|
|
1392
|
(my $List_v = bless [], 'ARRAY'); |
81
|
1485
|
|
|
|
|
1098
|
push( @{$List_a}, 'end' ); |
|
1485
|
|
|
|
|
1893
|
|
82
|
1485
|
|
|
|
|
1092
|
push( @{$List_a}, $s ); |
|
1485
|
|
|
|
|
1414
|
|
83
|
1485
|
|
|
|
|
3333
|
$List_a |
84
|
|
|
|
|
|
|
}))) |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
}; |
88
|
3529
|
|
|
|
|
3410
|
((my $c01) = substr($str, $pos, 1)); |
89
|
3529
|
|
|
|
|
3128
|
((my $c02) = substr($str, $pos, 2)); |
90
|
3529
|
|
|
|
|
2673
|
((my $hyper_left) = 0); |
91
|
3529
|
|
|
|
|
2612
|
((my $hyper_right) = 0); |
92
|
3529
|
50
|
33
|
|
|
10538
|
if (((($c01 eq chr(171))) || (($c01 eq chr(187))))) { |
93
|
0
|
|
|
|
|
0
|
($hyper_left = $c01); |
94
|
0
|
|
|
|
|
0
|
($pos = ($pos + 1)); |
95
|
0
|
|
|
|
|
0
|
($c02 = substr($str, $pos, 2)) |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
else { |
98
|
3529
|
100
|
66
|
|
|
10245
|
if (((($c02 eq '<<')) || (($c02 eq '>>')))) { |
99
|
1
|
|
|
|
|
2
|
($hyper_left = $c02); |
100
|
1
|
|
|
|
|
2
|
($pos = ($pos + 2)); |
101
|
1
|
|
|
|
|
1
|
($c02 = substr($str, $pos, 2)) |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
}; |
104
|
3529
|
|
|
|
|
2525
|
for my $len ( @{$List_Op_chars} ) { |
|
3529
|
|
|
|
|
4067
|
|
105
|
10443
|
|
|
|
|
10814
|
((my $op) = substr($str, $pos, $len)); |
106
|
10443
|
100
|
|
|
|
17785
|
if (exists($List_Op->[$len]->{$op})) { |
107
|
593
|
|
|
|
|
1038
|
((my $c1) = substr($str, (($pos + $len) - 1), 1)); |
108
|
593
|
|
|
|
|
768
|
((my $c2) = substr($str, ($pos + $len), 1)); |
109
|
593
|
50
|
33
|
|
|
871
|
if ((is_ident_middle($c1) && ((is_ident_middle($c2) || ($c2 eq '('))))) { |
|
|
|
66
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
593
|
|
|
|
|
547
|
($pos = ($pos + $len)); |
114
|
593
|
|
|
|
|
685
|
((my $c01) = substr($str, $pos, 1)); |
115
|
593
|
|
|
|
|
575
|
((my $c02) = substr($str, $pos, 2)); |
116
|
593
|
50
|
33
|
|
|
1702
|
if (((($c01 eq chr(171))) || (($c01 eq chr(187))))) { |
117
|
0
|
|
|
|
|
0
|
($hyper_right = $c01); |
118
|
0
|
|
|
|
|
0
|
($pos = ($pos + 1)) |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
else { |
121
|
593
|
50
|
33
|
|
|
1856
|
if (((($c02 eq '<<')) || (($c02 eq '>>')))) { |
122
|
0
|
|
|
|
|
0
|
($hyper_right = $c02); |
123
|
0
|
|
|
|
|
0
|
($pos = ($pos + 2)) |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
}; |
126
|
593
|
|
|
|
|
771
|
return scalar (Perlito6::Match->new(('str' => $str), ('from' => $from), ('to' => $pos), ('bool' => 1), ('capture' => do { |
127
|
593
|
|
|
|
|
847
|
(my $List_a = bless [], 'ARRAY'); |
128
|
593
|
|
|
|
|
634
|
(my $List_v = bless [], 'ARRAY'); |
129
|
593
|
|
|
|
|
455
|
push( @{$List_a}, 'op' ); |
|
593
|
|
|
|
|
851
|
|
130
|
593
|
|
|
|
|
443
|
push( @{$List_a}, $op ); |
|
593
|
|
|
|
|
659
|
|
131
|
593
|
|
|
|
|
482
|
push( @{$List_a}, do { |
|
593
|
|
|
|
|
521
|
|
132
|
593
|
|
|
|
|
744
|
(my $Hash_a = bless {}, 'HASH'); |
133
|
593
|
|
|
|
|
901
|
($Hash_a->{'hyper_left'} = $hyper_left); |
134
|
593
|
|
|
|
|
658
|
($Hash_a->{'hyper_right'} = $hyper_right); |
135
|
593
|
|
|
|
|
655
|
$Hash_a |
136
|
|
|
|
|
|
|
} ); |
137
|
593
|
|
|
|
|
1475
|
$List_a |
138
|
|
|
|
|
|
|
}))) |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
}; |
142
|
2936
|
|
|
|
|
5532
|
return scalar (Perlito6::Match->new(('bool' => 0))) |
143
|
|
|
|
|
|
|
}; |
144
|
|
|
|
|
|
|
sub add_op { |
145
|
2480
|
|
|
2480
|
0
|
1762
|
my $fixity = $_[0]; |
146
|
2480
|
|
|
|
|
1581
|
my $name = $_[1]; |
147
|
2480
|
|
|
|
|
1486
|
my $precedence = $_[2]; |
148
|
2480
|
|
|
|
|
1493
|
my $param = $_[3]; |
149
|
2480
|
100
|
|
|
|
3050
|
if (!((defined($param)))) { |
150
|
1116
|
|
|
|
|
663
|
($param = do { |
151
|
1116
|
|
|
|
|
1001
|
(my $Hash_a = bless {}, 'HASH'); |
152
|
1116
|
|
|
|
|
953
|
$Hash_a |
153
|
|
|
|
|
|
|
}) |
154
|
|
|
|
|
|
|
}; |
155
|
2480
|
|
100
|
|
|
4769
|
((my $assoc) = ($param->{'assoc'} || 'left')); |
156
|
2480
|
|
|
|
|
2926
|
($Operator->{$fixity}->{$name} = 1); |
157
|
2480
|
|
|
|
|
2123
|
($Precedence->{$name} = $precedence); |
158
|
2480
|
|
|
|
|
2168
|
($Assoc->{$assoc}->{$name} = 1); |
159
|
2480
|
100
|
|
|
|
3148
|
($Allow_space_before->{$fixity}->{$name} = ($param->{'no_space_before'} ? 0 : 1)); |
160
|
2480
|
|
|
|
|
3408
|
($List_Op->[Main::chars($name, )]->{$name} = 1) |
161
|
|
|
|
|
|
|
}; |
162
|
|
|
|
|
|
|
((my $prec) = 100); |
163
|
|
|
|
|
|
|
add_op('postfix', '.( )', $prec, do { |
164
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
165
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
166
|
|
|
|
|
|
|
$Hash_a |
167
|
|
|
|
|
|
|
}); |
168
|
|
|
|
|
|
|
add_op('postfix', '.[ ]', $prec, do { |
169
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
170
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
171
|
|
|
|
|
|
|
$Hash_a |
172
|
|
|
|
|
|
|
}); |
173
|
|
|
|
|
|
|
add_op('postfix', '.' . chr(123) . ' ' . chr(125), $prec, do { |
174
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
175
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
176
|
|
|
|
|
|
|
$Hash_a |
177
|
|
|
|
|
|
|
}); |
178
|
|
|
|
|
|
|
add_op('postfix', '( )', $prec, do { |
179
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
180
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
181
|
|
|
|
|
|
|
$Hash_a |
182
|
|
|
|
|
|
|
}); |
183
|
|
|
|
|
|
|
add_op('postfix', '[ ]', $prec, do { |
184
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
185
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
186
|
|
|
|
|
|
|
$Hash_a |
187
|
|
|
|
|
|
|
}); |
188
|
|
|
|
|
|
|
add_op('postfix', 'funcall', $prec, do { |
189
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
190
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
191
|
|
|
|
|
|
|
$Hash_a |
192
|
|
|
|
|
|
|
}); |
193
|
|
|
|
|
|
|
add_op('postfix', 'funcall_no_params', $prec, do { |
194
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
195
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
196
|
|
|
|
|
|
|
$Hash_a |
197
|
|
|
|
|
|
|
}); |
198
|
|
|
|
|
|
|
add_op('postfix', 'methcall', $prec, do { |
199
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
200
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
201
|
|
|
|
|
|
|
$Hash_a |
202
|
|
|
|
|
|
|
}); |
203
|
|
|
|
|
|
|
add_op('postfix', 'methcall_no_params', $prec, do { |
204
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
205
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
206
|
|
|
|
|
|
|
$Hash_a |
207
|
|
|
|
|
|
|
}); |
208
|
|
|
|
|
|
|
add_op('postfix', 'block', $prec, do { |
209
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
210
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
211
|
|
|
|
|
|
|
$Hash_a |
212
|
|
|
|
|
|
|
}); |
213
|
|
|
|
|
|
|
add_op('postfix', 'hash', $prec, do { |
214
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
215
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
216
|
|
|
|
|
|
|
$Hash_a |
217
|
|
|
|
|
|
|
}); |
218
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
219
|
|
|
|
|
|
|
add_op('prefix', '++', $prec); |
220
|
|
|
|
|
|
|
add_op('prefix', '--', $prec); |
221
|
|
|
|
|
|
|
add_op('postfix', '++', $prec, do { |
222
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
223
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
224
|
|
|
|
|
|
|
$Hash_a |
225
|
|
|
|
|
|
|
}); |
226
|
|
|
|
|
|
|
add_op('postfix', '--', $prec, do { |
227
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
228
|
|
|
|
|
|
|
($Hash_a->{'no_space_before'} = 1); |
229
|
|
|
|
|
|
|
$Hash_a |
230
|
|
|
|
|
|
|
}); |
231
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
232
|
|
|
|
|
|
|
add_op('infix', '**', $prec, do { |
233
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
234
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
235
|
|
|
|
|
|
|
$Hash_a |
236
|
|
|
|
|
|
|
}); |
237
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
238
|
|
|
|
|
|
|
add_op('prefix', '+', $prec); |
239
|
|
|
|
|
|
|
add_op('prefix', '-', $prec); |
240
|
|
|
|
|
|
|
add_op('prefix', chr(36), $prec); |
241
|
|
|
|
|
|
|
add_op('prefix', chr(64), $prec); |
242
|
|
|
|
|
|
|
add_op('prefix', chr(37), $prec); |
243
|
|
|
|
|
|
|
add_op('prefix', chr(33), $prec); |
244
|
|
|
|
|
|
|
add_op('prefix', chr(63), $prec); |
245
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
246
|
|
|
|
|
|
|
add_op('infix', '*', $prec); |
247
|
|
|
|
|
|
|
add_op('infix', chr(47), $prec); |
248
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
249
|
|
|
|
|
|
|
add_op('infix', '+', $prec); |
250
|
|
|
|
|
|
|
add_op('infix', '-', $prec); |
251
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
252
|
|
|
|
|
|
|
add_op('infix', 'x', $prec); |
253
|
|
|
|
|
|
|
add_op('infix', 'xx', $prec); |
254
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
255
|
|
|
|
|
|
|
add_op('infix', chr(126), $prec, do { |
256
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
257
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'list'); |
258
|
|
|
|
|
|
|
$Hash_a |
259
|
|
|
|
|
|
|
}); |
260
|
|
|
|
|
|
|
add_op('prefix', chr(126), $prec); |
261
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
262
|
|
|
|
|
|
|
add_op('infix', chr(38), $prec, do { |
263
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
264
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'list'); |
265
|
|
|
|
|
|
|
$Hash_a |
266
|
|
|
|
|
|
|
}); |
267
|
|
|
|
|
|
|
add_op('prefix', chr(38), $prec); |
268
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
269
|
|
|
|
|
|
|
add_op('infix', chr(124), $prec, do { |
270
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
271
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'list'); |
272
|
|
|
|
|
|
|
$Hash_a |
273
|
|
|
|
|
|
|
}); |
274
|
|
|
|
|
|
|
add_op('prefix', chr(124), $prec); |
275
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
276
|
|
|
|
|
|
|
add_op('infix', '<' . chr(61) . '>', $prec); |
277
|
|
|
|
|
|
|
add_op('infix', 'leg', $prec); |
278
|
|
|
|
|
|
|
add_op('infix', 'cmp', $prec); |
279
|
|
|
|
|
|
|
add_op('infix', 'does', $prec); |
280
|
|
|
|
|
|
|
add_op('infix', 'but', $prec); |
281
|
|
|
|
|
|
|
add_op('infix', '..', $prec); |
282
|
|
|
|
|
|
|
add_op('infix', chr(94) . '..', $prec); |
283
|
|
|
|
|
|
|
add_op('infix', '..' . chr(94), $prec); |
284
|
|
|
|
|
|
|
add_op('infix', chr(94) . '..' . chr(94), $prec); |
285
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
286
|
|
|
|
|
|
|
add_op('infix', chr(61) . chr(61) . chr(61), $prec, do { |
287
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
288
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
289
|
|
|
|
|
|
|
$Hash_a |
290
|
|
|
|
|
|
|
}); |
291
|
|
|
|
|
|
|
add_op('infix', 'ne', $prec, do { |
292
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
293
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
294
|
|
|
|
|
|
|
$Hash_a |
295
|
|
|
|
|
|
|
}); |
296
|
|
|
|
|
|
|
add_op('infix', 'eq', $prec, do { |
297
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
298
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
299
|
|
|
|
|
|
|
$Hash_a |
300
|
|
|
|
|
|
|
}); |
301
|
|
|
|
|
|
|
add_op('infix', 'lt', $prec, do { |
302
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
303
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
304
|
|
|
|
|
|
|
$Hash_a |
305
|
|
|
|
|
|
|
}); |
306
|
|
|
|
|
|
|
add_op('infix', 'le', $prec, do { |
307
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
308
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
309
|
|
|
|
|
|
|
$Hash_a |
310
|
|
|
|
|
|
|
}); |
311
|
|
|
|
|
|
|
add_op('infix', 'gt', $prec, do { |
312
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
313
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
314
|
|
|
|
|
|
|
$Hash_a |
315
|
|
|
|
|
|
|
}); |
316
|
|
|
|
|
|
|
add_op('infix', 'ge', $prec, do { |
317
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
318
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
319
|
|
|
|
|
|
|
$Hash_a |
320
|
|
|
|
|
|
|
}); |
321
|
|
|
|
|
|
|
add_op('infix', '<' . chr(61), $prec, do { |
322
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
323
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
324
|
|
|
|
|
|
|
$Hash_a |
325
|
|
|
|
|
|
|
}); |
326
|
|
|
|
|
|
|
add_op('infix', '>' . chr(61), $prec, do { |
327
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
328
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
329
|
|
|
|
|
|
|
$Hash_a |
330
|
|
|
|
|
|
|
}); |
331
|
|
|
|
|
|
|
add_op('infix', chr(61) . chr(61), $prec, do { |
332
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
333
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
334
|
|
|
|
|
|
|
$Hash_a |
335
|
|
|
|
|
|
|
}); |
336
|
|
|
|
|
|
|
add_op('infix', chr(33) . chr(61), $prec, do { |
337
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
338
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
339
|
|
|
|
|
|
|
$Hash_a |
340
|
|
|
|
|
|
|
}); |
341
|
|
|
|
|
|
|
add_op('infix', '<', $prec, do { |
342
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
343
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
344
|
|
|
|
|
|
|
$Hash_a |
345
|
|
|
|
|
|
|
}); |
346
|
|
|
|
|
|
|
add_op('infix', '>', $prec, do { |
347
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
348
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
349
|
|
|
|
|
|
|
$Hash_a |
350
|
|
|
|
|
|
|
}); |
351
|
|
|
|
|
|
|
add_op('infix', chr(126) . chr(126), $prec, do { |
352
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
353
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'chain'); |
354
|
|
|
|
|
|
|
$Hash_a |
355
|
|
|
|
|
|
|
}); |
356
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
357
|
|
|
|
|
|
|
add_op('infix', chr(38) . chr(38), $prec); |
358
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
359
|
|
|
|
|
|
|
add_op('infix', chr(124) . chr(124), $prec); |
360
|
|
|
|
|
|
|
add_op('infix', chr(47) . chr(47), $prec); |
361
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
362
|
|
|
|
|
|
|
add_op('ternary', chr(63) . chr(63) . ' ' . chr(33) . chr(33), $prec); |
363
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
364
|
|
|
|
|
|
|
add_op('infix', chr(61), $prec, do { |
365
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
366
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
367
|
|
|
|
|
|
|
$Hash_a |
368
|
|
|
|
|
|
|
}); |
369
|
|
|
|
|
|
|
add_op('infix', ':' . chr(61), $prec, do { |
370
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
371
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
372
|
|
|
|
|
|
|
$Hash_a |
373
|
|
|
|
|
|
|
}); |
374
|
|
|
|
|
|
|
add_op('infix', chr(124) . chr(124) . chr(61), $prec, do { |
375
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
376
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
377
|
|
|
|
|
|
|
$Hash_a |
378
|
|
|
|
|
|
|
}); |
379
|
|
|
|
|
|
|
add_op('infix', chr(38) . chr(38) . chr(61), $prec, do { |
380
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
381
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
382
|
|
|
|
|
|
|
$Hash_a |
383
|
|
|
|
|
|
|
}); |
384
|
|
|
|
|
|
|
add_op('infix', chr(124) . chr(61), $prec, do { |
385
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
386
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
387
|
|
|
|
|
|
|
$Hash_a |
388
|
|
|
|
|
|
|
}); |
389
|
|
|
|
|
|
|
add_op('infix', chr(38) . chr(61), $prec, do { |
390
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
391
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
392
|
|
|
|
|
|
|
$Hash_a |
393
|
|
|
|
|
|
|
}); |
394
|
|
|
|
|
|
|
add_op('infix', chr(47) . chr(47) . chr(61), $prec, do { |
395
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
396
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
397
|
|
|
|
|
|
|
$Hash_a |
398
|
|
|
|
|
|
|
}); |
399
|
|
|
|
|
|
|
add_op('infix', '+' . chr(61), $prec, do { |
400
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
401
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
402
|
|
|
|
|
|
|
$Hash_a |
403
|
|
|
|
|
|
|
}); |
404
|
|
|
|
|
|
|
add_op('infix', '-' . chr(61), $prec, do { |
405
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
406
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
407
|
|
|
|
|
|
|
$Hash_a |
408
|
|
|
|
|
|
|
}); |
409
|
|
|
|
|
|
|
add_op('infix', '*' . chr(61), $prec, do { |
410
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
411
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
412
|
|
|
|
|
|
|
$Hash_a |
413
|
|
|
|
|
|
|
}); |
414
|
|
|
|
|
|
|
add_op('infix', chr(47) . chr(61), $prec, do { |
415
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
416
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
417
|
|
|
|
|
|
|
$Hash_a |
418
|
|
|
|
|
|
|
}); |
419
|
|
|
|
|
|
|
add_op('infix', chr(126) . chr(61), $prec, do { |
420
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
421
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'right'); |
422
|
|
|
|
|
|
|
$Hash_a |
423
|
|
|
|
|
|
|
}); |
424
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
425
|
|
|
|
|
|
|
add_op('prefix', 'not', $prec); |
426
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
427
|
|
|
|
|
|
|
add_op('infix', chr(61) . '>', $prec); |
428
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
429
|
|
|
|
|
|
|
add_op('list', ',', $prec, do { |
430
|
|
|
|
|
|
|
(my $Hash_a = bless {}, 'HASH'); |
431
|
|
|
|
|
|
|
($Hash_a->{'assoc'} = 'list'); |
432
|
|
|
|
|
|
|
$Hash_a |
433
|
|
|
|
|
|
|
}); |
434
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
435
|
|
|
|
|
|
|
add_op('infix', 'and', $prec); |
436
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
437
|
|
|
|
|
|
|
add_op('infix', 'or', $prec); |
438
|
|
|
|
|
|
|
($prec = ($prec - 1)); |
439
|
|
|
|
|
|
|
add_op('infix', '*start*', $prec); |
440
|
|
|
|
|
|
|
sub precedence_parse { |
441
|
1667
|
|
|
1667
|
0
|
1371
|
my $self = $_[0]; |
442
|
1667
|
|
|
|
|
2514
|
((my $get_token) = $self->get_token()); |
443
|
1667
|
|
|
|
|
2139
|
((my $reduce) = $self->reduce()); |
444
|
1667
|
|
|
|
|
1375
|
((my $last_end_token) = $End_token); |
445
|
1667
|
|
|
|
|
2014
|
($End_token = $self->end_token()); |
446
|
1667
|
|
|
|
|
1252
|
((my $op_stack) = do { |
447
|
1667
|
|
|
|
|
1678
|
(my $List_a = bless [], 'ARRAY'); |
448
|
1667
|
|
|
|
|
1529
|
(my $List_v = bless [], 'ARRAY'); |
449
|
1667
|
|
|
|
|
1672
|
$List_a |
450
|
|
|
|
|
|
|
}); |
451
|
1667
|
|
|
|
|
1224
|
((my $num_stack) = do { |
452
|
1667
|
|
|
|
|
1547
|
(my $List_a = bless [], 'ARRAY'); |
453
|
1667
|
|
|
|
|
1522
|
(my $List_v = bless [], 'ARRAY'); |
454
|
1667
|
|
|
|
|
1502
|
$List_a |
455
|
|
|
|
|
|
|
}); |
456
|
1667
|
|
|
|
|
1236
|
((my $last) = do { |
457
|
1667
|
|
|
|
|
1525
|
(my $List_a = bless [], 'ARRAY'); |
458
|
1667
|
|
|
|
|
1481
|
(my $List_v = bless [], 'ARRAY'); |
459
|
1667
|
|
|
|
|
1185
|
push( @{$List_a}, 'op' ); |
|
1667
|
|
|
|
|
1846
|
|
460
|
1667
|
|
|
|
|
1192
|
push( @{$List_a}, '*start*' ); |
|
1667
|
|
|
|
|
1458
|
|
461
|
1667
|
|
|
|
|
1577
|
$List_a |
462
|
|
|
|
|
|
|
}); |
463
|
1667
|
|
|
|
|
1379
|
((my $last_has_space) = 0); |
464
|
1667
|
|
|
|
|
2632
|
((my $token) = $get_token->()); |
465
|
1667
|
100
|
|
|
|
3003
|
if ((($token->[0]) eq 'space')) { |
466
|
179
|
|
|
|
|
296
|
($token = $get_token->()) |
467
|
|
|
|
|
|
|
}; |
468
|
1667
|
|
66
|
|
|
5845
|
for ( ; ((defined($token)) && (($token->[0] ne 'end'))); ) { |
469
|
2902
|
50
|
33
|
|
|
6046
|
if (((($token->[1] eq ',')) && (((($last->[1] eq '*start*')) || (($last->[1] eq ',')))))) { |
|
|
|
66
|
|
|
|
|
470
|
0
|
|
|
|
|
0
|
push( @{$num_stack}, do { |
|
0
|
|
|
|
|
0
|
|
471
|
0
|
|
|
|
|
0
|
(my $List_a = bless [], 'ARRAY'); |
472
|
0
|
|
|
|
|
0
|
(my $List_v = bless [], 'ARRAY'); |
473
|
0
|
|
|
|
|
0
|
push( @{$List_a}, 'term' ); |
|
0
|
|
|
|
|
0
|
|
474
|
0
|
|
|
|
|
0
|
push( @{$List_a}, undef() ); |
|
0
|
|
|
|
|
0
|
|
475
|
0
|
|
|
|
|
0
|
$List_a |
476
|
|
|
|
|
|
|
} ) |
477
|
|
|
|
|
|
|
}; |
478
|
2902
|
100
|
100
|
|
|
8641
|
if (($Operator->{'prefix'}->{$token->[1]} && (((($last->[1] eq '*start*')) || !((is_term($last))))))) { |
|
|
|
66
|
|
|
|
|
479
|
20
|
|
|
|
|
30
|
($token->[0] = 'prefix'); |
480
|
20
|
|
|
|
|
25
|
unshift( @{$op_stack}, $token ) |
|
20
|
|
|
|
|
37
|
|
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
else { |
483
|
2882
|
100
|
100
|
|
|
8196
|
if ((($Operator->{'postfix'}->{$token->[1]} && is_term($last)) && (($Allow_space_before->{'postfix'}->{$token->[1]} || !(($last_has_space)))))) { |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
484
|
205
|
|
|
|
|
356
|
((my $pr) = $Precedence->{$token->[1]}); |
485
|
205
|
|
100
|
|
|
208
|
for ( ; (scalar( @{$op_stack} ) && (($pr <= $Precedence->{($op_stack->[0])->[1]}))); ) { |
|
217
|
|
|
|
|
840
|
|
486
|
12
|
|
|
|
|
40
|
$reduce->($op_stack, $num_stack) |
487
|
|
|
|
|
|
|
}; |
488
|
205
|
50
|
|
|
|
403
|
if ((($token->[0]) ne 'postfix_or_term')) { |
489
|
0
|
|
|
|
|
0
|
($token->[0] = 'postfix') |
490
|
|
|
|
|
|
|
}; |
491
|
205
|
|
|
|
|
184
|
unshift( @{$op_stack}, $token ) |
|
205
|
|
|
|
|
336
|
|
492
|
|
|
|
|
|
|
} |
493
|
|
|
|
|
|
|
else { |
494
|
2677
|
100
|
100
|
|
|
6050
|
if ((((($token->[1] eq 'block')) && is_term($last)) && $last_has_space)) { |
|
|
|
66
|
|
|
|
|
495
|
93
|
|
|
|
|
107
|
for ( ; scalar( @{$op_stack} ); ) { |
|
170
|
|
|
|
|
386
|
|
496
|
77
|
|
|
|
|
198
|
$reduce->($op_stack, $num_stack) |
497
|
|
|
|
|
|
|
}; |
498
|
93
|
|
|
|
|
110
|
push( @{$num_stack}, $token ); |
|
93
|
|
|
|
|
142
|
|
499
|
93
|
|
|
|
|
106
|
($End_token = $last_end_token); |
500
|
93
|
|
|
|
|
253
|
return scalar ($num_stack) |
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
else { |
503
|
2584
|
100
|
|
|
|
3509
|
if (is_term($token)) { |
504
|
1975
|
50
|
|
|
|
2160
|
if (is_term($last)) { |
505
|
0
|
|
|
|
|
0
|
Main::say((chr(35) . ' last: '), Main::perl($last, )); |
506
|
0
|
|
|
|
|
0
|
Main::say((chr(35) . ' token: '), Main::perl($token, )); |
507
|
0
|
|
|
|
|
0
|
Main::say((chr(35) . ' space: '), $last_has_space); |
508
|
0
|
|
|
|
|
0
|
die(('Value tokens must be separated by an operator')) |
509
|
|
|
|
|
|
|
}; |
510
|
1975
|
|
|
|
|
2401
|
($token->[0] = 'term'); |
511
|
1975
|
|
|
|
|
1512
|
push( @{$num_stack}, $token ) |
|
1975
|
|
|
|
|
2883
|
|
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
else { |
514
|
609
|
50
|
|
|
|
1246
|
if ($Precedence->{$token->[1]}) { |
515
|
609
|
|
|
|
|
789
|
((my $pr) = $Precedence->{$token->[1]}); |
516
|
609
|
100
|
|
|
|
1112
|
if ($Assoc->{'right'}->{$token->[1]}) { |
517
|
171
|
|
66
|
|
|
182
|
for ( ; (scalar( @{$op_stack} ) && (($pr < $Precedence->{($op_stack->[0])->[1]}))); ) { |
|
216
|
|
|
|
|
705
|
|
518
|
45
|
|
|
|
|
120
|
$reduce->($op_stack, $num_stack) |
519
|
|
|
|
|
|
|
} |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
else { |
522
|
438
|
|
100
|
|
|
396
|
for ( ; (scalar( @{$op_stack} ) && (($pr <= $Precedence->{($op_stack->[0])->[1]}))); ) { |
|
572
|
|
|
|
|
1732
|
|
523
|
134
|
|
|
|
|
300
|
$reduce->($op_stack, $num_stack) |
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
}; |
526
|
609
|
100
|
|
|
|
1311
|
if ($Operator->{'ternary'}->{$token->[1]}) { |
527
|
36
|
|
|
|
|
52
|
($token->[0] = 'ternary') |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
else { |
530
|
573
|
|
|
|
|
601
|
($token->[0] = 'infix') |
531
|
|
|
|
|
|
|
}; |
532
|
609
|
|
|
|
|
515
|
unshift( @{$op_stack}, $token ) |
|
609
|
|
|
|
|
1019
|
|
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
else { |
535
|
0
|
|
|
|
|
0
|
die(('Unknown token: ' . chr(39)), $token->[1], (chr(39))) |
536
|
|
|
|
|
|
|
} |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
}; |
541
|
2809
|
|
|
|
|
2607
|
($last = $token); |
542
|
2809
|
|
|
|
|
5092
|
($token = $get_token->()); |
543
|
2809
|
100
|
|
|
|
4544
|
if (($token->[0] eq 'space')) { |
544
|
1366
|
|
|
|
|
2179
|
($token = $get_token->()); |
545
|
1366
|
|
|
|
|
5757
|
($last_has_space = 1) |
546
|
|
|
|
|
|
|
} |
547
|
|
|
|
|
|
|
else { |
548
|
1443
|
|
|
|
|
5217
|
($last_has_space = 0) |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
}; |
551
|
1574
|
50
|
33
|
|
|
4636
|
if ((defined($token) && (($token->[0] ne 'end')))) { |
552
|
0
|
|
|
|
|
0
|
die(('Unexpected end token: '), Main::perl($token, )) |
553
|
|
|
|
|
|
|
}; |
554
|
1574
|
|
|
|
|
1297
|
for ( ; scalar( @{$op_stack} ); ) { |
|
2140
|
|
|
|
|
3777
|
|
555
|
566
|
|
|
|
|
1165
|
$reduce->($op_stack, $num_stack) |
556
|
|
|
|
|
|
|
}; |
557
|
1574
|
|
|
|
|
1382
|
($End_token = $last_end_token); |
558
|
1574
|
|
|
|
|
3613
|
return scalar ($num_stack) |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
} |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
} |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
1; |