pub enum Item {
Str(String),
None,
Prim(Prim),
Func(FuncName),
Alias {
map: Option<String>,
name: String,
},
CaptureGroup {
id: usize,
inner: Box<Item>,
},
CaptureRef(usize),
Maybe(Box<Item>),
Some(Box<Item>),
Range(char, char),
Set(Vec<Item>),
Concat(Vec<Item>),
}Expand description
A sub-rule item tree (from, to, constraint items).
Variants§
Str(String)
Literal string (Item::String).
None
The none keyword — empty string.
Prim(Prim)
Zero-width / class primitive (NodeAdapter: Alias(stdlib symbol)).
Func(FuncName)
upcase/downcase function item. Only usable as a sub target and
only as Upcase/Downcase (the Ruby adapter raises on the rest).
Alias
Alias reference: map for dep_alias.name qualified refs.
CaptureGroup
capture(…). id is the 1-based regex group number, assigned
by the builder in lookaround assembly order
(before, not_before, from, not_after, after).
CaptureRef(usize)
ref(N) — backreference to the Nth capture group.
Maybe(Box<Item>)
maybe(…)
Some(Box<Item>)
some(…)
Range(char, char)
any(“lo”..“hi”) — inclusive codepoint range.
Set(Vec<Item>)
any(…) — char set / alternation list (entries may be nested Items: ranges, sets, primitives, alias refs).
Concat(Vec<Item>)
Concatenation (+ / whitespace joins). Also Item::Group.
Implementations§
Source§impl Item
impl Item
Sourcepub fn concat_from_parts(parts: Vec<Item>) -> Item
pub fn concat_from_parts(parts: Vec<Item>) -> Item
Interscript::Node::Item::Group-style concatenation with
flattening and None-elimination (Items::Concat.from_parts).
Sourcepub fn first_string(&self) -> Item
pub fn first_string(&self) -> Item
first_string collapse (Ruby nth_string without the fiber
selection): what this item yields as a single replacement
string. Any → first entry; Range → lo. Alias/Prim/CaptureRef
keep identity (resolved later, like build_item).
Sourcepub fn max_length(&self) -> usize
pub fn max_length(&self) -> usize
max_length for the deterministic parallel sort. Primitives
count as 1 (0 for none), mirroring Node::Item::Alias#max_length.