pub enum PredictionContext {
Empty {
cached_hash: u64,
},
Singleton {
parent: Rc<Self>,
return_state: usize,
cached_hash: u64,
},
Array {
parents: Vec<Rc<Self>>,
return_states: Vec<usize>,
cached_hash: u64,
},
}Variants§
Implementations§
Source§impl PredictionContext
impl PredictionContext
pub fn empty() -> Rc<Self>
pub fn singleton(parent: Rc<Self>, return_state: usize) -> Rc<Self>
pub const fn cached_hash(&self) -> u64
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn return_state(&self, index: usize) -> Option<usize>
pub fn parent(&self, index: usize) -> Option<Rc<Self>>
pub fn has_empty_path(&self) -> bool
pub fn merge(left: Rc<Self>, right: Rc<Self>) -> Rc<Self>
Sourcepub fn merge_with_options(
left: Rc<Self>,
right: Rc<Self>,
root_is_wildcard: bool,
cache: Option<&mut PredictionContextMergeCache>,
) -> Rc<Self>
pub fn merge_with_options( left: Rc<Self>, right: Rc<Self>, root_is_wildcard: bool, cache: Option<&mut PredictionContextMergeCache>, ) -> Rc<Self>
Merges two prediction contexts using ANTLR’s SLL/LL root semantics.
In SLL mode the empty root is a wildcard: $ + x = $. In full LL mode
it is an ordinary array entry: $ + x = [$, x]. The optional merge
cache is intentionally per prediction operation so large conflict-heavy
parses can drop the cache immediately after adaptive_predict.
Trait Implementations§
Source§impl Clone for PredictionContext
impl Clone for PredictionContext
Source§fn clone(&self) -> PredictionContext
fn clone(&self) -> PredictionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PredictionContext
impl Debug for PredictionContext
impl Eq for PredictionContext
Source§impl Hash for PredictionContext
impl Hash for PredictionContext
Source§impl Ord for PredictionContext
impl Ord for PredictionContext
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PredictionContext
impl PartialEq for PredictionContext
Source§impl PartialOrd for PredictionContext
impl PartialOrd for PredictionContext
Auto Trait Implementations§
impl !Send for PredictionContext
impl !Sync for PredictionContext
impl Freeze for PredictionContext
impl RefUnwindSafe for PredictionContext
impl Unpin for PredictionContext
impl UnsafeUnpin for PredictionContext
impl UnwindSafe for PredictionContext
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