1*ANY for counts since 60 was arbitrary between middleC and 6*0

This commit is contained in:
2026-03-12 15:55:37 -06:00
parent 31faeb3c1b
commit eb1a537ce2
5 changed files with 39 additions and 20 deletions

View File

@@ -18,7 +18,7 @@ fn from_string(s: String) -> String {
}
fn parse(s: String) -> Vec<String> {
let s = s
let s = s
.split("\n")
.filter(|x: &&str| !x // doesnt start with #
.split_whitespace()
@@ -41,15 +41,24 @@ fn parse(s: String) -> Vec<String> {
let lines = s.split("\n").collect::<Vec<_>>();
let mut j = 0;
for i in 0..lines.len() {
while channels.len() <= j {
channels.push("".to_string());
}
match lines[i] {
"" => { j = 0; },
_ => channels[{ let tmp = j; j += 1; tmp }] += &(" ".to_string() + lines[i]),
"" => {
j = 0;
},
_ => {
while channels.len() <= j {
channels.push("".to_string());
}
channels[{ let tmp = j; j += 1; tmp }] += &(" ".to_string() + lines[i]);
},
};
}
channels.iter().map(|x| x.split_whitespace().collect::<Vec<_>>().join(" ")).collect()
channels
.iter()
.map(|x| x.split_whitespace().collect::<Vec<_>>()
.join(" ")
)
.collect()
}
#[cfg(test)]
@@ -72,7 +81,7 @@ mod test {
fn test_two_channels_one_bar() {
assert_eq!(
super::new("src/testdata/two_channels_one_bar.txt")[0],
"2a 2b 2c".to_string()
"2*a 2*b 2*c".to_string()
);
assert_eq!(
super::new("src/testdata/two_channels_one_bar.txt")[1],
@@ -88,7 +97,7 @@ mod test {
);
assert_eq!(
super::new("src/testdata/two_channels_two_bars.txt")[1],
"2a 2b 2c 2d 2e 2f".to_string()
"2*a 2*b 2*c 2*d 2*e 2*f".to_string()
);
}