This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
our multi sub infix:<transform>($lhs, Callable $rhs) { | |
$rhs($lhs); | |
} | |
our multi sub infix:<transform>($lhs, $rhs) { | |
$rhs ~~ Whatever ?? $lhs !! $rhs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
# SYNOPSIS | |
# | |
# my $uri = 'http://example.com:8080/path?q#frag'; | |
# | |
# my %components = URI.parse($uri); | |
# | |
# my ($scheme, $auth, $path, $query, $frag) = URI.parse($uri, *); | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
our multi sub infix:<eqv>(Signature $lhs, Signature $rhs) { | |
# maybe $lhs.perl.split(';;')[0] eq ... | |
$lhs.perl eq $rhs.perl && | |
?all($lhs.params>>.constraints Zeqv $rhs.params>>.constraints); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
our multi sub infix:<...>(Numeric $rhs, Numeric $lhs where { $rhs <= $lhs }) { | |
($rhs..$lhs).list; | |
} | |
our multi sub infix:<...>(Str $rhs, Str $lhs where { $rhs le $lhs }) { | |
($rhs..$lhs).list; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Hash.pm b/src/core/Hash.pm | |
index b4e135c..41c59e2 100644 | |
--- a/src/core/Hash.pm | |
+++ b/src/core/Hash.pm | |
@@ -93,6 +93,10 @@ role Hash is EnumMap { | |
return self.pairs; | |
} | |
+ method hash() { | |
+ return self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm | |
index 93b73c0..5f0c8b2 100644 | |
--- a/src/Perl6/Grammar.pm | |
+++ b/src/Perl6/Grammar.pm | |
@@ -860,8 +860,9 @@ rule package_def { | |
$/.CURSOR.panic('This appears to be Perl 5 code. If you intended it to be Perl 6 code, please use a Perl 6 style package block like "package Foo { ... }", or "module Foo; ...".'); | |
} | |
} | |
+ { $*IN_DECL := '' } | |
<statementlist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm | |
index 93b73c0..6a307ef 100644 | |
--- a/src/Perl6/Grammar.pm | |
+++ b/src/Perl6/Grammar.pm | |
@@ -797,7 +797,7 @@ token variable { | |
|| [ | |
| <sigil> <twigil>? <desigilname> | |
| <special_variable> | |
- | <sigil> $<index>=[\d+] [ <?{ $*IN_DECL}> <.panic: "Can't declare a numeric variable">]? | |
+ | <sigil> $<index>=[\d+] [ <?{ $*IN_DECL eq 'variable' }> <.panic: "Can't declare a numeric variable">]? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
module Foo { | |
my %escape; | |
for 0 .. 255 -> $c { | |
%escape{ chr($c) } = sprintf('%%%02X', $c); | |
} | |
our sub bar (Int $value) { | |
return %escape{ chr($value) }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/builtins/Str.pir b/src/builtins/Str.pir | |
index ebee051..4c653cb 100644 | |
--- a/src/builtins/Str.pir | |
+++ b/src/builtins/Str.pir | |
@@ -28,6 +28,14 @@ as the Perl 6 C<Str> class. | |
.tailcall '&infix:<eq>'(topic, self) | |
.end | |
+=item new() | |
+ |