Trait pest::prelude::Parser
[−]
[src]
pub trait Parser<'a, T: Input<'a>> { type Rule; type Token; fn input(&self) -> &T; fn input_mut(&mut self) -> &mut T; fn end(&self) -> bool; fn eoi_matched(&self) -> bool; fn reset(&mut self); fn queue(&self) -> &Vec<Self::Token>; fn queue_mut(&mut self) -> &mut Vec<Self::Token>; fn queue_index(&self) -> usize; fn inc_queue_index(&self); fn set_queue_index(&self, index: usize); fn skip_ws(&mut self); fn skip_com(&mut self); fn is_atomic(&self) -> bool; fn set_atomic(&mut self, value: bool); fn track(&mut self, failed: Self::Rule, pos: usize); fn tracked_len(&self) -> usize; fn expected(&mut self) -> (Vec<Self::Rule>, usize); }
A trait
that defines a parser.
Associated Types
Required Methods
fn input(&self) -> &T
fn input_mut(&mut self) -> &mut T
fn end(&self) -> bool
Returns whether a Parser
has reached its end.
fn eoi_matched(&self) -> bool
Returns whether a Parser
has matched end-of-input.
fn reset(&mut self)
Reset a Parser
.
fn queue(&self) -> &Vec<Self::Token>
Returns the queue of all matched Token
s.
fn queue_mut(&mut self) -> &mut Vec<Self::Token>
Returns the mutable queue of all matched Token
s.
fn queue_index(&self) -> usize
Returns the current index within the queue. Used in process!
.
fn inc_queue_index(&self)
Increments the current index within the queue. Used in process!
.
fn set_queue_index(&self, index: usize)
Set the current index within the queue. Used in process!
.
fn skip_ws(&mut self)
Skips white-space.
fn skip_com(&mut self)
Skips comments.
fn is_atomic(&self) -> bool
Returns whether a Parser
is currently inside an atomic rule.
fn set_atomic(&mut self, value: bool)
Sets a Parser
to atomic rule mode, barring comment & white-space skipping.
fn track(&mut self, failed: Self::Rule, pos: usize)
Keeps track of rule failures. It gets called when a Rule
fails at pos
.
fn tracked_len(&self) -> usize
Returns the length of the tracked Rule
s.
fn expected(&mut self) -> (Vec<Self::Rule>, usize)
Retuns a Vec
of all expected Rule
s at the deepest position where the parsing last
stopped. It only returns leafs from the rule tree. Used for error reporting.