Class: Stupidedi::Parser::TransmissionState

Inherits:
AbstractState show all
Defined in:
lib/stupidedi/parser/states/transmission_state.rb

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods inherited from AbstractState

#leaf?, lsequence, mkcomposite, mkelement, mkrepeated, mksegment, mksimple, #pretty_print, sequence, tsequence

Methods included from Inspect

#inspect

Constructor Details

#initialize(separators, segment_dict, instructions, zipper, children) ⇒ TransmissionState

Returns a new instance of TransmissionState.



22
23
24
25
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 22

def initialize(separators, segment_dict, instructions, zipper, children)
  @separators, @segment_dict, @instructions, @zipper, @children =
    separators, segment_dict, instructions, zipper, children
end

Instance Attribute Details

#childrenArray<AbstractState> (readonly)

Returns:



20
21
22
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 20

def children
  @children
end

#instructionsInstructionTable (readonly)

Returns:



14
15
16
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 14

def instructions
  @instructions
end

#segment_dictReader::SegmentDict (readonly)

Returns:



11
12
13
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 11

def segment_dict
  @segment_dict
end

#separatorsReader::Separators (readonly)

Returns:



8
9
10
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 8

def separators
  @separators
end

#zipperZipper::AbstractCursor (readonly)



17
18
19
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 17

def zipper
  @zipper
end

Class Method Details

.push(zipper, parent, segment_tok, segment_use, config) ⇒ Zipper::AbstractCursor



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 43

def push(zipper, parent, segment_tok, segment_use, config)
  zipper = zipper.append_child new(
    parent.separators,
    parent.segment_dict,
    parent.instructions.push([
      Instruction.new(:ISA, nil, 0, 0, InterchangeState)]),
    parent.zipper.dangle.last,
    [])

  InterchangeState.push(zipper, zipper.node, segment_tok, segment_use, config)
end

Instance Method Details

#copy(changes = {}) ⇒ TransmissionState

Returns:



28
29
30
31
32
33
34
35
# File 'lib/stupidedi/parser/states/transmission_state.rb', line 28

def copy(changes = {})
  TransmissionState.new \
    changes.fetch(:separators, @separators),
    changes.fetch(:segment_dict, @segment_dict),
    changes.fetch(:instructions, @instructions),
    changes.fetch(:zipper, @zipper),
    changes.fetch(:children, @children)
end