Trait formality_core::parse::CoreParse
source · pub trait CoreParse<L: Language>: Sized + Debug {
// Required method
fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>;
// Provided methods
fn parse_many<'t>(
scope: &Scope<L>,
text: &'t str,
close_char: char
) -> ParseResult<'t, Vec<Self>> { ... }
fn parse_comma<'t>(
scope: &Scope<L>,
text: &'t str,
close_char: char
) -> ParseResult<'t, Vec<Self>> { ... }
}
Expand description
Trait for parsing a Term<L>
as input.
Required Methods§
sourcefn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>
fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>
Parse a single instance of this type, returning an error if no such instance is present.
Provided Methods§
sourcefn parse_many<'t>(
scope: &Scope<L>,
text: &'t str,
close_char: char
) -> ParseResult<'t, Vec<Self>>
fn parse_many<'t>( scope: &Scope<L>, text: &'t str, close_char: char ) -> ParseResult<'t, Vec<Self>>
Parse many instances of self, expecting close_char
to appear after the last instance
(close_char
is not consumed).
sourcefn parse_comma<'t>(
scope: &Scope<L>,
text: &'t str,
close_char: char
) -> ParseResult<'t, Vec<Self>>
fn parse_comma<'t>( scope: &Scope<L>, text: &'t str, close_char: char ) -> ParseResult<'t, Vec<Self>>
Comma separated list with optional trailing comma.
Object Safety§
This trait is not object safe.