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§
Sourcefn match_some(parser: &mut Parser<'_, T, Self>) -> Option<(usize, T)>where
Self: Sized,
fn match_some(parser: &mut Parser<'_, T, Self>) -> Option<(usize, T)>where
Self: Sized,
Extract a token.
Sourcefn predict(
parser: &mut Parser<'_, T, Self>,
index: usize,
state_index: usize,
token: usize,
)where
Self: Sized,
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]
Sourcefn compute_value(state: &mut State<T>)
fn compute_value(state: &mut State<T>)
Compute the value of a state. Assumes all dependencies are already been computed.
Sourcefn table_terminal(token_index: usize) -> bool
fn table_terminal(token_index: usize) -> bool
Says whether a token is a terminal token.
Sourcefn table_associativity(rule: usize) -> Option<Associativity>
fn table_associativity(rule: usize) -> Option<Associativity>
Check whether we resolve ambiguity and how.
Provided Methods§
Sourcefn take_token(token: &mut T) -> T
fn take_token(token: &mut T) -> T
Clone a terminal and otherwise std::mem::take it.
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.