Struct koto_parser::Ast [−][src]
pub struct Ast { /* fields omitted */ }
Expand description
A Koto program represented as an Abstract Syntax Tree
This is produced by the parser, and consumed by the compiler.
Implementations
Initializes an Ast with the given capacity
Pushes a node and corresponding span onto the tree
pub fn push_with_span_index(
&mut self,
node: Node,
span_index: AstIndex
) -> Result<AstIndex, ParserError>
pub fn push_with_span_index(
&mut self,
node: Node,
span_index: AstIndex
) -> Result<AstIndex, ParserError>
Pushes a node onto the tree, associating it with an existing span
Returns the constant pool referred to by the AST
Moves the constants out of the AST
This is used when building a Chunk
after compilation.
The constants get transferred to the Chunk
once the AST has been converted into bytecode.
Returns the root node in the tree