lib class diagram part 1
This commit is contained in:
parent
cc1038ab89
commit
52922efbe5
1 changed files with 78 additions and 0 deletions
78
doc/uml/lib/class.puml
Normal file
78
doc/uml/lib/class.puml
Normal file
|
@ -0,0 +1,78 @@
|
|||
@startuml "bliplib class diagram"
|
||||
|
||||
package std {
|
||||
interface Iterator<type Item> {
|
||||
next(&mut self): Self::Item
|
||||
}
|
||||
interface From<T> {
|
||||
from(value: T): Self
|
||||
}
|
||||
}
|
||||
|
||||
package parser {
|
||||
interface Token {
|
||||
parse<'i, 'n, 's, I>(&Parser<'i, 'n, 's, I>): nom::IResult<nom_locate::LocatedSpan<&'i I>, 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<Box<dyn Token>>
|
||||
}
|
||||
struct Tuplet {
|
||||
inner: Vec<Box<dyn Token>>
|
||||
}
|
||||
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<I, VariableChange>
|
||||
}
|
||||
struct ParserBuilder<'i, 'n, 's, I: Input + Clone> {
|
||||
input: Option<&'i I>
|
||||
notes: Option<&'n [I]>
|
||||
slopes: Option<&'s HashMap<I, String>>
|
||||
input(self, input: &'i I): Self
|
||||
notes(self, notes: &'n [I])
|
||||
slopes(self, slopes: &'s HashMap<I, VariableChange>)
|
||||
}
|
||||
Token --> Parser
|
||||
Parser --> VariableChange
|
||||
ParserBuilder --> VariableChange
|
||||
}
|
||||
|
||||
package compiler {
|
||||
struct Context {
|
||||
result: Vec<f64>
|
||||
variables: HashMap<char, f64>
|
||||
?
|
||||
}
|
||||
}
|
||||
|
||||
interface "From<ParserBuilder>" as from_parserbuilder
|
||||
|
||||
from_parserbuilder --> parser.ParserBuilder
|
||||
from_parserbuilder ..|> std.From
|
||||
parser.Parser ..|> from_parserbuilder
|
||||
parser.Parser ..|> std.Iterator: Item = Result<Box<dyn Token>, nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
parser.Slope --> parser.VariableChange
|
||||
parser.Token --> compiler.Context
|
||||
|
||||
@enduml
|
Loading…
Add table
Add a link
Reference in a new issue