diff --git a/src/bng/score.rs b/src/bng/score.rs index 4aadc1e..0595765 100644 --- a/src/bng/score.rs +++ b/src/bng/score.rs @@ -19,17 +19,17 @@ use nom::{ #[cfg(debug_assertions)] use serde::Serialize; use serde::{ - de::{self as serde_de, Visitor}, + de::{self, Visitor}, Deserialize, }; use strum::EnumDiscriminants; use thiserror::Error; use utils::{inflate, InflateError}; -mod de; mod lex; +mod ser; mod utils; -pub use de::*; +pub use ser::*; use super::Expression as Instruction; 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), diff --git a/src/bng/score/de.rs b/src/bng/score/ser.rs similarity index 91% rename from src/bng/score/de.rs rename to src/bng/score/ser.rs index 1745d76..ef8b300 100644 --- a/src/bng/score/de.rs +++ b/src/bng/score/ser.rs @@ -1,23 +1,7 @@ -use derive_new::new; -use nom::{ - character::complete::one_of, - combinator::all_consuming, - multi::many0, - sequence::{preceded, terminated}, - Parser, -}; -use serde::{ - de::{self, Deserializer, Visitor}, - Deserialize, -}; -use thiserror::Error; +use de::Deserializer; +use nom::Parser; -use crate::bng::score::lex::lexer::flat_atom_parser; - -use super::{ - utils::{inflate, InflateError}, - Atoms, FlatAtom, -}; +use super::*; #[derive(Debug, Error)] enum AtomsSerializeError {