Compare commits
2 commits
93067b3010
...
2176f5dd89
Author | SHA1 | Date | |
---|---|---|---|
2176f5dd89 | |||
9b2ad49f3b |
3 changed files with 23 additions and 11 deletions
|
@ -19,17 +19,17 @@ use nom::{
|
|||
#[cfg(debug_assertions)]
|
||||
use serde::Serialize;
|
||||
use serde::{
|
||||
de::{self, Visitor},
|
||||
de::{self as serde_de, Visitor},
|
||||
Deserialize,
|
||||
};
|
||||
use strum::EnumDiscriminants;
|
||||
use thiserror::Error;
|
||||
use utils::{inflate, InflateError};
|
||||
|
||||
mod de;
|
||||
mod lex;
|
||||
mod ser;
|
||||
mod utils;
|
||||
pub use ser::*;
|
||||
pub use de::*;
|
||||
|
||||
use super::Expression as Instruction;
|
||||
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
use de::Deserializer;
|
||||
use nom::Parser;
|
||||
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 super::*;
|
||||
use crate::bng::score::lex::lexer::flat_atom_parser;
|
||||
|
||||
use super::{
|
||||
utils::{inflate, InflateError},
|
||||
Atoms, FlatAtom,
|
||||
};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum AtomsSerializeError {
|
|
@ -40,11 +40,7 @@ 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(dbg!(c))),
|
||||
u8::try_from,
|
||||
)
|
||||
.map(FlatAtom::Note),
|
||||
map_res(map_opt(one_of(notes), |c| notes.find(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