Class: Stupidedi::Builder::IdentifierStack

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

Defined Under Namespace

Classes: Empty, GS, HL, ISA, ST

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ IdentifierStack

Returns a new instance of IdentifierStack.



7
8
9
# File 'lib/stupidedi/builder/identifier_stack.rb', line 7

def initialize(id)
  @state = Empty.new(id)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



39
40
41
# File 'lib/stupidedi/builder/identifier_stack.rb', line 39

def method_missing(name, *args)
  @state.__send__(name, *args)
end

Instance Method Details

#gsObject



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

def gs
  @state = @state.gs
  @state.id
end

#hlObject



30
31
32
33
# File 'lib/stupidedi/builder/identifier_stack.rb', line 30

def hl
  @state = @state.hl
  @state.id
end

#idObject



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

def id
  @state.id
end

#isaObject



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

def isa
  @state = @state.isa
  @state.id
end

#popObject



35
36
37
# File 'lib/stupidedi/builder/identifier_stack.rb', line 35

def pop
  @state.id.tap { @state = @state.pop }
end

#stObject



25
26
27
28
# File 'lib/stupidedi/builder/identifier_stack.rb', line 25

def st
  @state = @state.st
  @state.id
end