pub enum Node {
Root {
children: Vec<NodeId>,
mode: ContentMode,
},
Group {
children: Vec<NodeId>,
kind: GroupKind,
mode: ContentMode,
},
Command {
name: String,
args: Vec<ArgumentSlot>,
known: bool,
},
Infix {
name: String,
args: Vec<ArgumentSlot>,
left: NodeId,
right: NodeId,
},
Declarative {
name: String,
args: Vec<ArgumentSlot>,
},
Environment {
name: String,
args: Vec<ArgumentSlot>,
known: bool,
body: NodeId,
},
Scripted {
base: NodeId,
subscript: Option<NodeId>,
superscript: Option<NodeId>,
},
Prime {
count: usize,
},
Text(String),
Char(char),
ActiveSpace,
Error {
message: String,
snippet: String,
},
}Expand description
Mutable AST node stored inside Ast.
Variants§
Root
Main document root containing top-level children and parse mode.
Fields
mode: ContentModeContent mode used to parse the formula
Group
Group node containing ordered children and mode metadata.
Fields
mode: ContentModeContent mode used to parse the group
Command
Prefix command with argument slots.
Fields
args: Vec<ArgumentSlot>Slots defined by the matched command spec
Infix
Infix command with explicit left and right operands.
Fields
args: Vec<ArgumentSlot>Additional argument slots owned by the infix node
Declarative
Declarative command with explicit argument slots.
Fields
args: Vec<ArgumentSlot>Additional argument slots owned by the declarative node
Environment
Environment node whose body must always be a group.
Fields
args: Vec<ArgumentSlot>Parsed argument slots attached to the environment
body: NodeIdEnvironment body subtree. Must be a Node::Group
Scripted
Scripted expression such as x_i^2.
Fields
Prime
Math prime shorthand represented by one or more consecutive prime marks.
Text(String)
Text-mode text chunk
Char(char)
Single character node
ActiveSpace
Active ~ space node
Error
Parser-produced error placeholder, mirroring
SyntaxNode::Error.
Error is a first-class structural leaf: a tree containing Error
nodes is still structurally valid. Semantic completeness (the absence of
Error nodes) is a separate property, not a structural invariant.
Error carries the original recovery message and the source snippet so
serialization can round-trip it losslessly.
Implementations§
Trait Implementations§
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.