Compare commits

..

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

2 changed files with 14 additions and 14 deletions

View file

@ -17,17 +17,17 @@ channels:
notes: cCdDefFgGaAb notes: cCdDefFgGaAb
sheet: sheet:
aabc. aabc.
'ab°A 'rt°y
+d+d+d--- +d+d+d---
/ff/f\\ /ff/f\\
ab>c<ba ab>c<ba
;this is a comment (or lyrics whatever), ;this is a comment (or lyrics whatever),
C:CC s:df
(3deff) (3deff)
(deff) (deff)
[ffe] [ffe]
{l 1-cos((PI*x)/2),acced} {l 1-cos((PI*x)/2),acced}
abbc!o5cc!v15feed!l4fedd!t60Gdd abbc!o5cc!v15feed!l4fedd!t60hdd
# rest: . # rest: .
# pizz.: '° # pizz.: '°
# volume: +- # volume: +-

View file

@ -45,18 +45,18 @@ enum AtomsSerializeError {
fn nom_err_message(e: nom::Err<nom::error::Error<&str>>) -> String { fn nom_err_message(e: nom::Err<nom::error::Error<&str>>) -> String {
match e { match e {
nom::Err::Incomplete(needed) => format!( nom::Err::Incomplete(needed) => todo!(),
"input is incomplete, needed {} byte(s) more", nom::Err::Error(e) => format!(
match needed { "got error code {code:#?} at character n°{charn} (after \"{before}\")",
nom::Needed::Unknown => "?".to_string(),
nom::Needed::Size(s) => s.to_string(),
}
),
nom::Err::Error(e) | nom::Err::Failure(e) => format!(
"got error code {code:#?} at \"{input}\"",
code = e.code, code = e.code,
input = e.input charn = e.input.len() + 1,
before = &e.input[e.input.len()
- option_env!("SHEET_BACKTRACE")
.and_then(|s| s.parse().ok())
.unwrap_or(10usize)
+ 1..]
), ),
nom::Err::Failure(e) => todo!(),
} }
} }
@ -127,7 +127,7 @@ impl<'de> Deserialize<'de> for Atoms {
let x = all_consuming(terminated( let x = all_consuming(terminated(
many0(preceded(many0(one_of(" \t\r")), flat_atom_parser(&notes))), many0(preceded(many0(one_of(" \t\r")), flat_atom_parser(&notes))),
many0(alt((char('\t'), char(' '), char('\n'), char('\r')))), many0(alt((char('\t'), char(' '), char('\n'), char('\r')))),
))(&sheet) ))(dbg!(&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)