From 52922efbe50e2313ae5f7f60fa939253f35d4659 Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Tue, 6 May 2025 19:42:16 -0400 Subject: [PATCH] lib class diagram part 1 --- doc/uml/lib/class.puml | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 doc/uml/lib/class.puml diff --git a/doc/uml/lib/class.puml b/doc/uml/lib/class.puml new file mode 100644 index 0000000..40fa85a --- /dev/null +++ b/doc/uml/lib/class.puml @@ -0,0 +1,78 @@ +@startuml "bliplib class diagram" + +package std { + interface Iterator { + next(&mut self): Self::Item + } + interface From { + from(value: T): Self + } +} + +package parser { + interface Token { + parse<'i, 'n, 's, I>(&Parser<'i, 'n, 's, I>): nom::IResult, Self> + apply(&self, context: Context): Context + } + struct Silence + struct Marker + struct Note { + n: u8 + } + struct VariableChange { + name: char, + change: String + } + struct Loop { + times: usize + inner: Vec> + } + struct Tuplet { + inner: Vec> + } + struct Slope { + each_frame: VariableChange + } + Silence ..|> Token + Marker ..|> Token + Note ..|> Token + VariableChange ..|> Token + Loop ..|> Token + Tuplet ..|> Token + Slope ..|> Token + struct Parser<'i, 'n, 's, I: Input + Clone> { + input: &'i I + notes: &'n [I] + slopes: &'s HashMap + } + 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) + } + Token --> Parser + Parser --> VariableChange + ParserBuilder --> VariableChange +} + +package compiler { + struct Context { + result: Vec + variables: HashMap + ? + } +} + +interface "From" as from_parserbuilder + +from_parserbuilder --> parser.ParserBuilder +from_parserbuilder ..|> std.From +parser.Parser ..|> from_parserbuilder +parser.Parser ..|> std.Iterator: Item = Result, nom::Error>> +parser.Slope --> parser.VariableChange +parser.Token --> compiler.Context + +@enduml \ No newline at end of file