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.



5
6
7
# File 'lib/stupidedi/builder/identifier_stack.rb', line 5

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



37
38
39
# File 'lib/stupidedi/builder/identifier_stack.rb', line 37

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

Instance Method Details

#gsObject



18
19
20
21
# File 'lib/stupidedi/builder/identifier_stack.rb', line 18

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

#hlObject



28
29
30
31
# File 'lib/stupidedi/builder/identifier_stack.rb', line 28

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

#idObject



9
10
11
# File 'lib/stupidedi/builder/identifier_stack.rb', line 9

def id
  @state.id
end

#isaObject



13
14
15
16
# File 'lib/stupidedi/builder/identifier_stack.rb', line 13

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

#popObject



33
34
35
# File 'lib/stupidedi/builder/identifier_stack.rb', line 33

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

#stObject



23
24
25
26
# File 'lib/stupidedi/builder/identifier_stack.rb', line 23

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