diff --git a/doc/uml/lib/class.puml b/doc/uml/lib/class.puml index c38476b..71743c4 100644 --- a/doc/uml/lib/class.puml +++ b/doc/uml/lib/class.puml @@ -1,9 +1,8 @@ @startuml "bliplib class diagram" +left to right direction + package std { - interface Iterator { - next(&mut self): Self::Item - } interface From { from(value: T): Self } @@ -14,39 +13,38 @@ package nom { } package parser { - struct TokenParser { - phantom: PhantomData - inner: T - } - note right of TokenParser { - where T: for<'i> nom::Parser, Output = Self, Error = nom::Err>> - } + interface TokenParser interface Token { - apply(&self, context: Context): Context + -apply(&self, context: Context): Context } struct Silence { - parser(): TokenParser + -parser(): impl TokenParser } struct Marker { - parser(): impl for<'i> nom::Parser, Output = Self, Error = nom::Err>> + -parser(): impl TokenParser } struct Note { - n: u8 - parser, T: nom::Input>(notes: Vec): impl for<'i> nom::Parser, Output = Self, Error = nom::Err>> + +n: u8 + -parser<'a, I: nom::Input + nom::Compare + Clone>(notes: &'a [I]): impl TokenParser } struct VariableChange { - name: char, - change: String + +name: char, + +change: String + -parser<'a, I, C: Into + Clone>(variables: &'a [C]): impl TokenParser } struct Loop { - times: usize - inner: Vec> + +times: usize + +inner: Vec> + -parser<'n, 's, 'v, I: Input + Clone + nom::Compare, C: Into>(parametters: ParserParametters<'n, 's, 'v, I, C>): impl TokenParser } struct Tuplet { - inner: Vec> + +inner: Vec> + -parser<'n, 's, 'v, I: Input + Clone + nom::Compare, C: Into>(parametters: ParserParametters<'n, 's, 'v, I, C>): impl TokenParser } struct Slope { - each_frame: VariableChange + +inner: Vec> + +each_frame: VariableChange + -parser<'n, 's, 'v, I: Input + Clone + nom::Compare, C: Into>(parametters: ParserParametters<'n, 's, 'v, I, C>): impl TokenParser } Silence ..|> Token Marker ..|> Token @@ -55,18 +53,35 @@ package parser { Loop ..|> Token Tuplet ..|> Token Slope ..|> Token - struct Parser<'i, 'n, 's, I: Input + Clone> { - input: &'i I - notes: &'n [I] - slopes: &'s HashMap + Silence --> TokenParser + Marker --> TokenParser + Note --> TokenParser + VariableChange --> TokenParser + Loop --> TokenParser + Tuplet --> TokenParser + Slope --> TokenParser + struct ParserParametters<'n, 's, 'v, I: Input + Clone + nom::Compare, C: Into> { + +notes: &'n [I] + +slopes: &'s HashMap + +variables: &'v [C] } - struct ParserBuilder<'i, 'n, 's, I: Input + Clone> { - input: Option<&'i I> - notes: Option<&'n [I]> - slopes: Option<&'s HashMap> - input(self, input: &'i I): Self - notes(self, notes: &'n [I]) - slopes(self, slopes: &'s HashMap) + Loop --> ParserParametters + Tuplet --> ParserParametters + Slope --> ParserParametters + struct Parser<'i, 'n, 's, 'v, I: Input + Clone, C: Into> { + -input: &'i I + -parametters: ParserParametters<'n, 's, 'v, I, C> + +parse_all(): Result>, nom::Error>> + } + struct ParserBuilder<'i, 'n, 's, 'v, I: Input + Clone, C: Into> { + -input: Option<&'i I> + -notes: Option<&'n [I]> + -slopes: Option<&'s HashMap> + -variables: Option<&'v [C]> + +input(self, input: &'i I): Self + +notes(self, notes: &'n [I]): Self + +slopes(self, slopes: &'s HashMap): Self + +variables(self, variables: &'v [C]): Self } Token --> Parser Parser --> VariableChange @@ -83,16 +98,15 @@ package compiler { interface "From" as from_parserbuilder interface "nom::Parser>" as nomparser_locatedspan -interface "From" as from_t from_parserbuilder --> parser.ParserBuilder +from_parserbuilder --> parser.ParserParametters from_parserbuilder --|> std.From nomparser_locatedspan --|> nom.Parser -from_t --|> std.From +parser.Parser --> nomparser_locatedspan parser.Parser ..|> from_parserbuilder -parser.TokenParser ..|> nomparser_locatedspan: Output = T, Error = nom::Err -parser.TokenParser ..|> from_t: where T: for<'i> nom::Parser, Output = Self, Error = nom::Err>> -parser.Parser ..|> std.Iterator: Item = Result, nom::Error>> +parser.TokenParser --|> nomparser_locatedspan: Output = Self, Error = nom::Err +nomparser_locatedspan ..|> parser.TokenParser: for any T parser.Slope --> parser.VariableChange parser.Token --> compiler.Context