Enum subscript_compiler::frontend::ast::Node [−][src]
pub enum Node<'a> { Tag(Tag<'a>), Ident(Ann<Atom<'a>>), Enclosure(Ann<Enclosure<'a, Node<'a>>>), String(Ann<Atom<'a>>), InvalidToken(Ann<Atom<'a>>), }
Variants
Tag(Tag<'a>)
The parser doesn’t emit AST Tag
nodes. This is done in a later
processing phase.
Some identifier that may or may not be followed by square parentheses
and/or a curly brace enclosure. E.g. \name
.
An enclosure can be a multitude of things:
- Some syntactic enclosure:
- Curly braces
- Parentheses
- Square parentheses
- Some error with it’s invalid start & end token (i.e. a opening
[
and closing}
) - Additionally, after parsing, an enclosure can also be a fragment (i.e. a list of AST nodes)
Some string of arbitrary characters or a single special token.
Some unbalanced token that isn’t associated with an enclosure. In Subscript, enclosure symbols must be balanced. If the author must use such in their publications, then use the tag version.
Implementations
Some tag with no parameters and just children.
pub fn new_enclosure(
range: CharRange,
kind: EnclosureKind<'a>,
children: Vec<Node<'a>>
) -> Self
Unpacks an Node::Enclosure
with the Fragment
kind or
returns a singleton vec.
pub fn transform<F: Fn(NodeEnvironment<'a>, Node<'a>) -> Node<'a>>(
self,
env: NodeEnvironment<'a>,
f: Rc<F>
) -> Self
pub fn transform<F: Fn(NodeEnvironment<'a>, Node<'a>) -> Node<'a>>(
self,
env: NodeEnvironment<'a>,
f: Rc<F>
) -> Self
Bottom up ‘node to ndoe’ transformation.
pub fn transform_mut<F: FnMut(NodeEnvironment<'a>, Node<'a>) -> Node<'a>>(
self,
env: NodeEnvironment<'a>,
f: Rc<RefCell<F>>
) -> Self
Bottom up transformation of AST child nodes within the same enclosure.
For syntax highlighting VIA the compiler frontend.
Push to a fragment or tag node.
TODO: Should we also push to any EnclosureKind
?
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Node<'a>
impl<'a> UnwindSafe for Node<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more