Skip to main content

BlockParser

Struct BlockParser 

Source
pub struct BlockParser {
    pub options: Options,
    pub refmap: RefMap,
    pub tree: Tree,
    pub table_armed: bool,
    /* private fields */
}
Expand description

The block-phase parser: the open spine, the current line, and the tree being built.

Fields§

§options: Options§refmap: RefMap§tree: Tree§table_armed: bool

The GFM table probe gate. True by default: the batch driver probes every candidate line, as it always has. The engine driver sets it per line from the #LB token’s tblArm bit (a provable superset of “could be a delimiter row”; see engine_block.rs), which is what lets the GFM alt be a genuine, subtractable extension seam without moving any table decision out of this file.

Implementations§

Source§

impl BlockParser

Source

pub fn new(options: Options) -> Self

Source

pub fn incorporate_line(&mut self, ln: &str)

Incorporate one line into the tree: the three steps of Appendix A.

Source

pub fn parse(self, input: &str) -> (Tree, RefMap)

Feed every line of input and finish. An empty document still incorporates one empty line, exactly as the historical split-based loop did: line count and sourcepos depend on it. Line cutting and section 2.3 NUL replacement both live in segment_next_line.

Source

pub fn finish(self) -> (Tree, RefMap)

Close every still-open block, stamp the parse-time gfm flag, and run the task-list post-pass. line_number is the count of incorporated lines, so an incremental driver (one that feeds incorporate_line itself instead of calling parse) finishes with exactly the same finalization the batch loop gets.

Auto Trait Implementations§

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.