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 head1 :numbered | |
| = :nested(2) | |
| This doesn't work right | |
| # If I de-indent the 2nd line, then it is parsed "correctly" and :nested | |
| # becomes part of the configs. Indented, it's made part of the block content | |
| say $=pod.perl; |
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
| =head1 Foo | |
| =head1 Bar | |
| say $=pod.perl; |
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
| sub checklastval () is rw { | |
| Proxy.new( | |
| FETCH => sub ($self) { #OK not used | |
| 'hello', | |
| }, | |
| STORE => sub ($self, $val) { #OK not used | |
| 'hello'; | |
| } | |
| ); | |
| }; |
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
| 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 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
| #! /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 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
| #! /usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| package Vocab; | |
| use Moose; | |
| my %WORDS; |
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 @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 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 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 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
| grammar G { | |
| rule TOP { ^ <word> ** 2 $ } | |
| rule word { \w+ } | |
| } | |
| say G.parse('take garbage')<word>.map({"«$_»"}).join(', '); |
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
| 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+ } |