class

Lrama::Runtime::CstData

Inherits Reference < Object

Concrete Syntax Tree data storage

Constructors

new(source : String)
Source

Instance methods

[](ref : NodeRef) : Node

Get node by reference

Source
add_elided(id : Int32, span : Span, parent : NodeRef | Nil = nil) : NodeRef

Add an elided node (placeholder for elided rule)

Source
add_error(span : Span, parent : NodeRef | Nil = nil) : NodeRef

Add an error node with parent relationship

Source
add_rule(id : Int32, span : Span, child_count : Int32, name : String | Nil = nil, parent : NodeRef | Nil = nil) : NodeRef

Add a rule node with parent relationship

Source
add_token(id : Int32, span : Span, parent : NodeRef | Nil = nil) : NodeRef

Add a token node with parent relationship

Source
children(ref : NodeRef) : Array(NodeRef)

Get child nodes

Source
nodes
Source
parent(ref : NodeRef) : NodeRef | Nil

Get parent of a node

Source
source
Source
source_text(ref : NodeRef) : String

Get source text for a node

Source
to_s(io : IO)

Format CST as string

Source
update_root_span(span : Span)

Update root node span

Source