Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'nom' into md-nqp
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Mar 13, 2013
2 parents 371433d + cee2f91 commit b57c8fa
Show file tree
Hide file tree
Showing 12 changed files with 353 additions and 78 deletions.
20 changes: 20 additions & 0 deletions docs/ChangeLog
@@ -1,3 +1,23 @@
New in 2013.03
+ Type names now gist as (Any) rather than Any()
+ Warn when pure expressions are used in sink context
+ Cool.substr(...) now correctly accepts whatever-star closures
+ Fix character class subtraction bugs
+ Correctly detect undeclared variables in regex assertions
+ :i now respected in character classes
+ Improved output of Rat.perl
+ Implemented shellwords postcircumfix (%h<< $x 'foo bar' >>)
+ User-defined circumfixes now parse a semilist rather than just an expression
and handle whitespace correctly
+ Forbid null operators
+ Warn about leading 0 not indicating octal in Perl 6
+ Fix some automatic end of statement on "}" parse bugs
+ Better error message on for(...) {} being interpreted as a function call
+ Array interpolations now properly do LTM
+ Respect :i in constructs like /:i <$var>/
+ Autothread "none" and "all" junctions before "any" and "one"
+ Helpful error if you write "else if" instead of "elsif"

New in 2013.02
+ "Did you mean ..." suggestions for symbol-not-found errors
+ Compile-time optimization of some cases of junctions in boolean context
Expand Down
36 changes: 34 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -211,8 +211,13 @@ class Perl6::Actions is HLL::Actions does STDActions {
if $<colonpair>[0]<identifier> {
$name := $name ~ ~$<colonpair>[0]<identifier>;
}
if $<colonpair>[0]<circumfix><nibble> -> $op_name {
$name := $name ~ '<' ~ $*W.colonpair_nibble_to_str($/, $op_name) ~ '>';
if $<colonpair>[0]<coloncircumfix> -> $cf {
if $cf<circumfix> -> $op_name {
$name := $name ~ '<' ~ $*W.colonpair_nibble_to_str($/, $op_name<nibble>) ~ '>';
}
else {
$name := $name ~ '<>';
}
}
make $name;
}
Expand Down Expand Up @@ -1184,6 +1189,12 @@ class Perl6::Actions is HLL::Actions does STDActions {
method fatarrow($/) {
make make_pair($<key>.Str, $<val>.ast);
}

method coloncircumfix($/) {
make $<circumfix>
?? $<circumfix>.ast
!! QAST::Var.new( :name('Nil'), :scope('lexical') );
}

method colonpair($/) {
if $*key {
Expand Down Expand Up @@ -2608,6 +2619,9 @@ class Perl6::Actions is HLL::Actions does STDActions {
$coderef := regex_coderef($/, $*DECLARAND, $<nibble>.ast, $*SCOPE, $name, %sig_info, $*CURPAD, $<trait>);
}

# Install &?ROUTINE.
$*W.install_lexical_symbol($*CURPAD, '&?ROUTINE', $*DECLARAND);

# Return closure if not in sink context.
my $closure := block_closure($coderef);
$closure<sink_past> := QAST::Op.new( :op('null') );
Expand Down Expand Up @@ -4729,6 +4743,24 @@ class Perl6::Actions is HLL::Actions does STDActions {
make $past;
}

method postcircumfix:sym«<< >>»($/) {
my $past := QAST::Op.new( :name('postcircumfix:<{ }>'), :op('callmethod'), :node($/) );
my $nib := $<nibble>.ast;
$past.push($nib)
unless nqp::istype($nib, QAST::Stmts) && nqp::istype($nib[0], QAST::Op) &&
$nib[0].name eq '&infix:<,>' && +@($nib[0]) == 0;
make $past;
}

method postcircumfix:sym<« »>($/) {
my $past := QAST::Op.new( :name('postcircumfix:<{ }>'), :op('callmethod'), :node($/) );
my $nib := $<nibble>.ast;
$past.push($nib)
unless nqp::istype($nib, QAST::Stmts) && nqp::istype($nib[0], QAST::Op) &&
$nib[0].name eq '&infix:<,>' && +@($nib[0]) == 0;
make $past;
}

method postcircumfix:sym<( )>($/) {
make $<arglist>.ast;
}
Expand Down

0 comments on commit b57c8fa

Please sign in to comment.