Created
May 14, 2012 17:06
-
-
Save moritz/2695100 to your computer and use it in GitHub Desktop.
script to extract number of changelog entries per Rakudo release
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; | |
use v6; | |
grammar ChangeLog { | |
token TOP { | |
^ <entry>+ $ | |
} | |
token entry { | |
<header> | |
<newsitem>* | |
<.terminator> | |
} | |
token header { | |
'New in '<version> \N* \n | |
} | |
token newsitem { | |
^^ '+' \N+ \n | |
[^^ | |
[' ' | \t]+\S\N+\n | |
]* | |
} | |
token terminator { | |
^^ \h* \n | |
| \s*$ | |
} | |
token version { | |
[\d+]+ % <[.-]> | |
} | |
} | |
if ChangeLog.parsefile('docs/ChangeLog') { | |
say normalize-version(.<header><version>), | |
" ", +.<newsitem> for @( $<entry> ); | |
} | |
sub normalize-version($x) { | |
$x.Str.trans('.' => '-') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment