Struct hime_redist::parsers::LRProduction
source · pub struct LRProduction {
pub head: usize,
pub head_action: TreeAction,
pub reduction_length: usize,
pub bytecode: Vec<LROpCode>,
}
Expand description
Represents a rule’s production in a LR parser
The binary representation of a LR Production is as follow:
— header
u16: head’s index
u8: 1=replace, 0=nothing
u8: reduction length
u8: bytecode length in number of op-code
— production’s bytecode
array of LROpCode
Fields§
§head: usize
Index of the rule’s head in the parser’s array of variables
head_action: TreeAction
Action of the rule’s head (replace or not)
reduction_length: usize
Size of the rule’s body by only counting terminals and variables
bytecode: Vec<LROpCode>
Bytecode for the rule’s production
Implementations§
source§impl LRProduction
impl LRProduction
sourcepub fn new(data: &[u8], index: &mut usize) -> LRProduction
pub fn new(data: &[u8], index: &mut usize) -> LRProduction
Creates and loads a production
Trait Implementations§
source§impl Clone for LRProduction
impl Clone for LRProduction
source§fn clone(&self) -> LRProduction
fn clone(&self) -> LRProduction
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for LRProduction
impl Send for LRProduction
impl Sync for LRProduction
impl Unpin for LRProduction
impl UnwindSafe for LRProduction
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