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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.