Quick actions

cmd+k|ctrl+k

Navigation

Languages

Talk grammar testing

Snippet info

Language

Raku

Visibility

public

Author

theangryepicbanana

Created

2018-08-31T15:51:39Z

Updated

2018-08-31T18:41:24Z

my $file = slurp "data.sm";

$file ~~ s:g/^^\s*end$$/\}/;

if ($file ~~ m/^^\s*doing\s(<[\w\-]>+)\s(\N+)$$/) -> *$m is copy {
    $m = $m.list>>.Str;
    my $names = gather for $m[1].split(", ") {take .split: ": "};
    say $names;
    say "($($names.map(':$' ~ *[0]).join(', '))) " ~
    "\{my ($($names.map('$' ~ *[1]).join(', '))) = $($names.map('$' ~ *[0]).join(', '));\}";
}


sub test(:$from) {my \a = $from; say a}



say $file;

test from => 1;
INFO