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
kind: AtomicKindLines
lines(P).
Sections
sections(P) (homogeneous).
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]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.
Optional
optional(P) (§7.5). Parse P; on success return Some(value)
(Option tag 0), on failure consume nothing and return None (tag 1).
Scan
scan(P) (§7.5). Slide a cursor; at each position try P; collect
matches in source order, ignoring unmatched text.
OneOf
one_of("LR") (§7.5). chars_index is into ParserPlan::literals.
Characters
chars(P, skip:) (§7.5). Apply a char-parser repeatedly.
Matrix
matrix(P) (§7.5, ADR-030). Whitespace-tokenized rectangular Grid.
GridRagged
Ragged grid(P, ragged, fill:) (§7.5). fill_index into literals.
Csv
csv(P).
Ws
ws(P).
Sep
sep(separator_index, P).
Grid
grid(P).
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.