Compare commits

..

No commits in common. "a06e0a1d02e95959cb885c8cfef158ae736a6a56" and "f690d3d2869d93dec93aea4e17ea61fd0a907d51" have entirely different histories.

2 changed files with 4 additions and 9 deletions

View file

@ -124,11 +124,10 @@ impl<'de> Deserialize<'de> for Atoms {
const FIELDS: &[&str] = &["notes", "sheet"]; const FIELDS: &[&str] = &["notes", "sheet"];
let NotesSheet { notes, sheet } = let NotesSheet { notes, sheet } =
deserializer.deserialize_struct("NotesSheet", FIELDS, NotesSheetVisitor)?; deserializer.deserialize_struct("NotesSheet", FIELDS, NotesSheetVisitor)?;
let maybe_yml_str_space = || many0(one_of(" \t\r"));
let x = all_consuming(terminated( let x = all_consuming(terminated(
many0(preceded(maybe_yml_str_space(), flat_atom_parser(&notes))), many0(preceded(many0(one_of(" \t\r")), flat_atom_parser(&notes))),
maybe_yml_str_space(), many0(alt((char('\t'), char(' '), char('\n'), char('\r')))),
))(dbg!(&sheet)) ))(&sheet)
.map_err(nom_err_message) .map_err(nom_err_message)
.map_err(AtomsSerializeError::Parsing) .map_err(AtomsSerializeError::Parsing)
.map_err(de::Error::custom) .map_err(de::Error::custom)

View file

@ -40,11 +40,7 @@ impl Parse for Modifier {
pub fn flat_atom_parser(notes: &str) -> impl Parser<&str, FlatAtom, nom::error::Error<&str>> { pub fn flat_atom_parser(notes: &str) -> impl Parser<&str, FlatAtom, nom::error::Error<&str>> {
alt(( alt((
map_res( map_res(map_opt(one_of(notes), |c| notes.find(c)), u8::try_from).map(FlatAtom::Note),
map_opt(one_of(notes), |c| notes.find(dbg!(c))),
u8::try_from,
)
.map(FlatAtom::Note),
value(FlatAtom::Rest, char(Atom::REST)), value(FlatAtom::Rest, char(Atom::REST)),
value(FlatAtom::StartHere, char(Atom::START_HERE)), value(FlatAtom::StartHere, char(Atom::START_HERE)),
preceded(char(Atom::MODIFIER), Modifier::parse).map(FlatAtom::Modifier), preceded(char(Atom::MODIFIER), Modifier::parse).map(FlatAtom::Modifier),