Skip to content

Commit

Permalink
Fix :r ~, <![]>, foo:['->']
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 16, 2010
1 parent c7274f4 commit 5a45932
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/Niecza/Actions.pm
Expand Up @@ -437,6 +437,8 @@ sub quantified_atom { my ($cl, $M) = @_; # :: RxOp

if (defined $q->{tilde}) {
my ($closer, $inner) = @{ $q->{tilde} };
$closer = $closer->zyg->[0] if ($closer->isa('RxOp::Cut') &&
$closer->zyg->[0]->isa('RxOp::String'));
if (!$closer->isa('RxOp::String')) {
$M->sorry("Non-literal closers for ~ NYI");
$M->{_ast} = RxOp::None->new();
Expand Down Expand Up @@ -694,8 +696,7 @@ sub decapturize { my ($cl, $M) = @_;
return;
}
if (!$M->{assertion}{_ast}->isa('RxOp::Subrule')) {
$M->sorry("Internal error in assertion:method parse");
return;
return $M->{assertion}{_ast};
}
RxOp::Subrule->new(captures => [],
zyg => $M->{assertion}{_ast}->zyg,
Expand Down Expand Up @@ -1009,6 +1010,9 @@ sub circumfix__S_Paren_Thesis { my ($cl, $M) = @_;

sub circumfix__S_Bra_Ket { my ($cl, $M) = @_;
my @kids = grep { defined } @{ $M->{semilist}{_ast} };
if (! grep { !$_->isa('Op::StringLiteral') } @kids) {
$M->{qpvalue} = "<" . join(" ", map { $_->text } @kids) . ">";
}
$M->{_ast} = Op::CallSub->new(node($M),
invocant => Op::Lexical->new(node($M), name => '&_array_constructor'),
args => [Op::StatementList->new(node($M), children =>
Expand Down
13 changes: 7 additions & 6 deletions v6/STD.pm6
Expand Up @@ -4236,7 +4236,7 @@ grammar Q is STD {
}
}

role qq does b1 does c1 does s1 does a1 does h1 does f1 {
role qq {
token stopper { \" }
# in double quotes, omit backslash on random \W backslash by default
token backslash:misc { {} [ (\W) { $<text> = $0.Str; } | $<x>=(\w) <.sorry("Unrecognized backslash sequence: '\\" ~ $<x>.Str ~ "'")> ] }
Expand Down Expand Up @@ -4332,9 +4332,10 @@ grammar Q is STD {
:closure(:$c), :path(:$p), :exec(:$x), :words(:$w),
:quotewords(:$ww), :heredoc(:$to), :$regex, *%unknown) {
# NIECZA ::foo syntax is broken, no role cronies, no MMD
if $q.defined { self.truly($q, ':q'); self.mixin(q) }
elsif $qq.defined { self.truly($qq, ':qq'); self.mixin(qq) }
elsif $cc.defined { self.truly($cc, ':cc'); self.mixin(cc) }
if $q.defined { self.truly($q, ':q'); self.mixin(STD::Q::q) }
elsif $qq.defined { self.truly($qq, ':qq'); self.mixin(STD::Q::b1).mixin(STD::Q::c1).mixin(STD::Q::s1).mixin(STD::Q::a1).mixin(STD::Q::h1).mixin(STD::Q::f1).mixin(STD::Q::qq) }

elsif $cc.defined { self.truly($cc, ':cc'); self.mixin(STD::Q::cc) }

elsif $b.defined { self.mixin($b ?? STD::Q::b1 !! STD::Q::b0) }
elsif $s.defined { self.mixin($s ?? STD::Q::s1 !! STD::Q::s0) }
Expand Down Expand Up @@ -4505,7 +4506,7 @@ method EXPR ($preclvl?) {
:captures(:left($left), :infix($op), :right($right)),
:suphash({_arity => 'BINARY'}), :method<INFIX>);

self.deb(@termstack[*-1].dump) if $*DEBUG +& DEBUG::EXPR;
self.deb(@termstack[*-1].dump) if $DEBUG::EXPR;
my $ck;
if $ck = $op<O><_reducecheck> {
@termstack[*-1] = $ck(@termstack[*-1]);
Expand All @@ -4515,7 +4516,7 @@ method EXPR ($preclvl?) {

TERM:
loop {
self.deb("In loop, at ", $here.pos) if $& DEBUG::EXPR;
self.deb("In loop, at ", $here.pos) if $DEBUG::EXPR;
my $oldpos = $here.pos;
$here = $here.cursor_fresh();
$*LEFTSIGIL = @opstack[*-1]<O><prec> gt $item_assignment_prec ?? '@' !! ''; # XXX P6
Expand Down
4 changes: 2 additions & 2 deletions v6/TODO
Expand Up @@ -14,7 +14,7 @@ Cursor.mixin
Cursor.O
Cursor.suppose
Cursor.trim_heredoc
Cursor.top_goal
$*GOAL handling XXX
Highwater stuff
EXPR will need a re-write with tests.
$<foo> = 1
Expand All @@ -27,7 +27,7 @@ Parcel.LISTSTORE
self in regexes
$<sym>
temp $*FOO
something with $*HIGHWATER, $*HIGHEXPECT, $*GOAL
try
token { $param-role-var }

DONE:
Expand Down

0 comments on commit 5a45932

Please sign in to comment.