Skip to main content

PlanNode

Enum PlanNode 

Source
pub enum PlanNode {
Show 17 variants Atomic { kind: AtomicKind, }, Lines { child: u32, }, Sections { child: u32, }, SectionsNamed { fields: &'static [SectionItemNode], repeated_tail: Option<(&'static str, u32)>, field_order: &'static [&'static str], }, Block { items: &'static [BlockItemNode], field_order: &'static [&'static str], }, Choice { cases: &'static [(&'static str, u32)], }, Optional { child: u32, }, Scan { child: u32, }, OneOf { chars_index: u32, }, Characters { child: u32, skip: SkipPolicy, }, Matrix { child: u32, }, GridRagged { child: u32, fill_index: u32, }, Csv { child: u32, }, Ws { child: u32, }, Sep { separator_index: u32, child: u32, }, Grid { child: u32, }, Template { parts: &'static [TemplatePartNode], field_order: &'static [&'static str], },
}
Expand description

One node in the flattened parser plan. Index-based: children refer to other nodes by their position in the ParserPlan::nodes slice.

Variants§

§

Atomic

An atomic parser.

Fields

§

Lines

lines(P).

Fields

§child: u32
§

Sections

sections(P) (homogeneous).

Fields

§child: u32
§

SectionsNamed

Named heterogeneous sections(name: P, ..., tail: repeated(P)). fields are the named arguments in source order, each contributing one record field and consuming SectionItemNode::sections_wanted sections; repeated_tail is the unbounded tail’s (name, child_index), if present, and it consumes every section the fields left.

Fields

§fields: &'static [SectionItemNode]
§repeated_tail: Option<(&'static str, u32)>
§field_order: &'static [&'static str]

The result record’s canonical field order (see FieldOrder).

§

Block

block(item, ...) (§7.5). Sequential parsers within one region; positional named-capture templates flatten their fields into the result record, named items contribute one field each.

Fields

§items: &'static [BlockItemNode]
§field_order: &'static [&'static str]

The result record’s canonical field order (see FieldOrder).

§

Choice

choice(Name: P, ...) (§7.5). Try each case in source order; the first match wins and its value becomes the variant’s payload. cases are (name, child_index) pairs.

Fields

§cases: &'static [(&'static str, u32)]
§

Optional

optional(P) (§7.5). Parse P; on success return Some(value) (Option tag 0), on failure consume nothing and return None (tag 1).

Fields

§child: u32
§

Scan

scan(P) (§7.5). Slide a cursor; at each position try P; collect matches in source order, ignoring unmatched text.

Fields

§child: u32
§

OneOf

one_of("LR") (§7.5). chars_index is into ParserPlan::literals.

Fields

§chars_index: u32
§

Characters

chars(P, skip:) (§7.5). Apply a char-parser repeatedly.

Fields

§child: u32
§

Matrix

matrix(P) (§7.5, ADR-030). Whitespace-tokenized rectangular Grid.

Fields

§child: u32
§

GridRagged

Ragged grid(P, ragged, fill:) (§7.5). fill_index into literals.

Fields

§child: u32
§fill_index: u32
§

Csv

csv(P).

Fields

§child: u32
§

Ws

ws(P).

Fields

§child: u32
§

Sep

sep(separator_index, P).

Fields

§separator_index: u32
§child: u32
§

Grid

grid(P).

Fields

§child: u32
§

Template

A backtick template. parts are indices into ParserPlan::template_parts.

Every template shape lowers to this, multi-anonymous-capture tuples included; see TemplateShape. There is deliberately no Tuple node beside it — see that type’s doc for why one cannot exist.

Fields

§parts: &'static [TemplatePartNode]
§field_order: &'static [&'static str]

The result record’s canonical field order (see FieldOrder), and empty for the shapes that are not records — a tuple’s element order is its capture order and nothing reorders it, so there is no second opinion for this to carry.

Trait Implementations§

Source§

impl Debug for PlanNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.