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



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)



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

#gs



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

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

#hl



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

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

#id



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

def id
  @state.id
end

#isa



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

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

#pop



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

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

#st



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

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