Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix interaction of action methods and ::(...).
This gets custom circumfixes working again in categorically-better.
  • Loading branch information
jnthn committed Oct 21, 2012
1 parent d3b8c89 commit f90a081
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/NQP/Grammar.pm
Expand Up @@ -562,7 +562,7 @@ grammar NQP::Grammar is HLL::Grammar {
{
%*RX<s> := $<sym> eq 'rule';
%*RX<r> := $<sym> eq 'token' || $<sym> eq 'rule';
%*RX<name> := $<deflongname>.ast if $<deflongname>;
%*RX<name> := $<deflongname> ?? $<deflongname>.ast !! "!!LATENAME!!" ~ ~$<latename>;
}
'{'<p6regex=.LANG('Regex','nibbler')>'}'<?ENDSTMT>
]
Expand Down
5 changes: 5 additions & 0 deletions src/QAST/Compiler.nqp
Expand Up @@ -1322,6 +1322,11 @@ class QAST::Compiler is HLL::Compiler {
my $name := self.escape($node.name());
$ops.push_pirop('callmethod', '"!cursor_pass"', %*REG<cur>, %*REG<pos>, $name, |@backtrack);
}
elsif +@($node) == 1 {
my $dynname := self.coerce(self.as_post($node[0]), 'S');
$ops.push($dynname);
$ops.push_pirop('callmethod', '"!cursor_pass"', %*REG<cur>, %*REG<pos>, $dynname, |@backtrack);
}
else {
$ops.push_pirop('callmethod', '"!cursor_pass"', %*REG<cur>, %*REG<pos>, |@backtrack);
}
Expand Down
14 changes: 11 additions & 3 deletions src/QRegex/P6Regex/Actions.nqp
Expand Up @@ -565,9 +565,17 @@ class QRegex::P6Regex::Actions is HLL::Actions {
$qast := QAST::Regex.new( :rxtype<concat>,
QAST::Regex.new( :rxtype<scan> ),
$qast,
($anon ??
QAST::Regex.new( :rxtype<pass> ) !!
QAST::Regex.new( :rxtype<pass>, :name(%*RX<name>) )));
($anon
?? QAST::Regex.new( :rxtype<pass> )
!! (nqp::substr(%*RX<name>, 0, 12) ne '!!LATENAME!!'
?? QAST::Regex.new( :rxtype<pass>, :name(%*RX<name>) )
!! QAST::Regex.new( :rxtype<pass>,
QAST::Var.new(
:name(nqp::substr(%*RX<name>, 12)),
:scope('lexical')
)
)
)));
$block.push($qast);

$block;
Expand Down

0 comments on commit f90a081

Please sign in to comment.