Class: Stupidedi::Parser::IdentifierStack::HL

Inherits:
Object
  • Object
show all
Defined in:
lib/stupidedi/parser/identifier_stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, hl_sequence, lx_sequence) ⇒ HL

Returns a new instance of HL.



213
214
215
216
# File 'lib/stupidedi/parser/identifier_stack.rb', line 213

def initialize(parent, hl_sequence, lx_sequence)
  @parent, @id, @hl_sequence, @lx_sequence =
    parent, hl_sequence.value, hl_sequence, lx_sequence
end

Instance Attribute Details

#id (readonly)

Returns the value of attribute id.



211
212
213
# File 'lib/stupidedi/parser/identifier_stack.rb', line 211

def id
  @id
end

Instance Method Details

#hl



218
219
220
# File 'lib/stupidedi/parser/identifier_stack.rb', line 218

def hl
  HL.new(self, @hl_sequence.succ!, @lx_sequence)
end

#lx



222
223
224
# File 'lib/stupidedi/parser/identifier_stack.rb', line 222

def lx
  @lx_sequence.succ!.value
end

#parent_hlInteger

Parent HL number (HL02)

Returns:

  • (Integer)


229
230
231
232
233
234
235
# File 'lib/stupidedi/parser/identifier_stack.rb', line 229

def parent_hl
  if @parent.is_a?(HL)
    @parent.id
  else
    raise RuntimeError, "this HL*#{@id} does not have a parent HL"
  end
end

#pop



241
242
243
244
# File 'lib/stupidedi/parser/identifier_stack.rb', line 241

def pop
  warn "DEPRECATION WARNING: IdentifierStack#pop is deprecated, use pop_ht (when removing an HL identifier from the stack)"
  pop_hl
end

#pop_hl



237
238
239
# File 'lib/stupidedi/parser/identifier_stack.rb', line 237

def pop_hl
  @parent
end