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.



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

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



41
42
43
# File 'lib/stupidedi/builder/identifier_stack.rb', line 41

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

Instance Method Details

#gsObject



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

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

#hlObject



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

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

#idObject



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

def id
  @state.id
end

#isaObject



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

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

#popObject



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

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

#stObject



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

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