Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement :42nd form of colonpairs.
  • Loading branch information
jnthn committed Jun 2, 2014
1 parent 394a74d commit 32e8b4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -1635,6 +1635,9 @@ class Perl6::Actions is HLL::Actions does STDActions {
if $<var> {
make make_pair($*key, $<var>.ast);
}
elsif $<num> {
make make_pair($*key, $*W.add_numeric_constant($/, 'Int', $*value));
}
elsif $*value ~~ NQPMatch {
my $val_ast := $*value.ast;
if $val_ast.isa(QAST::Stmts) && +@($val_ast) == 1 {
Expand Down
2 changes: 2 additions & 0 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1660,6 +1660,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
[ <[ \[ \( \< \{ ]> {
$/.CURSOR.typed_panic('X::Syntax::NegatedPair', key => ~$<identifier>) } ]?
{ $*key := $<identifier>.Str; $*value := 0; }
| $<num> = [\d+] <identifier> [ <?before <[ \[ \( \< \{ ]>> {} <.sorry("Extra argument not allowed; pair already has argument of " ~ $<num>.Str)> <.circumfix> ]?
{ $*key := $<identifier>.Str; $*value := +$<num>; }
| <identifier>
{ $*key := $<identifier>.Str; }
[
Expand Down

0 comments on commit 32e8b4a

Please sign in to comment.