class Fabricator::Vertical_Peeker::Markup_Parser_Stack

Public Class Methods

new(suppress_modes = 0) click to toggle source
Calls superclass method
# File lib/mau/fabricator.rb, line 536
def initialize suppress_modes = 0
  super()
  push OpenStruct.new(
      content: [],
      mode: Fabricator::MF::DEFAULTS & ~suppress_modes,
      term_type: 0,
    )
  return
end

Public Instance Methods

ennode(node_type, frame_type) click to toggle source
# File lib/mau/fabricator.rb, line 566
def ennode node_type, frame_type
  while self.last.term_type != frame_type do
    self.unspawn
  end
  top = self.pop
  node = OpenStruct.new(
      type: node_type,
      content: top.content,
  )
  self.last.content.push node
  return node # for possible further manipulation
end
spawn(face, start_flag, end_flag) click to toggle source
# File lib/mau/fabricator.rb, line 546
def spawn face, start_flag, end_flag
  self.push OpenStruct.new(
    face: face,
    content: [],
    mode: self.last.mode & ~start_flag | end_flag,
    term_type: end_flag,
  )
  return
end
unspawn() click to toggle source
# File lib/mau/fabricator.rb, line 556
def unspawn
  raise 'assertion failed' unless length >= 2
  top = self.pop
  self.last.content.push OpenStruct.new(
    type: :plain,
    data: top.face,
  ), *top.content
  return
end