Class: Stupidedi::Builder::StateMachine

Inherits:
Object
  • Object
show all
Includes:
Generation, Navigation, Tokenization, Inspect
Defined in:
lib/stupidedi/builder/state_machine.rb

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods included from Tokenization

#blank, #composite, #default, #not_used, #repeated

Methods included from Generation

#insert, #read, #remove, #replace

Methods included from Navigation

#count, #count!, #deterministic?, #distance, #element, #elementn, #empty?, #find, #find!, #first, #first?, #iterate, #last, #last?, #next, #parent, #prev, #segment, #segmentn, #sequence, #successors, #zipper

Methods included from Inspect

#inspect

Constructor Details

#initialize(config, active) ⇒ StateMachine

Returns a new instance of StateMachine.



20
21
22
# File 'lib/stupidedi/builder/state_machine.rb', line 20

def initialize(config, active)
  @config, @active = config, active
end

Instance Attribute Details

#activeArray<Zipper::AbstractCursor> (readonly)

Returns:



18
19
20
# File 'lib/stupidedi/builder/state_machine.rb', line 18

def active
  @active
end

#configConfig (readonly)

Returns:



15
16
17
# File 'lib/stupidedi/builder/state_machine.rb', line 15

def config
  @config
end

Class Method Details

.build(config) ⇒ StateMachine

Returns:



50
51
52
# File 'lib/stupidedi/builder/state_machine.rb', line 50

def build(config)
  StateMachine.new(config, InitialState.start.cons)
end

Instance Method Details

#pretty_print(q) ⇒ void

This method returns an undefined value.



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/stupidedi/builder/state_machine.rb', line 30

def pretty_print(q)
  q.text "StateMachine[#{@active.length}]"
  q.group 2, "(", ")" do
    q.breakable ""
    @active.each do |s|
      unless q.current_group.first?
        q.text ","
        q.breakable
      end
      q.pp s.node.zipper.node
    end
  end
end

#separatorsReader::Separators

Returns:



25
26
27
# File 'lib/stupidedi/builder/state_machine.rb', line 25

def separators
  @active.head.node.separators
end