Class: Highway::Compiler::Parse::Tree::Root
- Inherits:
-
Object
- Object
- Highway::Compiler::Parse::Tree::Root
- Defined in:
- lib/highway/compiler/parse/tree/root.rb
Overview
This class represents a root node of a parse tree. It contains other nodes, such as variables and steps.
Instance Attribute Summary collapse
-
#steps ⇒ Array<Highway::Compiler::Parse::Tree::Step>
readonly
Steps in the tree.
-
#variables ⇒ Array<Highway::Compiler::Parse::Tree::Variable>
readonly
Variables in the tree.
-
#version ⇒ Integer
readonly
Version of the parse tree.
Instance Method Summary collapse
-
#add_step(name:, parameters:, preset:, stage:, index:) ⇒ Void
Add a step to the tree.
-
#add_variable(name:, value:, preset:) ⇒ Void
Add a variable to the tree.
-
#initialize(version:) ⇒ Root
constructor
Initialize an instance.
Constructor Details
#initialize(version:) ⇒ Root
Initialize an instance.
23 24 25 26 27 |
# File 'lib/highway/compiler/parse/tree/root.rb', line 23 def initialize(version:) @version = version @variables = Array.new() @steps = Array.new() end |
Instance Attribute Details
#steps ⇒ Array<Highway::Compiler::Parse::Tree::Step> (readonly)
Steps in the tree.
42 43 44 |
# File 'lib/highway/compiler/parse/tree/root.rb', line 42 def steps @steps end |
#variables ⇒ Array<Highway::Compiler::Parse::Tree::Variable> (readonly)
Variables in the tree.
37 38 39 |
# File 'lib/highway/compiler/parse/tree/root.rb', line 37 def variables @variables end |
#version ⇒ Integer (readonly)
Version of the parse tree.
32 33 34 |
# File 'lib/highway/compiler/parse/tree/root.rb', line 32 def version @version end |
Instance Method Details
#add_step(name:, parameters:, preset:, stage:, index:) ⇒ Void
Add a step to the tree.
64 65 66 |
# File 'lib/highway/compiler/parse/tree/root.rb', line 64 def add_step(name:, parameters:, preset:, stage:, index:) @steps << Step.new(index: index, name: name, parameters: parameters, preset: preset, stage: stage) end |