Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new(buf: &'a [u8], canonical: bool) -> Self

A parser over buf. With canonical it also records every canonical violation (see Parser::warnings).

Source

pub fn ok(&self) -> bool

Whether nothing non-canonical has been met.

Source

pub fn warnings(&self) -> &[&'static str]

Canonical violations met, one entry per finding.

Source

pub fn dead_elements(&self) -> usize

Dead elements met in bodies (the heading’s dead keys are not counted).

Source

pub fn heading( &mut self, pos: usize, stop: usize, ) -> Result<(Heading<'a>, usize)>

After SYN. Returns the heading (dead keys dropped, duplicates kept) and the position of the first body code.

Source

pub fn body( &mut self, pos: usize, stop: usize, level: bool, ) -> Result<(Vec<FileView<'a>>, usize)>

A body from pos to stop. At depth zero (level false) commits are legal and the body ends at EOT, SYN, EM or stop; in a level it ends at CAN. Returns the files (dead elements dropped) and the position of the code that ended the body.

Source

pub fn record(&mut self, pos: usize, stop: usize) -> Result<(Record<'a>, usize)>

After RS. Returns the record and the position after it.

Source

pub fn level( &mut self, pos: usize, stop: usize, ) -> Result<(Vec<FileView<'a>>, usize)>

DLE at pos: a nested level. Returns its files and the position after CAN.

Source

pub fn reference( &mut self, pos: usize, stop: usize, ) -> Result<(Reference<'a>, usize)>

ENQ at pos: a group name, or a pattern (DESIGN.md, References). Returns the reference and the position after it.

Auto Trait Implementations§

§

impl<'a> Forget for Parser<'a>

§

impl<'a> Freeze for Parser<'a>

§

impl<'a> Move for Parser<'a>

§

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> UnsafeUnpin for Parser<'a>

§

impl<'a> UnwindSafe for Parser<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.