Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Keep :dba(...) values for a bit longer.
This will allow them to make it unti NFA construction time.
  • Loading branch information
jnthn committed Dec 8, 2012
1 parent 785d2fa commit b30fb7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/QAST/Compiler.nqp
Expand Up @@ -1239,6 +1239,11 @@ class QAST::Compiler is HLL::Compiler {

$ops;
}

method dba($node) {
# Doesn't compile into another; really just for the NFA.
self.post_new('Ops', :result(%*REG<cur>))
}

my %cclass_code;
INIT {
Expand Down
11 changes: 9 additions & 2 deletions src/QRegex/P6Regex/Actions.nqp
Expand Up @@ -259,6 +259,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
:rxtype<concat>
);
}

method metachar:sym<mod>($/) { make $<mod_internal>.ast; }

method backslash:sym<s>($/) {
make QAST::Regex.new(:rxtype<cclass>, '.CCLASS_WHITESPACE',
Expand Down Expand Up @@ -524,7 +526,12 @@ class QRegex::P6Regex::Actions is HLL::Actions {
method mod_internal($/) {
if $<quote_EXPR> {
if $<quote_EXPR>[0].ast ~~ QAST::SVal {
%*RX{ ~$<mod_ident><sym> } := $<quote_EXPR>[0].ast.value;
my $key := ~$<mod_ident><sym>;
my $val := $<quote_EXPR>[0].ast.value;
%*RX{$key} := $val;
make $key eq 'dba'
?? QAST::Regex.new( :rxtype('dba'), :name($val) )
!! 0;
}
else {
$/.CURSOR.panic("Internal modifier strings must be literals");
Expand All @@ -533,8 +540,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
else {
my $n := $<n>[0] gt '' ?? +$<n>[0] !! 1;
%*RX{ ~$<mod_ident><sym> } := $n;
make 0;
}
make 0;
}

sub backmod($ast, $backmod) {
Expand Down

0 comments on commit b30fb7a

Please sign in to comment.