diff --git a/src/bng/score.rs b/src/bng/score.rs index aac798e..d283760 100644 --- a/src/bng/score.rs +++ b/src/bng/score.rs @@ -124,9 +124,10 @@ impl<'de> Deserialize<'de> for Atoms { const FIELDS: &[&str] = &["notes", "sheet"]; let NotesSheet { notes, sheet } = deserializer.deserialize_struct("NotesSheet", FIELDS, NotesSheetVisitor)?; + let maybe_yml_str_space = || many0(one_of(" \t\r")); let x = all_consuming(terminated( - many0(preceded(many0(one_of(" \t\r")), flat_atom_parser(¬es))), - many0(one_of(" \t\r")), + many0(preceded(maybe_yml_str_space(), flat_atom_parser(¬es))), + maybe_yml_str_space(), ))(dbg!(&sheet)) .map_err(nom_err_message) .map_err(AtomsSerializeError::Parsing) diff --git a/src/bng/score/lex/lexer.rs b/src/bng/score/lex/lexer.rs index 762100e..1933b43 100644 --- a/src/bng/score/lex/lexer.rs +++ b/src/bng/score/lex/lexer.rs @@ -40,7 +40,11 @@ impl Parse for Modifier { pub fn flat_atom_parser(notes: &str) -> impl Parser<&str, FlatAtom, nom::error::Error<&str>> { alt(( - map_res(map_opt(one_of(notes), |c| notes.find(c)), u8::try_from).map(FlatAtom::Note), + map_res( + map_opt(one_of(notes), |c| notes.find(dbg!(c))), + u8::try_from, + ) + .map(FlatAtom::Note), value(FlatAtom::Rest, char(Atom::REST)), value(FlatAtom::StartHere, char(Atom::START_HERE)), preceded(char(Atom::MODIFIER), Modifier::parse).map(FlatAtom::Modifier),