From f09e00cdba1e80007e11c86dce30a99678adee6c Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Wed, 7 May 2025 14:28:27 -0400 Subject: [PATCH] wrong way: proxy struct for opaque type alias --- doc/uml/lib/class.puml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/uml/lib/class.puml b/doc/uml/lib/class.puml index 40fa85a..c38476b 100644 --- a/doc/uml/lib/class.puml +++ b/doc/uml/lib/class.puml @@ -9,15 +9,30 @@ package std { } } +package nom { + interface Parser +} + package parser { + struct TokenParser { + phantom: PhantomData + inner: T + } + note right of TokenParser { + where T: for<'i> nom::Parser, Output = Self, Error = nom::Err>> + } 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 Silence { + parser(): TokenParser + } + struct Marker { + parser(): impl for<'i> nom::Parser, Output = Self, Error = nom::Err>> + } struct Note { n: u8 + parser, T: nom::Input>(notes: Vec): impl for<'i> nom::Parser, Output = Self, Error = nom::Err>> } struct VariableChange { name: char, @@ -67,10 +82,16 @@ package compiler { } interface "From" as from_parserbuilder +interface "nom::Parser>" as nomparser_locatedspan +interface "From" as from_t from_parserbuilder --> parser.ParserBuilder -from_parserbuilder ..|> std.From +from_parserbuilder --|> std.From +nomparser_locatedspan --|> nom.Parser +from_t --|> std.From 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.Slope --> parser.VariableChange parser.Token --> compiler.Context