pub enum Action<'g> {
Shift(StateIndex),
Reduce(Rule<'g>),
Halt,
}Expand description
An LR action.
Variants§
Shift(StateIndex)
Shift the next symbol from the input stream onto the stack. Then enter the give state.
Shift is also used to represent a GOTO transition.
Reduce(Rule<'g>)
Use the given rule to reduce. This pops elements off the stack equal to the number of symbols on the right hand side. These become the children of the parse tree with the left hand side being the root.
Conceptually, this pushes the nonterminal back into the input stream.
This will always be followed by applying a Shift action
to remove the nonterminal that was just generated off of input stream
and back onto the stack.
Halt
The machine successfully consumed the start rule. If there is no more input remaining, the parse was successful.
Trait Implementations§
Source§impl<'g> PartialEq for Action<'g>
impl<'g> PartialEq for Action<'g>
impl<'g> Copy for Action<'g>
impl<'g> Eq for Action<'g>
impl<'g> StructuralPartialEq for Action<'g>
Auto Trait Implementations§
impl<'g> Freeze for Action<'g>
impl<'g> RefUnwindSafe for Action<'g>
impl<'g> Send for Action<'g>
impl<'g> Sync for Action<'g>
impl<'g> Unpin for Action<'g>
impl<'g> UnsafeUnpin for Action<'g>
impl<'g> UnwindSafe for Action<'g>
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