wrong way: proxy struct for opaque type alias
This commit is contained in:
parent
8caeacc679
commit
f09e00cdba
1 changed files with 25 additions and 4 deletions
|
@ -9,15 +9,30 @@ package std {
|
|||
}
|
||||
}
|
||||
|
||||
package nom {
|
||||
interface Parser<I>
|
||||
}
|
||||
|
||||
package parser {
|
||||
struct TokenParser<I, T> {
|
||||
phantom: PhantomData<I>
|
||||
inner: T
|
||||
}
|
||||
note right of TokenParser {
|
||||
where T: for<'i> nom::Parser<nom_locate::LocatedSpan<&'i I>, Output = Self, Error = nom::Err<nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
}
|
||||
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 Silence {
|
||||
parser<I>(): TokenParser<I, ??>
|
||||
}
|
||||
struct Marker {
|
||||
parser<I>(): impl for<'i> nom::Parser<nom_locate::LocatedSpan<&'i I>, Output = Self, Error = nom::Err<nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
}
|
||||
struct Note {
|
||||
n: u8
|
||||
parser<I: nom::Input + nom::Compare<T>, T: nom::Input>(notes: Vec<T>): impl for<'i> nom::Parser<nom_locate::LocatedSpan<&'i I>, Output = Self, Error = nom::Err<nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
}
|
||||
struct VariableChange {
|
||||
name: char,
|
||||
|
@ -67,10 +82,16 @@ package compiler {
|
|||
}
|
||||
|
||||
interface "From<ParserBuilder>" as from_parserbuilder
|
||||
interface "nom::Parser<nom_locate::LocatedSpan<&'i I>>" as nomparser_locatedspan
|
||||
interface "From<T>" 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<nom::Error<nom_locate::LocatedSpan<&'i I>
|
||||
parser.TokenParser ..|> from_t: where T: for<'i> nom::Parser<nom_locate::LocatedSpan<&'i I>, Output = Self, Error = nom::Err<nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
parser.Parser ..|> std.Iterator: Item = Result<Box<dyn Token>, nom::Error<nom_locate::LocatedSpan<&'i I>>>
|
||||
parser.Slope --> parser.VariableChange
|
||||
parser.Token --> compiler.Context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue