Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: rakudo/rakudo
...
head fork: rakudo/rakudo
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
2  docs/ChangeLog
View
@@ -34,6 +34,8 @@ New in 2012.05
+ roundrobin implemented
+ fixed a bug in precompilation of modules that use roles from other modules
+ basic implementation of pack and unpack
++ implemented substr-rw, which provides an l-value (assignable) substring
++ implemented <~~> (recursive call into self) syntax in regexes
New in 2012.04.1
+ autvivification for arrays and hashes
23 src/Perl6/Actions.pm
View
@@ -2212,6 +2212,16 @@ class Perl6::Actions is HLL::Actions {
}
$past.name($name);
$past.blocktype("declaration");
+
+ # Install a $?REGEX (mostly for the benefit of <~~>).
+ $block[0].push(PAST::Op.new(
+ :pasttype('bind'),
+ PAST::Var.new(:name<$?REGEX>, :scope<lexical_6model>, :isdecl(1)),
+ PAST::Op.new(
+ :pirop('perl6_code_object_from_parrot_sub PP'),
+ PAST::Op.new( :pirop('set PQs'), PAST::Op.new( :pirop('getinterp P') ), 'sub')
+ )));
+ $block.symbol('$?REGEX', :scope<lexical_6model>);
# Do the various tasks to turn the block into a method code object.
my $inv_type := $*W.find_symbol([ # XXX Maybe Cursor below, not Mu...
@@ -5348,6 +5358,19 @@ class Perl6::RegexActions is QRegex::P6Regex::Actions {
make $qast;
}
+ method assertion:sym<~~>($/) {
+ if $<num> {
+ pir::die('Sorry, ~~ regex assertion with a capture is not yet implemented');
+ }
+ elsif $<desigilname> {
+ pir::die('Sorry, ~~ regex assertion with a capture is not yet implemented');
+ }
+ else {
+ make QAST::Regex.new( :rxtype<subrule>, :subtype<method>,
+ PAST::Node.new('RECURSE'), :node($/) );
+ }
+ }
+
method codeblock($/) {
my $blockref := $<block>.ast;
my $past :=
5 src/Perl6/Grammar.pm
View
@@ -2880,6 +2880,11 @@ grammar Perl6::RegexGrammar is QRegex::P6Regex::Grammar {
token assertion:sym<var> {
<?[$@&]> <var=.LANG('MAIN', 'variable')>
}
+
+ token assertion:sym<~~> {
+ <sym>
+ [ <?before '>'> | $<num>=[\d+] | <desigilname=.LANG('MAIN','desigilname')> ]
+ }
token codeblock {
<block=.LANG('MAIN','block')>
4 src/core/Cursor.pm
View
@@ -72,6 +72,10 @@ my class Cursor does NQPCursorRole {
$lang_cursor."$name"();
}
+ method RECURSE() {
+ pir::find_dynamic_lex__Ps('$?REGEX')(self)
+ }
+
method prior() {
nqp::isconcrete($last_match) ??
self."!LITERAL"(nqp::unbox_s(~$last_match)) !!

No commit comments for this range

Something went wrong with that request. Please try again.