Skip to content

Commit

Permalink
Implement abbreviated pair syntax :$foo
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 23, 2010
1 parent 52b4159 commit 87a15a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Niecza/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,20 @@ sub colonpair { my ($cl, $M) = @_;
}
my $tv = ref($M->{v}) ? $M->{v}{_ast} :
Op::Lexical->new(name => $M->{v} ? 'True' : 'False');

if (!defined $tv) {
if (substr($M->{v}->Str,1,1) eq '<') {
$tv = Op::CallMethod->new(name => 'at-key',
receiver => Op::ContextVar->new(name => '$*/'),
args => [Op::StringLiteral->new(text => $M->{k})]);
} else {
$tv = $cl->do_variable_reference($M,
{ sigil => $M->{v}{sigil}->Str,
twigil => ($M->{v}{twigil}[0] ? $M->{v}{twigil}[0]->Str : ''),
name => $M->{k} });
}
}

$M->{_ast} = { ext => $n, term => Op::SimplePair->new(
key => $M->{k}, value => $tv) };
}
Expand Down
1 change: 1 addition & 0 deletions src/RxOp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ use CgOp;
extends 'RxOp';

sub uncut { $_[0]->zyg->[0] }
sub tocclist { $_[0]->uncut->tocclist }

sub code {
my ($self, $body) = @_;
Expand Down
2 changes: 1 addition & 1 deletion v6/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Cursor.cursor_fresh
Cursor.mixin
Parcel.LISTSTORE
Highwater stuff
<after>

NOT NEEDED FOR #phasers:
Cursor.canonicalize_name
Expand All @@ -22,6 +21,7 @@ DONE:
~
<?{ }>
$/ and $¢ in subrule argument lists
<after>
Change STD to use $<foo> = { 1 }
circumfix:<[ ]>
Cursor.deb
Expand Down

0 comments on commit 87a15a5

Please sign in to comment.