Skip to content

Commit fb79576

Browse files
committed
Start updating P6Regex to eliminate use of buildsub (now always uses qbuildsub) and turn some other PAST usages into QAST.
1 parent 694af0d commit fb79576

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/QRegex/P6Regex/Actions.nqp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class QRegex::P6Regex::Actions is HLL::Actions {
22
method TOP($/) {
3-
make buildsub($<nibbler>.ast);
3+
make qbuildsub($<nibbler>.ast, :anon(1), :addself(1));
44
}
55

66
method nibbler($/) { make $<termaltseq>.ast }
@@ -135,15 +135,14 @@ class QRegex::P6Regex::Actions is HLL::Actions {
135135
}
136136

137137
method metachar:sym<( )>($/) {
138-
my $subpast := PAST::Node.new(buildsub($<nibbler>.ast, :anon(1)));
138+
my $subpast := QAST::Node.new(qbuildsub($<nibbler>.ast, :anon(1), :addself(1)));
139139
my $qast := QAST::Regex.new( $subpast, $<nibbler>.ast, :rxtype('subrule'),
140140
:subtype('capture'), :node($/) );
141141
make $qast;
142142
}
143143

144144
method metachar:sym<'>($/) {
145145
my $quote := $<quote_EXPR>.ast;
146-
if PAST::Val.ACCEPTS($quote) { $quote := $quote.value; }
147146
if QAST::SVal.ACCEPTS($quote) { $quote := $quote.value; }
148147
my $qast := QAST::Regex.new( $quote, :rxtype<literal>, :node($/) );
149148
$qast.subtype('ignorecase') if %*RX<i>;
@@ -152,7 +151,6 @@ class QRegex::P6Regex::Actions is HLL::Actions {
152151

153152
method metachar:sym<">($/) {
154153
my $quote := $<quote_EXPR>.ast;
155-
if PAST::Val.ACCEPTS($quote) { $quote := $quote.value; }
156154
if QAST::SVal.ACCEPTS($quote) { $quote := $quote.value; }
157155
my $qast := QAST::Regex.new( $quote, :rxtype<literal>, :node($/) );
158156
$qast.subtype('ignorecase') if %*RX<i>;
@@ -392,8 +390,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
392390
}
393391
elsif $<nibbler> {
394392
$name eq 'after' ??
395-
$qast[0].push(buildsub(self.flip_ast($<nibbler>[0].ast), :anon(1))) !!
396-
$qast[0].push(buildsub($<nibbler>[0].ast, :anon(1)));
393+
$qast[0].push(qbuildsub(self.flip_ast($<nibbler>[0].ast), :anon(1), :addself(1))) !!
394+
$qast[0].push(qbuildsub($<nibbler>[0].ast, :anon(1), :addself(1)));
397395
}
398396
}
399397
make $qast;
@@ -429,7 +427,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
429427
}
430428

431429
method arglist($/) {
432-
my $past := PAST::Op.new( :pasttype('list') );
430+
my $past := QAST::Op.new( :op('list') );
433431
for $<arg> { $past.push( $_.ast ); }
434432
make $past;
435433
}

0 commit comments

Comments
 (0)