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§

source

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§

source

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).

source

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.

Implementations on Foreign Types§

source§

impl<L> CoreParse<L> for u32
where L: Language,

source§

fn parse<'t>(_scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L> CoreParse<L> for u64
where L: Language,

source§

fn parse<'t>(_scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L> CoreParse<L> for usize
where L: Language,

source§

fn parse<'t>(_scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L, T> CoreParse<L> for Option<T>
where L: Language, T: CoreParse<L>,

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L, T> CoreParse<L> for Arc<T>
where L: Language, T: CoreParse<L>,

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L, T> CoreParse<L> for Vec<T>
where L: Language, T: CoreParse<L>,

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L: Language> CoreParse<L> for ()

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L: Language, A: CoreParse<L>, B: CoreParse<L>> CoreParse<L> for (A, B)

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

source§

impl<L: Language, A: CoreParse<L>, B: CoreParse<L>, C: CoreParse<L>> CoreParse<L> for (A, B, C)

source§

fn parse<'t>(scope: &Scope<L>, text: &'t str) -> ParseResult<'t, Self>

Implementors§

source§

impl<L, T> CoreParse<L> for CoreBinder<L, T>
where L: Language, T: CoreTerm<L>,

Parse a binder: find the names in scope, parse the contents, and then replace names with debruijn indices.

source§

impl<L, T> CoreParse<L> for Set<T>
where L: Language, T: CoreParse<L> + Ord,

source§

impl<L: Language> CoreParse<L> for Binding<L>

Binding grammar is $kind $name, e.g., ty Foo.