This file contains hidden or 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
module Events; | |
use JSON::Tiny; | |
package EXPORT::DEFAULT { } | |
my @events = @(from-json(slurp("events.json"))); | |
for @events -> (:$name, :@values) { | |
my $type := Metamodel::ClassHOW.new_type(:$name); | |
for @values -> $attr_name { | |
$type.HOW.add_attribute($type, Attribute.new( |
This file contains hidden or 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
module Describe; | |
sub describe(::T) is export { | |
join "\n", gather { | |
take "Type {T.^name}"; | |
take " Attributes:"; | |
for T.^attributes(:local) -> $attr { | |
take " $attr.name() ({ | |
$attr.has_accessor ?? 'public' !! 'private' | |
})"; |
This file contains hidden or 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
for 1..1000 { | |
(0 but Bool::True); | |
1; | |
} |
This file contains hidden or 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/Actions.pm b/src/Perl6/Actions.pm | |
index fd4b9cd..b460a75 100644 | |
--- a/src/Perl6/Actions.pm | |
+++ b/src/Perl6/Actions.pm | |
@@ -1158,9 +1158,9 @@ class Perl6::Actions is HLL::Actions { | |
# Expect variable to have been declared somewhere. | |
# Locate descriptor and thus type. | |
+ $past.scope('lexical_6model'); | |
try { |
This file contains hidden or 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
> my Rat %h{Int}; | |
().hash | |
> %h<foo> = 1.5 | |
Nominal type check failed for parameter '$key'; expected Int but got Str instead | |
> %h{1} = 1.5; %h{2} = 2.5; say %h{1}; say %h{2}; | |
1.5 | |
2.5 | |
> .WHAT.say for %h.keys | |
Int() | |
Int() |
This file contains hidden or 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
class ObjHash { | |
has %!keys handles (keys => 'values'); | |
has %!values handles <values elems>; | |
method at_key(Mu $key) is rw { | |
my $lkey = $key.WHICH; | |
%!values.exists($lkey) | |
?? %!values{$lkey} | |
!! pir::setattribute__0PPsP(my $v, Scalar, '$!whence', | |
-> { | |
%!keys{$lkey} := $key; |
This file contains hidden or 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 MONKEY_TYPING; | |
augment class Code { | |
method outer() { | |
pir::perl6_code_object_from_parrot_sub__PP($!do.get_outer()) | |
} | |
} | |
sub bar() { | |
my $foo := { |
This file contains hidden or 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
my $foo := { | |
my $x := 1; $x = 2; | |
} | |
my $bar := { $foo() } | |
$bar(); |
This file contains hidden or 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
Here's the doc, in text form, before parsing: | |
<test><element1 attrib1="hello" attrib2="world"/><element2 attrib1="goodbye" attrib2="universe">with content</element2><element3 what="is it"><foo/></element3></test> | |
Setting attrib1 to hello | |
Setting attrib2 to world | |
Now, here's the doc, after being parsed into an object. | |
<?xml version="1.0"?><test><element1 attrib1="hello" attrib2="world"/><element2>with content</element2><element3><foo/></element3></test> | |
Now, what happened to the attributes for the element with contents? |
This file contains hidden or 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/PAST/Regex.pir b/src/PAST/Regex.pir | |
index a5ae908..3434834 100644 | |
--- a/src/PAST/Regex.pir | |
+++ b/src/PAST/Regex.pir | |
@@ -251,7 +251,7 @@ at this node. | |
charlist_negate: | |
if subtype == 'zerowidth' goto charlist_negate_0 | |
- unless tail goto charlist_negate_0 | |
+ if tail goto charlist_negate_0 |