pub trait ParsingTablesTrait<T> {
    // Required methods
    fn initial() -> usize;
    fn match_some(parser: &mut Parser<'_, T, Self>) -> Option<(usize, T)>
       where Self: Sized;
    fn predict(
        parser: &mut Parser<'_, T, Self>,
        index: usize,
        state_index: usize,
        token: usize
    )
       where Self: Sized;
    fn compute_value(state: &mut State<T>);
    fn table_terminal(token_index: usize) -> bool;
    fn table_priority(a: usize, b: usize) -> Option<Ordering>;
    fn table_associativity(rule: usize) -> Option<Associativity>;
    fn to_usize(token: &T) -> usize;

    // Provided method
    fn take_token(token: &mut T) -> T
       where T: Clone + Default { ... }
}
Expand description

The functions defining the grammar to use.

Required Methods§

source

fn initial() -> usize

Give the initial state.

source

fn match_some(parser: &mut Parser<'_, T, Self>) -> Option<(usize, T)>where Self: Sized,

Extract a token.

source

fn predict( parser: &mut Parser<'_, T, Self>, index: usize, state_index: usize, token: usize )where Self: Sized,

for each token->right in grammar, add the rule to self.sets[index]

source

fn compute_value(state: &mut State<T>)

Compute the value of a state. Assumes all dependencies are already been computed.

source

fn table_terminal(token_index: usize) -> bool

Says whether a token is a terminal token.

source

fn table_priority(a: usize, b: usize) -> Option<Ordering>

Compares the priority of two rules.

source

fn table_associativity(rule: usize) -> Option<Associativity>

Check whether we resolve ambiguity and how.

source

fn to_usize(token: &T) -> usize

Bring a token into usize type.

Provided Methods§

source

fn take_token(token: &mut T) -> Twhere T: Clone + Default,

Clone a terminal and otherwise std::mem::take it.

Implementors§