Skip to content

Commit b30fb7a

Browse files
committed
Keep :dba(...) values for a bit longer.
This will allow them to make it unti NFA construction time.
1 parent 785d2fa commit b30fb7a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/QAST/Compiler.nqp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,11 @@ class QAST::Compiler is HLL::Compiler {
12391239

12401240
$ops;
12411241
}
1242+
1243+
method dba($node) {
1244+
# Doesn't compile into another; really just for the NFA.
1245+
self.post_new('Ops', :result(%*REG<cur>))
1246+
}
12421247

12431248
my %cclass_code;
12441249
INIT {

src/QRegex/P6Regex/Actions.nqp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
259259
:rxtype<concat>
260260
);
261261
}
262+
263+
method metachar:sym<mod>($/) { make $<mod_internal>.ast; }
262264

263265
method backslash:sym<s>($/) {
264266
make QAST::Regex.new(:rxtype<cclass>, '.CCLASS_WHITESPACE',
@@ -524,7 +526,12 @@ class QRegex::P6Regex::Actions is HLL::Actions {
524526
method mod_internal($/) {
525527
if $<quote_EXPR> {
526528
if $<quote_EXPR>[0].ast ~~ QAST::SVal {
527-
%*RX{ ~$<mod_ident><sym> } := $<quote_EXPR>[0].ast.value;
529+
my $key := ~$<mod_ident><sym>;
530+
my $val := $<quote_EXPR>[0].ast.value;
531+
%*RX{$key} := $val;
532+
make $key eq 'dba'
533+
?? QAST::Regex.new( :rxtype('dba'), :name($val) )
534+
!! 0;
528535
}
529536
else {
530537
$/.CURSOR.panic("Internal modifier strings must be literals");
@@ -533,8 +540,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
533540
else {
534541
my $n := $<n>[0] gt '' ?? +$<n>[0] !! 1;
535542
%*RX{ ~$<mod_ident><sym> } := $n;
543+
make 0;
536544
}
537-
make 0;
538545
}
539546

540547
sub backmod($ast, $backmod) {

0 commit comments

Comments
 (0)