Browse files

Clean up.

  • Loading branch information...
1 parent eab8c21 commit d6fa9230cb42cb1aa9919732bc2d879afbc5d65e @colomon committed May 2, 2012
Showing with 9 additions and 5 deletions.
  1. +2 −3 bin/abc2ly.pl
  2. +2 −2 lib/ABC/Duration.pm
  3. +5 −0 lib/ABC/Header.pm
View
5 bin/abc2ly.pl
@@ -3,7 +3,7 @@
use ABC::Tune;
use ABC::Grammar;
use ABC::Actions;
-use ABC::Duration;
+use ABC::Duration; #OK
use ABC::Note;
use ABC::LongRest;
@@ -189,7 +189,6 @@ (ABC::Header $header)
}
method SectionToLilypond(@elements) {
- my $chords = "";
my $notes = "";
my $lilypond = "";
my $duration = 0;
@@ -278,7 +277,6 @@ (ABC::Header $header)
}
when "chord_or_text" {
for @($element.value) -> $chord_or_text {
- $*ERR.say: :$chord_or_text.perl;
if $chord_or_text ~~ ABC::Chord {
$suffix ~= '^"' ~ $chord_or_text ~ '"';
} else {
@@ -390,6 +388,7 @@ (ABC::Header $header)
say "#(set-default-paper-size \"{$paper-size}\")";
for @( $match.ast ) -> $tune {
+ $*ERR.say: "Working on { $tune.header.get-first-value("T") // $tune.header.get-first-value("X") }";
say "\\score \{";
# say ~$tune.music;
View
4 lib/ABC/Duration.pm
@@ -3,11 +3,11 @@ use v6;
role ABC::Duration {
has $.ticks;
- multi sub duration-from-parse($top) is export {
+ multi sub duration-from-parse($top) is export { #OK
ABC::Duration.new(:ticks(($top ?? +~$top !! 1).Int));
}
- multi sub duration-from-parse($top, $bottom) is export {
+ multi sub duration-from-parse($top, $bottom) is export { #OK
# $*ERR.say: :$top.perl;
# $*ERR.say: :$bottom.perl;
ABC::Duration.new(:ticks(($top ?? +~$top !! 1).Int / ($bottom ?? +~$bottom !! 2).Int));
View
5 lib/ABC/Header.pm
@@ -10,6 +10,11 @@ class ABC::Header {
our method get($name) {
self.lines.grep({ .key eq $name });
}
+
+ our method get-first-value($name) {
+ my $pair = self.lines.first({ .key eq $name });
+ $pair ?? $pair.value !! Any;
+ }
our method is-valid() {
self.lines.elems > 1

0 comments on commit d6fa923

Please sign in to comment.