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
tim@lakshmi:~/g/code/p6/november$ prove -r -eperl6 t 2>&1 | less | |
t/cgi/01-cgi.t ................................ ok | |
t/cgi/03-urlencoded.t ......................... ok | |
t/config.t .................................... ok | |
t/digest/01-digest.t .......................... ok | |
t/dispatcher/01-basics.t ...................... ok | |
t/dispatcher/02-add_rules.t ................... ok | |
Not enough positional parameters passed; got 0 but expected 1 | |
in <anon> at line 7:t/dispatcher/03-whatever.t | |
in 'Dispatcher::Rule::apply' at line 44:/Users/tim/g/code/p6/november/lib/Dispatcher/Rule.pm |
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
grammar Directive::Grammar { | |
rule TOP { ^ [<direction> | <quit> | <help> | <command>] $ } | |
rule direction { ['n' | 's' | 'e' | 'w' | 'out' | 'in'] } | |
rule quit { 'quit' } | |
rule help { ['help' | '?'] } | |
rule command { <verb> <noun_phrase>? } | |
rule verb { \w+ } | |
rule noun_phrase { ['the' | 'a' | 'some']? \w+ } |
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
grammar G { | |
rule TOP { ^ <word> ** 2 $ } | |
rule word { \w+ } | |
} | |
say G.parse('take garbage')<word>.map({"«$_»"}).join(', '); |
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 Grammar::Tracer; | |
grammar IF::Grammar { | |
my @adjectives = <small tiny big huge large shiny dull black white red blue yellow green orange purple>; | |
my @prepositions = <for in under over from to on off at by between below across through into behind beside with towards>, 'away \s+ from', 'next \s+ to', 'out \s+ of'; | |
my @objPronouns = <me you him her it us them>; | |
my @posPronouns = <my your his her its our their>; | |
my @articles = <a an the some several>, 'a few', <one two three four five>, '\d+'; |
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
my @words = <north northeast>; | |
print "unsorted: "; | |
say 'northeast' ~~ / ^ <{join '|', @words }> $ / ?? "parsed $/" !! 'no parse'; | |
print "sorted: "; | |
say 'northeast' ~~ / ^ <{join '|', @words.sort({ $^b.chars cmp $^a.chars }) }> $ / ?? "parsed $/" !! 'no parse'; |
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
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
package Vocab; | |
use Moose; | |
my %WORDS; |
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
#! /usr/bin/env perl6 | |
my %words = (); | |
class Vocab { | |
has Str $.word; | |
has Str @.synonyms = []; | |
submethod BUILD(:$!word, :@!synonyms, *@pos, *%nam) { | |
note "Vocab BUILD(): ", @pos.perl, %nam.perl; |
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
12:40 ~/g/code/p6/rakudo$ ./inst/bin/perl6 !$ | |
./inst/bin/perl6 t/spec/S02-types/version.t | |
1..35 | |
ok 1 - 1.2.1alpha1.0 cmp 1.2.1alpha1 is Same | |
ok 2 - 1.2.1alpha1 cmp 1.2.1.alpha1 is Same | |
ok 3 - 1.2.1.alpha1 cmp 1.2.1alpha.1 is Same | |
ok 4 - 1.2.1alpha.1 cmp 1.2.1.alpha.1 is Same | |
ok 5 - 1.2.1.alpha.1 cmp 1.2-1+alpha/1 is Same | |
ok 6 - 1.2.1_01 cmp 1.2.1_1 is Same | |
ok 7 - 1.2.1_1 cmp 1.2.1._1 is Same |
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
sub checklastval () is rw { | |
Proxy.new( | |
FETCH => sub ($self) { #OK not used | |
'hello', | |
}, | |
STORE => sub ($self, $val) { #OK not used | |
'hello'; | |
} | |
); | |
}; |
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
=head1 Foo | |
=head1 Bar | |
say $=pod.perl; |
OlderNewer