Skip to content

Instantly share code, notes, and snippets.

@moritz
Created May 14, 2012 17:06
Show Gist options
  • Save moritz/2695100 to your computer and use it in GitHub Desktop.
Save moritz/2695100 to your computer and use it in GitHub Desktop.
script to extract number of changelog entries per Rakudo release
#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