File tree Expand file tree Collapse file tree 4 files changed +22
-9
lines changed Expand file tree Collapse file tree 4 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -339,6 +339,9 @@ class NQP::Actions is HLL::Actions {
339
339
method statement_control :sym <while >($/ ) {
340
340
my $ past := xblock_immediate( $ < xblock > . ast );
341
341
$ past . op(~ $ < sym > );
342
+ unless $ * CONTROL_USED {
343
+ $ past . push (QAST ::IVal. new ( : value(1 ), : named(' nohandler' ) ));
344
+ }
342
345
make $ past ;
343
346
}
344
347
@@ -353,6 +356,9 @@ class NQP::Actions is HLL::Actions {
353
356
$ past := QAST ::Op. new ( $ < EXPR > . ast, block_immediate( $ < pblock > . ast ),
354
357
: op($ op ), : node($/ ) );
355
358
}
359
+ unless $ * CONTROL_USED {
360
+ $ past . push (QAST ::IVal. new ( : value(1 ), : named(' nohandler' ) ));
361
+ }
356
362
make $ past ;
357
363
}
358
364
Original file line number Diff line number Diff line change @@ -24,11 +24,12 @@ grammar NQP::Grammar is HLL::Grammar {
24
24
NQP::World. new (: handle($ source_id )) !!
25
25
NQP::World. new (: handle($ source_id ), : description($ file ));
26
26
27
- my $ * SCOPE := ' ' ;
28
- my $ * MULTINESS := ' ' ;
29
- my $ * PKGDECL := ' ' ;
30
- my $ * INVOCANT_OK := 0 ;
31
- my $ * RETURN_USED := 0 ;
27
+ my $ * SCOPE := ' ' ;
28
+ my $ * MULTINESS := ' ' ;
29
+ my $ * PKGDECL := ' ' ;
30
+ my $ * INVOCANT_OK := 0 ;
31
+ my $ * RETURN_USED := 0 ;
32
+ my $ * CONTROL_USED := 0 ;
32
33
my % * HANDLERS ;
33
34
self . comp_unit;
34
35
}
@@ -211,11 +212,13 @@ grammar NQP::Grammar is HLL::Grammar {
211
212
}
212
213
213
214
token statement_control :sym <while > {
215
+ :my $ * CONTROL_USED := 0;
214
216
$ < sym > =[while| until] \s :s
215
217
<xblock >
216
218
}
217
219
218
220
token statement_control :sym <repeat > {
221
+ :my $ * CONTROL_USED := 0;
219
222
<sym > \s :s
220
223
[
221
224
| $ < wu > =[while| until]\s <xblock >
@@ -730,9 +733,9 @@ grammar NQP::Grammar is HLL::Grammar {
730
733
731
734
token prefix :sym <return > { <sym > \s <O (' %list_prefix' )> { $ * RETURN_USED := 1 } }
732
735
token prefix :sym <make > { <sym > \s <O (' %list_prefix' )> }
733
- token term :sym <last > { <sym > }
734
- token term :sym <next > { <sym > }
735
- token term :sym <redo > { <sym > }
736
+ token term :sym <last > { <sym > { $ * CONTROL_USED := 1 } }
737
+ token term :sym <next > { <sym > { $ * CONTROL_USED := 1 } }
738
+ token term :sym <redo > { <sym > { $ * CONTROL_USED := 1 } }
736
739
737
740
method smartmatch ($/ ) {
738
741
# swap rhs into invocant position
Original file line number Diff line number Diff line change @@ -612,6 +612,9 @@ for ('', 'repeat_') -> $repness {
612
612
$ ops . push ($ done_lbl );
613
613
$ ops . push_pirop(' pop_eh' );
614
614
}
615
+ else {
616
+ $ ops . push ($ done_lbl );
617
+ }
615
618
616
619
$ ops ;
617
620
});
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ role NQPCursorRole {
182
182
if ! nqp ::isnull($ actions ) && nqp :: can ($ actions , $ name );
183
183
}
184
184
185
+ my @ EMPTY := [];
185
186
method ! protoregex ($ name ) {
186
187
# Obtain and run NFA.
187
188
my $ nfa := self . HOW . cache(self , $ name , { self . ' !protoregex_nfa' ($ name ) });
@@ -195,7 +196,7 @@ role NQPCursorRole {
195
196
$ rxname := nqp ::atpos(@ rxfate , nqp ::pop_i(@ fates ));
196
197
# nqp::say("invoking $rxname");
197
198
$ cur := self . " $ rxname" ();
198
- last if nqp ::getattr_i($ cur , $ ? CLASS , ' $!pos' ) >= 0 ;
199
+ @ fates := @ EMPTY if nqp ::getattr_i($ cur , $ ? CLASS , ' $!pos' ) >= 0 ;
199
200
}
200
201
$ cur // self . " !cursor_start" ();
201
202
}
You can’t perform that action at this time.
0 commit comments