Skip to content

Commit 6c19396

Browse files
committed
Add qlist, findnotcclass.
1 parent de65b03 commit 6c19396

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/QAST/Operations.nqp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ QAST::Operations.add_core_op('list', -> $qastcomp, $op {
187187
$ops
188188
});
189189

190+
QAST::Operations.add_core_op('qlist', -> $qastcomp, $op {
191+
# Create register for the resulting list and make an empty one.
192+
my $list_reg := $*REGALLOC.fresh_p();
193+
my $ops := $qastcomp.post_new('Ops', :result($list_reg));
194+
$ops.push_pirop('new', $list_reg, "'QRPA'");
195+
196+
# Push all the things.
197+
for $op.list {
198+
my $post := $qastcomp.coerce($qastcomp.as_post($_), 'P');
199+
$ops.push($post);
200+
$ops.push_pirop('push', $list_reg, $post.result);
201+
}
202+
203+
$ops
204+
});
205+
190206
QAST::Operations.add_core_op('list_i', -> $qastcomp, $op {
191207
# Create register for the resulting list and make an empty one.
192208
my $list_reg := $*REGALLOC.fresh_p();
@@ -1155,6 +1171,7 @@ QAST::Operations.add_core_pirop_mapping('lc', 'downcase', 'Ss');
11551171
QAST::Operations.add_core_pirop_mapping('uc', 'upcase', 'Ss');
11561172
QAST::Operations.add_core_pirop_mapping('x', 'repeat', 'Ssi');
11571173
QAST::Operations.add_core_pirop_mapping('iscclass', 'is_cclass', 'Iisi');
1174+
QAST::Operations.add_core_pirop_mapping('findnotcclass', 'find_not_cclass', 'Iisii');
11581175
QAST::Operations.add_core_pirop_mapping('sprintf', 'sprintf', 'SsP');
11591176

11601177
# substr can take 2 or 3 args, so needs special handling.

0 commit comments

Comments
 (0)