@@ -108,18 +108,19 @@ class QAST::Compiler is HLL::Compiler {
108
108
109
109
# Calculate all the branches to try, which populates the bstack
110
110
# with the options. Then immediately fail to start iterating it.
111
+ my $ prefix := self . unique (' alt' ) ~ ' _' ;
112
+ my $ endlabel := self . post_new(' Label' , : result($ prefix ~ ' end' ));
111
113
my $ label_list_ops := self . post_new(' Ops' , : result<$P11 >);
112
114
$ label_list_ops . push_pirop(' new' , ' $P11' , ' "ResizableIntegerArray"' );
113
115
my $ ops := self . post_new(' Ops' , : result(% * REG <cur >));
114
116
$ ops . push ($ label_list_ops );
117
+ self . regex_mark($ ops , $ endlabel , -1 , 0 );
115
118
$ ops . push_pirop(' callmethod' , ' "!alt"' , % * REG <cur >, % * REG <pos >,
116
119
self . escape($ node . name ), $ label_list_ops . result);
117
120
$ ops . push_pirop(' goto' , % * REG <fail >);
118
121
119
122
# Emit all the possible alternations.
120
- my $ prefix := self . unique (' alt' ) ~ ' _' ;
121
123
my $ altcount := 0 ;
122
- my $ endlabel := self . post_new(' Label' , : result($ prefix ~ ' end' ));
123
124
my $ iter := nqp :: iterator ($ node . list);
124
125
while $ iter {
125
126
my $ altlabel := self . post_new(' Label' , : result($ prefix ~ $ altcount ));
@@ -131,6 +132,7 @@ class QAST::Compiler is HLL::Compiler {
131
132
$ altcount ++ ;
132
133
}
133
134
$ ops . push ($ endlabel );
135
+ self . regex_commit($ ops , $ endlabel ) if $ node . backtrack eq ' r' ;
134
136
$ ops ;
135
137
}
136
138
0 commit comments