Compare commits
2 commits
f690d3d286
...
a06e0a1d02
Author | SHA1 | Date | |
---|---|---|---|
a06e0a1d02 | |||
20093d7683 |
2 changed files with 9 additions and 4 deletions
|
@ -124,10 +124,11 @@ 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(alt((char('\t'), char(' '), char('\n'), char('\r')))),
|
||||
))(&sheet)
|
||||
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)
|
||||
.map_err(de::Error::custom)
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue