Skip to content

Commit

Permalink
Rework self and $¢ a bit
Browse files Browse the repository at this point in the history
The parameter to regexes is now named self like in any other method.
$¢ is a lexical alias created within $~MAIN snippets.
  • Loading branch information
sorear committed Oct 23, 2010
1 parent afb1d26 commit 8d62cee
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Niecza/Actions.pm
Expand Up @@ -306,7 +306,7 @@ sub op_for_regex { my ($cl, $M, $rxop) = @_;
transparent => 1,
class => 'Regex',
type => 'regex',
signature => Sig->simple->for_regex,
signature => Sig->simple->for_method,
do => Op::RegexBody->new(node($M), canback => $mb, pre => \@lift,
rxop => $orxop)));
}
Expand All @@ -330,7 +330,7 @@ sub encapsulate_regex { my ($cl, $M, $rxop, %args) = @_;
class => 'Regex',
type => 'regex',
ltm => $lad,
signature => Sig->simple->for_regex,
signature => Sig->simple->for_method,
do => Op::RegexBody->new(canback => $mb, pre => \@lift,
passcut => $args{passcut}, passcap => $args{passcap},
rxop => $nrxop)));
Expand Down Expand Up @@ -423,7 +423,7 @@ sub regex_def { my ($cl, $M) = @_;
returnable => 1,
class => 'Regex',
type => 'regex',
signature => $sig->for_regex,
signature => $sig->for_method,
do => Op::RegexBody->new(pre => \@lift,
name => ($name // ''), rxop => $ast, canback => $mb)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Op.pm
Expand Up @@ -1034,7 +1034,7 @@ use CgOp;
CgOp::prog(
@pre,
CgOp::rxinit(CgOp::clr_string($self->name),
CgOp::cast('cursor', CgOp::fetch(CgOp::scopedlex(''))),
CgOp::cast('cursor', CgOp::fetch(CgOp::scopedlex('self'))),
$self->passcap, $self->passcut),
($self->passcap ? () :
CgOp::rxpushcapture(CgOp::null('cursor'), @mcaps)),
Expand Down
2 changes: 1 addition & 1 deletion src/RxOp.pm
Expand Up @@ -844,7 +844,7 @@ use CgOp;
# will probably break with complicated harnesses
CgOp::letn(
"fns", CgOp::rawscall('Lexer.RunProtoregex',
CgOp::fetch(CgOp::scopedlex('')),
CgOp::fetch(CgOp::scopedlex('self')),
CgOp::clr_string($self->name)),
"i", CgOp::int(0),
"ks", CgOp::null('var'),
Expand Down
6 changes: 0 additions & 6 deletions src/Sig.pm
Expand Up @@ -170,12 +170,6 @@ use 5.010;
Sig->new(params => [ $sp, @{ $self->params } ]);
}

sub for_regex {
my ($self) = @_;
my $sp = Sig::Parameter->new(slot => '', name => '', readonly => 1);
Sig->new(params => [ $sp, @{ $self->params } ]);
}

sub simple {
my ($class, @names) = @_;
Sig->new(params => [map { Sig::Parameter->new(slot => $_, name => $_,
Expand Down
4 changes: 3 additions & 1 deletion v6/TODO
@@ -1,11 +1,12 @@
Cursor.cursor_all
Cursor.cursor_fresh
Cursor.mixin
Cursor.suppose
Parcel.LISTSTORE
Highwater stuff
Audit nibble
self in regexes
$/ and $¢ in subrule argument lists
<after>
token { $param-role-var }

NOT NEEDED FOR #phasers:
Expand All @@ -29,6 +30,7 @@ Change STD to use $<foo> = { 1 }
circumfix:<[ ]>
Cursor.deb
Cursor.lineof
Cursor.suppose
Cursor.O
hash literals
() being Nil
Expand Down

0 comments on commit 8d62cee

Please sign in to comment.