Compare commits
No commits in common. "2176f5dd8949232bc44cd5fa09a75394832cc055" and "93067b3010c0c724204e177825c0e9822a94345a" have entirely different histories.
2176f5dd89
...
93067b3010
3 changed files with 11 additions and 23 deletions
|
@ -19,17 +19,17 @@ use nom::{
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self as serde_de, Visitor},
|
de::{self, Visitor},
|
||||||
Deserialize,
|
Deserialize,
|
||||||
};
|
};
|
||||||
use strum::EnumDiscriminants;
|
use strum::EnumDiscriminants;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use utils::{inflate, InflateError};
|
use utils::{inflate, InflateError};
|
||||||
|
|
||||||
mod de;
|
|
||||||
mod lex;
|
mod lex;
|
||||||
|
mod ser;
|
||||||
mod utils;
|
mod utils;
|
||||||
pub use de::*;
|
pub use ser::*;
|
||||||
|
|
||||||
use super::Expression as Instruction;
|
use super::Expression as Instruction;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,11 @@ 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_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::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),
|
||||||
|
|
|
@ -1,23 +1,7 @@
|
||||||
use derive_new::new;
|
use de::Deserializer;
|
||||||
use nom::{
|
use nom::Parser;
|
||||||
character::complete::one_of,
|
|
||||||
combinator::all_consuming,
|
|
||||||
multi::many0,
|
|
||||||
sequence::{preceded, terminated},
|
|
||||||
Parser,
|
|
||||||
};
|
|
||||||
use serde::{
|
|
||||||
de::{self, Deserializer, Visitor},
|
|
||||||
Deserialize,
|
|
||||||
};
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
use crate::bng::score::lex::lexer::flat_atom_parser;
|
use super::*;
|
||||||
|
|
||||||
use super::{
|
|
||||||
utils::{inflate, InflateError},
|
|
||||||
Atoms, FlatAtom,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
enum AtomsSerializeError {
|
enum AtomsSerializeError {
|
Loading…
Add table
Add a link
Reference in a new issue