4,5,6));
is($union.WHAT, Set, "set() - union");
my $stringified = $set.stringify;
ok($stringified ~~ rx:perl5/^set\(.*Person.*\)$/, "stringify");
ok($union.equal(set(0..6, $bob)), "set() - equal");
int STDERR "# $jsfile\n";
my $cmd = '../../pugs -I . -e \'use Grammar; if slurp("'.$jsfile.'") ~~ /^<JavaScript::ECMAScript3::Grammar::Spec::Program>$/ {say "ok"}else{say "not ok"}\' 2>&1';
pr
=== eqv !== !~~ !eq !=== !eqv)
);
__PACKAGE__->add_same_precedence_ops( { assoc => 'left'}, qw(eq ~~ =:= !=:=) );
__PACKAGE__->add_
WTemplate
=cut
#use_ok('WTemplate');
skip_rest "unreliable test results"; exit;
if eval('!("a" ~~ /a/)') { skip_rest "skipped tests - rules support appears to be missing"; exit }
my $template;
my
hTest $test ; *@values) returns Lazy {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
multi sub Array::join (@values, Str $delimiter) returns Str
multi sub P
les);
}
sub fill_with($template: %variables?) is export {
my $return = $template;
$return ~~ s:g! <elem> | <block> !{ run_widget($/, %variables) }!;
return $return;
}
## some basic widge
hc --version`;
%attrs<pugs_revision> = %?CONFIG<pugs_revision>;
%attrs<uname> = chomp `uname -a`;
# Obscure hostname for privacy
%attrs<uname> ~~ s/<after \s+> (\S+)/HOSTOBSCURED/;
say %attrs.yaml;
unction $test ; *@values) returns List {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
multi sub join (Str $delimiter ; *@values) returns List {
my $str = ~@v
use v6-alpha;
use Rosetta::Shell;
my Str @cmd_line_args = @*ARGS.grep:{ $_ ~~ m/^<[a-zA-Z:_]>+$/ };
my ($engine_name, @user_lang_prefs) = @cmd_line_args;
$engine_name //= 'Rosetta::Engine::Example'
% 26];
@.table[@lower[$_]] = @lower[($_ + $shift) % 26];
}
}
if $mode ~~ m:P5:i/^de/ {
my @tt;
for @.table.kv { @tt[$^value] = $^key }
@.table = @t
$ret;
}
my @pil2 = =<>;
my $pil2 = @pil2.join('');
# my $pil2 = =<>.slurp; ???
my @b = $pil2 ~~ $tokens;
# say "Tokens: ", @b.join('><');
my $ast = parse( << { >>, 'hash', << } >>, @b );
say $as
Kiss;
=cut
my $RAND = Math::Random::Kiss.new();
ok($RAND, 'new() Math::Random::Kiss');
ok($RAND ~~ Rand, 'Math::Random::Kiss does Rand');
ok($RAND.rand() >= 0, 'rand() returns numbers greater than
l elements
given $x { ... } # $x is now topic for block
when EXPR { ... } # perform $_ ~~ EXPR execute block and break
default { ... } # same as when true { ... }
=head2 Closur
use v6-alpha;
say "1..1";
my $str = 'abcbcaddd';
$str ~~ s:P5:g/bc/oz/;
if $str eq 'aozozaddd' { say "ok 1" } else { say "not ok 1" }
1;
rules, Captures are superclasses of Match. So in the example of:
my $rv = ("x-y-z-moose" ~~ /(.)-(.)-(.)-<animal> :{ return give_birth(|$/) })
C<give_birth()> gets called with 'x', 'y', and
( Str $iso8601 ) returns Duration::Gregorian is export {
# FIXME - missing XXXX
$iso8601 ~~ $iso8601_duration_re_anchored
or die "can't match '$iso8601' to available ISO-8601 duratio
Pipe::open("$PIL $optional_args $tempfilename");
my $pilresult = $pilfh.readline();
$pilresult ~~ s:P5/\r//;
$pilfh.close();
unlink($tempfilename);
return $pilresult;
}
$Test::Pil::Descript
;
#my $pil2 = @pil2.join('');
# slurp stdin - xinming++
my $pil2 = ** $*IN.slurp;
my @b = $pil2 ~~ $tokens;
# say "Tokens: ", @b.join('><');
my $ast = parse( << { >>, 'hash', << } >>, @b );
# say $
ch
Number The numeric value of the matched string (i.e. given
"foo123bar"~~/\d+/, then $/ in numeric context will be 123)
Boolean True if success, false otherwise
=h
mit> and <cut> (see below).
=head2 Modifiers
Used as adverbial modifiers:
"foO bar" ~~ m:s:ignorecase:g/[o | r] ./
and can appear within rules
sub rule { <foo> [:i <ba
use v6-alpha;
#package PIL2;
my $debug_traverse = 0;
# tokenizer
sub tokenize ( $s ) {
$s ~~ m:g:perl5 {(\"(?:\\\\|\\"|.)*?\"|[\:\,\=\{\(\[\}\)\]]|\w+)}; #"
}
# JSON parser - creates an A