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

- (StateMachine) initialize(config, active)

Returns a new instance of StateMachine



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

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

Instance Attribute Details

- (Array<Zipper::AbstractCursor>) active (readonly)



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

def active
  @active
end

- (Config) config (readonly)

Returns:



11
12
13
# File 'lib/stupidedi/builder/state_machine.rb', line 11

def config
  @config
end

Class Method Details

+ (StateMachine) build(config)

Returns:



46
47
48
# File 'lib/stupidedi/builder/state_machine.rb', line 46

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

Instance Method Details

- pretty_print(q)

This method returns an undefined value.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/stupidedi/builder/state_machine.rb', line 26

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

- (Reader::Separators) separators

Returns:



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

def separators
  @active.head.node.separators
end