Class: Highway::Compiler::Analyze::Tree::Root

Inherits:
Object
  • Object
show all
Defined in:
lib/highway/compiler/analyze/tree/root.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoot

Initialize an instance.



27
28
29
30
31
# File 'lib/highway/compiler/analyze/tree/root.rb', line 27

def initialize()
  @variables = Array.new()
  @steps = Array.new()
  @stages = Array.new()
end

Instance Attribute Details

#default_presetString

Name of the default preset.



36
37
38
# File 'lib/highway/compiler/analyze/tree/root.rb', line 36

def default_preset
  @default_preset
end

#stagesArray<Highway::Compiler::Analyze::Tree::Stage> (readonly)

Stages in the tree.



51
52
53
# File 'lib/highway/compiler/analyze/tree/root.rb', line 51

def stages
  @stages
end

#stepsArray<Highway::Compiler::Analyze::Tree::Step> (readonly)

Steps in the tree.



46
47
48
# File 'lib/highway/compiler/analyze/tree/root.rb', line 46

def steps
  @steps
end

#variablesArray<Highway::Compiler::Analyze::Tree::Variable> (readonly)

Variables in the tree.



41
42
43
# File 'lib/highway/compiler/analyze/tree/root.rb', line 41

def variables
  @variables
end

Instance Method Details

#add_stage(index:, name:, policy:) ⇒ Void

Add a stage to the tree.



86
87
88
# 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:) ⇒ Void

Add a step to the tree.



74
75
76
# 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:) ⇒ Void

Add a variable to the tree.



60
61
62
# 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