class Highway::Compiler::Analyze::Tree::Root

This class represents a root node of a semantic tree. It contains other nodes, such as variables and steps.

Attributes

default_preset[RW]

Name of the default preset.

@return [String]

stages[R]

Stages in the tree.

@return [Array<Highway::Compiler::Analyze::Tree::Stage>]

steps[R]

Steps in the tree.

@return [Array<Highway::Compiler::Analyze::Tree::Step>]

variables[R]

Variables in the tree.

@return [Array<Highway::Compiler::Analyze::Tree::Variable>]

Public Class Methods

new() click to toggle source

Initialize an instance.

# File lib/highway/compiler/analyze/tree/root.rb, line 27
def initialize()
  @variables = Array.new()
  @steps = Array.new()
  @stages = Array.new()
end

Public Instance Methods

add_stage(index:, name:, policy:) click to toggle source

Add a stage to the tree.

@param index [Integer] Index of the stage. @param name [String] Name of the stage. @param policy [Symbol] Execution policy of the stage.

@return [Void]

# File lib/highway/compiler/analyze/tree/root.rb, line 86
def add_stage(index:, name:, policy:)
  @stages << Stage.new(index: index, name: name, policy: policy)
end
add_step(index:, name:, step_class:, parameters:, preset:, stage:) click to toggle source

Add a step to the tree.

@param index [Integer] Index of step in its scope. @param name [String] Name of the step. @param step_class [Class] Definition class of the step. @param parameters [Highway::Compiler::Analyze::Tree::Values::Hash] The hash value of step parameters. @param preset [String] Parent preset of the step. @param stage [String] Parent stage of the step.

@return [Void]

# File lib/highway/compiler/analyze/tree/root.rb, line 74
def add_step(index:, name:, step_class:, parameters:, preset:, stage:)
  @steps << Step.new(index: index, name: name, step_class: step_class, parameters: parameters, preset: preset, stage: stage)
end
add_variable(name:, value:, preset:) click to toggle source

Add a variable to the tree.

@param name [String] Name of the variable. @param value [Highway::Compiler::Analyze::Tree::Values::*] Value of the variable. @param preset [String] Parent preset of the variable.

@return [Void]

# File lib/highway/compiler/analyze/tree/root.rb, line 60
def add_variable(name:, value:, preset:)
  @variables << Variable.new(name: name, value: value, preset: preset)
end