er indicates language pref as command line argument
my Str @user_lang_prefs = @*ARGS.grep:{ $_ ~~ m/^<[a-zA-Z]>+$/ };
@user_lang_prefs = 'Eng'
if @user_lang_prefs == 0;
my Locale:
my Automata::Cellular $ca .= new(:@state, :$rule, :$steps, :$display_width);
is($ca ~~ ::Automata::Cellular, Bool::True, '$ca object instantiated');
is($ca.stage, 1,
uoted string
\, | \= | \{ | \( | \[ | \} | \) | \] | \w+
)
};
my @b = $pil2 ~~ $tokens;
my $tabs = 1;
my $tab = ' ';
for @b {
if $_ eq ',' {
print $_, "\n", $tab
er indicates language pref as command line argument
my Str @user_lang_prefs = @*ARGS.grep:{ $_ ~~ m/^<[a-zA-Z]>+$/ };
@user_lang_prefs = 'Eng'
if @user_lang_prefs == 0;
my Locale:
Pipe::open("$PIL $optional_args $tempfilename");
my $pilresult = $pilfh.readline();
$pilresult ~~ s:P5/\r//;
$pilfh.close();
unlink($tempfilename);
return $pilresult;
}
$Test::Pil::Descript
use v6-alpha;
#package PIL2;
my $debug_traverse = 0;
# tokenizer
sub tokenize ( $s ) {
$s ~~ m:g:perl5 {(\"(?:\\\\|\\"|.)*?\"|[\:\,\=\{\(\[\}\)\]]|\w+)}; #"
}
# JSON parser - creates an A
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
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;
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
$var_name, $var_value {
my Str $var_value_as_str = $var_value // $EMPTY_STR;
$text ~~ s:g/\<$var_name\>/$var_value_as_str/;
}
return $text;
}
################################
{ }
method parse (Str $str is copy) {
my $request_line;
if ($str ~~ s/^(.*)\n//) {
$request_line = $0;
} else {
$request_line = $str;
$str = "";
}
my $self = self.SUPER::parse($str);
given ($self) {
my ($method, $uri, $protocol) = $request_line.split(' ');
.meth
"This should never happen"}
default {
my @index = split('',$didget);
@index = grep {$_ ~~ /^<[A..Za..z0..9+\/=]>+$/},@index;
[~] map {chr ($_)}, decode(@index)}
}
}
# 1716151
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
;
#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 $
er .= chomp;
},
string => -> ($str) { $buffer ~= $str }
);
my $file = $?FILE;
$file ~~ s:P5/basic.t/sample.kwid/;
lives_ok {
parse($file, %events);
}, '... we parsed the sample fil
ep (MatchTest $test ; *@values --> Lazy ) {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
# copied from S29draft.pod 8651.
multi List::join (Str $delimiter ; *@values
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
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
my $src = "";
while $_ = =<> {$src ~= $_;}
my $m = $src ~~ rx/oo/;
say "(mapcar 'delete-overlay (overlays-in (point-min) (point-max)))";
say "(overlay-put (make-overlay {$m.from +1} {$m.to +1} nil
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;