Expand description
Basic greedy parser with YAML syntax.
Its methods are actually the sub-parser of the syntax.
Fields
pos: usizeCurrent position.
eaten: usizeRead position.
Implementations
sourceimpl Parser<'_>
impl Parser<'_>
The low level grammar implementation for YAML.
These sub-parser returns Result<R, PError>, and calling Parser::backward if mismatched.
sourcepub fn bound(&mut self) -> PResult<()>
pub fn bound(&mut self) -> PResult<()>
Match invisible boundaries and keep the gaps. (must matched once)
sourcepub fn complex_mapping(&mut self) -> PResult<()>
pub fn complex_mapping(&mut self) -> PResult<()>
Match complex mapping indicator (?).
sourcepub fn string_quoted(&mut self, sym: u8, ignore: &[u8]) -> PResult<String>
pub fn string_quoted(&mut self, sym: u8, ignore: &[u8]) -> PResult<String>
Match quoted string.
sourcepub fn string_plain(&mut self, level: usize, inner: bool) -> PResult<String>
pub fn string_plain(&mut self, level: usize, inner: bool) -> PResult<String>
Match plain string.
sourcepub fn string_literal(&mut self, level: usize) -> PResult<String>
pub fn string_literal(&mut self, level: usize) -> PResult<String>
Match literal string.
sourcepub fn string_folded(&mut self, level: usize) -> PResult<String>
pub fn string_folded(&mut self, level: usize) -> PResult<String>
Match folded string.
sourcepub fn string_wrapped(
&mut self,
level: usize,
sep: u8,
leading: bool
) -> PResult<String>
pub fn string_wrapped(
&mut self,
level: usize,
sep: u8,
leading: bool
) -> PResult<String>
Match wrapped string.
sourcepub fn identifier(&mut self) -> PResult<()>
pub fn identifier(&mut self) -> PResult<()>
Match valid YAML identifier.
sourcepub fn anchor_use(&mut self) -> PResult<String>
pub fn anchor_use(&mut self) -> PResult<String>
Match anchor used.
sourcepub fn ws(&mut self, opt: TakeOpt) -> PResult<()>
pub fn ws(&mut self, opt: TakeOpt) -> PResult<()>
Match any invisible characters except newline.
sourcepub fn ind_define(&mut self, level: usize) -> PResult<()>
pub fn ind_define(&mut self, level: usize) -> PResult<()>
Match and define new indent size.
sourcepub fn unind(&mut self, level: usize) -> PResult<bool>
pub fn unind(&mut self, level: usize) -> PResult<bool>
Match indent with previous level.
This sub-parser returns true if downgrading indent is used.
The downgrading can only use a level as unit, not a whitespace.
sourceimpl<'a> Parser<'a>
impl<'a> Parser<'a>
The implementation of string pointer.
sourceimpl Parser<'_>
impl Parser<'_>
The low level grammar implementation.
These sub-parser returns Result<(), PError>, and calling Parser::backward if mismatched.
sourcepub fn take_while<F>(&mut self, f: F, opt: TakeOpt) -> PResult<()> where
F: Fn(&u8) -> bool,
pub fn take_while<F>(&mut self, f: F, opt: TakeOpt) -> PResult<()> where
F: Fn(&u8) -> bool,
Match until the condition failed.
The argument opt matches different terminate requirement.
sourcepub fn count<F, R>(&mut self, f: F) -> PResult<usize> where
F: FnOnce(&mut Self) -> PResult<R>,
pub fn count<F, R>(&mut self, f: F) -> PResult<usize> where
F: FnOnce(&mut Self) -> PResult<R>,
Count the position that parser goes, expect error.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more