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 Test { | |
rule TOP { ^ <content>* $ } | |
rule block { '(' ~ ')' <content>* } | |
rule content { <-[()]>+ || <block> } | |
} | |
class TestActs { | |
method TOP($/) { | |
$/.make: $<content>».made.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 Inline::C; | |
use C::Parser::Grammar; | |
use C::Parser::Actions; | |
use Grammar::Mixin; | |
my role Inline::Grammar { | |
method INTERPOLATE(|c) {Grammar.'INTERPOLATE'(self,|c);} | |
token routine_declarator:sym<inline> { | |
:my $*InlineC := True; | |
:my $*LINE_NO := HLL::Compiler.lineof(self.orig(), self.from(), :cache(1)); |
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
role Grid::Mazable { | |
#| Get list of nodes | |
method nodes { ... } | |
#|[ | |
A leaf node represents a fringe of the grid that we're allowed to | |
recurse off of when we build mazes. Not all fringes are leaves, due to | |
the fact that mazes can include numerous dead-ends. When a fringe is | |
not a leaf, it's a dead-end. | |
] |
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
class Lispy { | |
has $.global-env; | |
class Env is Associative { # XXX EnumMap | |
has %.hash handles *; | |
has $.outer; | |
method new (*@hash, :$outer) { | |
bless self: :$outer, :@hash; | |
} | |
method get ($k) is rw { self.hash{$k} // self.outer.get($k) } | |
} |
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 Math::Symbolic; | |
# PV=nRT | |
my $R = .08206; | |
my %h = | |
:P(EVAL prompt "P="), | |
:V(EVAL prompt "V="), | |
:N(EVAL prompt "N="), | |
:T(EVAL prompt "T="); | |
my ($undef, $err) = %h.keys.grep({ %h{$_} eq "" }); |
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 ($f,&t,&r,&c)=lines.comb(/<-[{}]>+/).SetHash,&substr,&return,&chars;while $f>1 | |
{@$f.sort(-*.&c).combinations(2).map({sub | |
(\a,\b){r \(a,b,:m(a):v(c b))if a.index(b);for b.&c...1 | |
->\v{->\x,\y{r \(a,b,:m(x~t y,v):v(v))if t(x,*-v)eq t y,0,v}(|$_)for | |
[a,b],[b,a]}}(|$_)}).sort(-*.<v>).uniq(:as{any @$_}:with(&[eq])).map:{$f{@$_}»--;$f{.<m>}++}} | |
say @$f |
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
S02-bits.pod | |
1263-The final element of an array is subscripted as C<@a[*-1]>, | |
1264-which means that when the subscripting operation discovers a C<Code:($)> | |
1265-object for a subscript, it calls it and supplies an argument indicating | |
1266-the number of elements in (that dimension of) the array. See S09. | |
1267- | |
1268:=head3 The C<HyperWhatever> Type | |
1269- | |
1270:A variant of C<*> is the C<**> term, which is of type C<HyperWhatever>. | |
1271-It is generally understood to be a multidimension form of C<*> when |
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
# What about encoding back? | |
# grammar Image::GIF::Grammar { | |
class Image::GIF::Decoder is Decoder { | |
token TOP { | |
:my $*CT-valid; # set in lexical <packed> | |
:my $*CT-size; # also set in <packed> | |
<header> | |
<screen> | |
<color-table>? | |
<labeled>* |
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 Test; | |
use Grammar::Precedence; | |
grammar Arithmetic does Grammar::Precedence { | |
token TOP { <EXPR> } | |
# self.push-prec($str) makes $str a new | |
# precedence level and the loosest level. | |
# self.unshift-prec($str) would therefor | |
# make $str a new precedence level and |
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
diff --git a/lib/Pod/To/HTML.pm b/lib/Pod/To/HTML.pm | |
index 797ea2d..9564d77 100644 | |
--- a/lib/Pod/To/HTML.pm | |
+++ b/lib/Pod/To/HTML.pm | |
@@ -248,7 +248,7 @@ multi sub node2html(Pod::Block::Named $node) returns Str { | |
return qq{<div class="nested">\n} ~ node2html($node.content) ~ qq{\n</div>\n}; | |
} | |
when 'output' { return "<pre>\n" ~ node2inline($node.content) ~ "</pre>\n"; } | |
- when 'pod' { return node2html($node.content); } | |
+ when 'pod' { return qq[<span class="{$node.config<class>}">\n{node2html($node.content)}</span>\n] } |
NewerOlder