Class: Stupidedi::Parser::StateMachine
Instance Attribute Summary collapse
Instance Method Summary
collapse
#blank, #composite, #default, #not_used, #repeated
Methods included from Generation
#execute, #insert, #read, #update_reader
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.
18
19
20
|
# File 'lib/stupidedi/parser/state_machine.rb', line 18
def initialize(config, active)
@config, @active = config, active
end
|
Instance Attribute Details
#active ⇒ Array<Zipper::AbstractCursor<StateMachine::AbstractState>>
16
17
18
|
# File 'lib/stupidedi/parser/state_machine.rb', line 16
def active
@active
end
|
13
14
15
|
# File 'lib/stupidedi/parser/state_machine.rb', line 13
def config
@config
end
|
Instance Method Details
#copy(changes = {})
22
23
24
25
26
|
# File 'lib/stupidedi/parser/state_machine.rb', line 22
def copy(changes = {})
StateMachine.new \
changes.fetch(:config, @config),
changes.fetch(:active, @active)
end
|
#pretty_print(q)
This method returns an undefined value.
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/stupidedi/parser/state_machine.rb', line 34
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
|
29
30
31
|
# File 'lib/stupidedi/parser/state_machine.rb', line 29
def separators
@active.head.node.separators
end
|