struct __StateMachine<'input> {
input: &'input str,
__phantom: PhantomData<&'input ()>,
}Fields§
§input: &'input str§__phantom: PhantomData<&'input ()>Trait Implementations§
Source§impl<'input> ParserDefinition for __StateMachine<'input>
impl<'input> ParserDefinition for __StateMachine<'input>
Source§type Location = usize
type Location = usize
Represents a location in the input text. If you are using the
default tokenizer, this will be a
usize.Source§type Error = &'static str
type Error = &'static str
Represents a “user error” – this can get produced by
reduce() if the grammar includes =>? actions.Source§type Token = Token<'input>
type Token = Token<'input>
The type emitted by the user’s tokenizer (excluding the
location information).
Source§type TokenIndex = usize
type TokenIndex = usize
We assign a unique index to each token in the grammar, which
we call its index. When we pull in a new
Token from the
input, we then match against it to determine its index. Note
that the actual Token is retained too, as it may carry
additional information (e.g., an ID terminal often has a
string value associated with it; this is not important to the
parser, but the semantic analyzer will want it).Source§type Symbol = __Symbol<'input>
type Symbol = __Symbol<'input>
The type representing things on the LALRPOP stack. Represents
the union of terminals and nonterminals.
Source§type Success = IgnoreSpec
type Success = IgnoreSpec
Type produced by reducing the start symbol.
Source§type StateIndex = i8
type StateIndex = i8
Identifies a state. Typically an i8, i16, or i32 (depending on
how many states you have).
Source§type ReduceIndex = i8
type ReduceIndex = i8
Identifies a reduction.
Source§type NonterminalIndex = usize
type NonterminalIndex = usize
Identifies a nonterminal.
Source§fn start_location(&self) -> Self::Location
fn start_location(&self) -> Self::Location
Returns a location representing the “start of the input”.
Source§fn start_state(&self) -> Self::StateIndex
fn start_state(&self) -> Self::StateIndex
Returns the initial state.
Source§fn token_to_index(&self, token: &Self::Token) -> Option<usize>
fn token_to_index(&self, token: &Self::Token) -> Option<usize>
Converts the user’s tokens into an internal index; this index
is then used to index into actions and the like. When using an
internal tokenizer, these indices are directly produced. When
using an external tokenier, however, this function matches
against the patterns given by the user: it is fallible
therefore as these patterns may not be exhaustive. If a token
value is found that doesn’t match any of the patterns the user
supplied, then this function returns
None, which is
translated into a parse error by LALRPOP (“unrecognized
token”).Source§fn action(&self, state: i8, integer: usize) -> i8
fn action(&self, state: i8, integer: usize) -> i8
Given the top-most state and the pending terminal, returns an
action. This can be either SHIFT(state), REDUCE(action), or
ERROR.
Source§fn error_action(&self, state: i8) -> i8
fn error_action(&self, state: i8) -> i8
Returns the action to take if an error occurs in the given
state. This function is the same as the ordinary
action,
except that it applies not to the user’s terminals but to the
“special terminal” !.Source§fn eof_action(&self, state: i8) -> i8
fn eof_action(&self, state: i8) -> i8
Action to take if EOF occurs in the given state. This function
is the same as the ordinary
action, except that it applies
not to the user’s terminals but to the “special terminal” $.Source§fn goto(&self, state: i8, nt: usize) -> i8
fn goto(&self, state: i8, nt: usize) -> i8
If we reduce to a nonterminal in the given state, what state
do we go to? This is infallible due to the nature of LR(1)
grammars.
Source§fn token_to_symbol(
&self,
token_index: usize,
token: Self::Token,
) -> Self::Symbol
fn token_to_symbol( &self, token_index: usize, token: Self::Token, ) -> Self::Symbol
“Upcast” a terminal into a symbol so we can push it onto the
parser stack.
Source§fn expected_tokens(&self, state: i8) -> Vec<String>
fn expected_tokens(&self, state: i8) -> Vec<String>
Returns the expected tokens in a given state. This is used for
error reporting.
Source§fn expected_tokens_from_states(&self, states: &[i8]) -> Vec<String>
fn expected_tokens_from_states(&self, states: &[i8]) -> Vec<String>
Returns the expected tokens in a given state. This is used in the
same way as
expected_tokens but allows more precise reporting
of accepted tokens in some cases.Source§fn uses_error_recovery(&self) -> bool
fn uses_error_recovery(&self) -> bool
True if this grammar supports error recovery.
Source§fn error_recovery_symbol(&self, recovery: ErrorRecovery<Self>) -> Self::Symbol
fn error_recovery_symbol(&self, recovery: ErrorRecovery<Self>) -> Self::Symbol
Given error information, creates an error recovery symbol that
we push onto the stack (and supply to user actions).
Source§fn reduce(
&mut self,
action: i8,
start_location: Option<&Self::Location>,
states: &mut Vec<i8>,
symbols: &mut Vec<SymbolTriple<Self>>,
) -> Option<ParseResult<Self>>
fn reduce( &mut self, action: i8, start_location: Option<&Self::Location>, states: &mut Vec<i8>, symbols: &mut Vec<SymbolTriple<Self>>, ) -> Option<ParseResult<Self>>
Execute a reduction in the given state: that is, execute user
code. The start location indicates the “starting point” of the
current lookahead that is triggering the reduction (it is
None for EOF). Read moreSource§fn simulate_reduce(&self, action: i8) -> SimulatedReduce<Self>
fn simulate_reduce(&self, action: i8) -> SimulatedReduce<Self>
Returns information about how many states will be popped
during a reduction, and what nonterminal would be produced as
a result.
Auto Trait Implementations§
impl<'input> Freeze for __StateMachine<'input>
impl<'input> RefUnwindSafe for __StateMachine<'input>
impl<'input> Send for __StateMachine<'input>
impl<'input> Sync for __StateMachine<'input>
impl<'input> Unpin for __StateMachine<'input>
impl<'input> UnwindSafe for __StateMachine<'input>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.