pub struct ParseContext {
pub scopes: ScopeStack,
/* private fields */
}Expand description
Holds the state for backtracking and error reporting. This must be passed mutably through the parsing chain.
Fields§
§scopes: ScopeStackImplementations§
Source§impl ParseContext
impl ParseContext
pub fn new() -> Self
pub fn set_fatal(&mut self, fatal: bool)
pub fn check_fatal(&self) -> bool
pub fn enter_rule(&mut self, name: &str)
pub fn exit_rule(&mut self)
Sourcepub fn record_error(&mut self, err: Error, start_span: Span)
pub fn record_error(&mut self, err: Error, start_span: Span)
Records an error if it is “deeper” than the current best error.
pub fn take_best_error(&mut self) -> Option<Error>
pub fn enter_scope(&mut self)
pub fn exit_scope(&mut self)
pub fn define(&mut self, name: impl Into<String>)
pub fn is_defined(&self, name: &str) -> bool
pub fn scopes(&self) -> &Vec<HashSet<String>>
pub fn rule_stack(&self) -> &Vec<String>
Trait Implementations§
Source§impl Clone for ParseContext
impl Clone for ParseContext
Source§fn clone(&self) -> ParseContext
fn clone(&self) -> ParseContext
Returns a duplicate 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 Freeze for ParseContext
impl RefUnwindSafe for ParseContext
impl Send for ParseContext
impl Sync for ParseContext
impl Unpin for ParseContext
impl UnwindSafe for ParseContext
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