-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
96 changed files
with
3,479 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use feature 'signatures'; | ||
|
||
sub normal_signature ($foo) {} | ||
|
||
sub slurpy_signature ($foo, @) {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$_ = "The brown fox jumps over the lazy dog"; | ||
/the (\S+)(?{ $color = $^N }) (\S+)(?{ $animal = $^N })/i; | ||
print "color = $color, animal = $animal\n"; | ||
print $^R."\n"; | ||
print $^R->[1]."\n"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use v5.10; | ||
$_ = <<'HERE'; | ||
Amelia said "I am a camel" | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
( ['"] ) | ||
(?<said>.*?) | ||
( ['"] ) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
$_ = <<'HERE'; | ||
Amelia said "I am a camel" | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
( ['"] ) | ||
(?<said>.*?) | ||
( ['"] ) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
my @matches; | ||
|
||
say "Matched!" if m/ | ||
(?(DEFINE) | ||
(?<QUOTE_MARK> ['"]) | ||
(?<NOT_QUOTE_MARK> [^'"]) | ||
(?<QUOTE> | ||
( | ||
(?<quote>(?"E_MARK)) | ||
(?: | ||
(?&NOT_QUOTE_MARK)++ | ||
(?"E) | ||
)* | ||
\g{quote} | ||
) | ||
(?{ [ @{$^R}, $^N ] }) | ||
) | ||
) | ||
(?"E) (?{ @matches=@{ $^R } }) | ||
/x; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
my @matches; | ||
|
||
say "Matched!" if m/ | ||
(?(DEFINE) | ||
(?<QUOTE_MARK> ['"]) | ||
(?<NOT_QUOTE_MARK> [^'"]) | ||
(?<QUOTE> | ||
( | ||
(?<quote>(?"E_MARK)) | ||
(?: | ||
(?&NOT_QUOTE_MARK)++ | ||
| | ||
(?"E) | ||
)* | ||
\g{quote} | ||
) | ||
(?{ [ @{$^R}, $^N ] }) | ||
) | ||
) | ||
(?"E) (?{ @matches = @{ $^R } }) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use v5.10; | ||
$_ = <<'HERE'; | ||
Amelia said "I am a camel" | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
( ['"] ) | ||
(?<said>.*?) | ||
( \1 ) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use v5.10; | ||
$_ = <<'HERE'; | ||
Amelia said "I am a camel" | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
( ['"] ) | ||
(?<said>.*?) | ||
(?1) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use v5.10; | ||
$_ = <<'HERE'; | ||
Amelia said "I am a camel' | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
( ['"] ) | ||
(?<said>.*?) | ||
(?1) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
He said 'Amelia said "I am a camel"' | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
(?<said> #$1 | ||
(?<quote>['"]) | ||
(?: | ||
[^'"]++ | ||
| | ||
(?<said> (?1) ) | ||
)* | ||
\g{quote} | ||
) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
(?<said> #$1 | ||
(?<quote>['"]) | ||
(?: | ||
[^'"]++ | ||
| | ||
(?R) | ||
)* | ||
\g{quote} | ||
) | ||
(?{say "Inside regex: $+{said}"}) | ||
/x; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
|
||
say "Matched [$+{said}]!" if m/ | ||
(?(DEFINE) | ||
(?<QUOTE> ['"]) | ||
(?<NOT_QUOTE> [^'"]) | ||
) | ||
(?<said> | ||
(?<quote>(?"E)) | ||
(?: | ||
(?&NOT_QUOTE)++ | ||
| | ||
(?R) | ||
)* | ||
\g{quote} | ||
) | ||
(?{ say "Inside regex: $+{said}" }) | ||
/x; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
my @matches; | ||
|
||
say "Matched [$+{said}]!" if m/ | ||
(?(DEFINE) | ||
(?<QUOTE> ['"]) | ||
(?<NOT_QUOTE> [^'"]) | ||
) | ||
(?<said> | ||
(?<quote>(?"E)) | ||
(?: | ||
(?&NOT_QUOTE)++ | ||
| | ||
(?R) | ||
)* | ||
\g{quote} | ||
) | ||
(?{ push @matches, $^N }) | ||
/x; | ||
|
||
say "\n".join '|',@matches; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use v5.18; | ||
$_ = <<'HERE'; | ||
Out "Top 'Middle "Bottom" Middle' Out" | ||
HERE | ||
|
||
my @matches; | ||
|
||
say "Matched!" if m/ | ||
(?(DEFINE) | ||
(?<QUOTE_MARK> ['"]) | ||
(?<NOT_QUOTE_MARK> [^'"]) | ||
(?<QUOTE> | ||
( | ||
(?<quote>(?"E_MARK)) | ||
(?: | ||
(?&NOT_QUOTE_MARK)++ | ||
(?"E) | ||
)* | ||
\g{quote} | ||
) | ||
(?{ push @matches, $^N }) | ||
) | ||
) | ||
(?"E) | ||
/x; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/perl | ||
use Modern::Perl; | ||
|
||
my $i = 1; | ||
while ($i & 8 == 0 || $i & 256 == 0){ | ||
++$i; | ||
} | ||
print $i, "\n"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/usr/bin/env perl | ||
|
||
use Data::Dumper qw(Dumper); | ||
|
||
my $FROM_JSON = qr{ | ||
(?&VALUE) (?{ $_ = $^R->[1] }) | ||
(?(DEFINE) | ||
(?<OBJECT> | ||
(?{ [$^R, {}] }) | ||
\{ | ||
(?: (?&KV) # [[$^R, {}], $k, $v] | ||
(?{ # warn Dumper { obj1 => $^R }; | ||
[$^R->[0][0], {$^R->[1] => $^R->[2]}] }) | ||
(?: , (?&KV) # [[$^R, {...}], $k, $v] | ||
(?{ # warn Dumper { obj2 => $^R }; | ||
[$^R->[0][0], {%{$^R->[0][1]}, $^R->[1] => $^R->[2]}] }) | ||
)* | ||
)? | ||
\} | ||
) | ||
(?<KV> | ||
(?&STRING) # [$^R, "string"] | ||
: (?&VALUE) # [[$^R, "string"], $value] | ||
(?{ # warn Dumper { kv => $^R }; | ||
[$^R->[0][0], $^R->[0][1], $^R->[1]] }) | ||
) | ||
(?<ARRAY> | ||
(?{ [$^R, []] }) | ||
\[ | ||
(?: (?&VALUE) (?{ [$^R->[0][0], [$^R->[1]]] }) | ||
(?: , (?&VALUE) (?{ # warn Dumper { atwo => $^R }; | ||
[$^R->[0][0], [@{$^R->[0][1]}, $^R->[1]]] }) | ||
)* | ||
)? | ||
\] | ||
) | ||
(?<VALUE> | ||
\s* | ||
( | ||
(?&STRING) | ||
| | ||
(?&NUMBER) | ||
| | ||
(?&OBJECT) | ||
| | ||
(?&ARRAY) | ||
| | ||
true (?{ [$^R, 1] }) | ||
| | ||
false (?{ [$^R, 0] }) | ||
| | ||
null (?{ [$^R, undef] }) | ||
) | ||
\s* | ||
) | ||
(?<STRING> | ||
( | ||
" | ||
(?: | ||
[^\\"]+ | ||
| | ||
\\ ["\\/bfnrt] | ||
# | | ||
# \\ u [0-9a-fA-f]{4} | ||
)* | ||
" | ||
) | ||
(?{ [$^R, eval $^N] }) | ||
) | ||
(?<NUMBER> | ||
( | ||
-? | ||
(?: 0 | [1-9]\d* ) | ||
(?: \. \d+ )? | ||
(?: [eE] [-+]? \d+ )? | ||
) | ||
(?{ [$^R, eval $^N] }) | ||
) | ||
) }xms; | ||
|
||
sub from_json { | ||
local $_ = shift; | ||
local $^R; | ||
eval { m{\A$FROM_JSON\z}; } and return $_; | ||
die $@ if $@; | ||
return 'no match'; | ||
} | ||
|
||
while (<>) { | ||
chomp; | ||
print Dumper from_json($_); | ||
} | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
<SPACE> Advance | ||
<BACKSPACE> Go back | ||
|
||
?? Help | ||
QQ Quit Vroom | ||
|
||
RR Run slide as a program | ||
VV vroom vroom | ||
EE Edit file under cursor | ||
OO Open file under cursor (Mac OS X) | ||
|
||
|
||
(Press SPACE to leave Help screen and continue) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
" This .vimrc file was created by Vroom-0.37 | ||
set nocompatible | ||
syntax on | ||
|
||
map <SPACE> :n<CR>:<CR>gg | ||
map <BACKSPACE> :N<CR>:<CR>gg | ||
map R :!vroom -run %<CR> | ||
map RR :!vroom -run %<CR> | ||
map AA :call RunNow()<CR>:<CR> | ||
map VV :!vroom -vroom<CR> | ||
map QQ :q!<CR> | ||
map OO :!open <cWORD><CR><CR> | ||
map EE :e <cWORD><CR> | ||
map !! G:!open <cWORD><CR><CR> | ||
map ?? :e .help<CR> | ||
set laststatus=2 | ||
set statusline=%-20f\ Recursion\ in\ Regex! | ||
|
||
" Overrides from /home/mishin/.vroom/vimrc | ||
|
||
|
||
" Values from slides.vroom config section. (under 'vimrc') | ||
set statusline=%-3f\ \ \ \ \ Recursioni\ in\ Regex\ (or:\ How\ parse\ IBM\ Datastage\ dsx\ file) | ||
map <C-C> 3<C-^><Ctrl-Home> | ||
map <C-O> 2<C-^><Ctrl-Home> | ||
map <C-E> 5<C-^><Ctrl-Home> | ||
map <C-P> 11<C-^><Ctrl-Home> | ||
map MSM ouse Method::Signatures::Modifiers;<Esc> | ||
Oops, something went wrong.