Class: Nodewrap::ByteDecoder::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/bytedecoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_table) ⇒ Environment

Returns a new instance of Environment.



31
32
33
34
35
36
37
# File 'lib/bytedecoder.rb', line 31

def initialize(local_table)
  @stack = []
  @expressions = []
  @local_table = local_table
  @last = nil
  @pc = 0
end

Instance Attribute Details

#expressionsObject (readonly)

Returns the value of attribute expressions.



25
26
27
# File 'lib/bytedecoder.rb', line 25

def expressions
  @expressions
end

#lastObject

Returns the value of attribute last.



27
28
29
# File 'lib/bytedecoder.rb', line 27

def last
  @last
end

#local_tableObject (readonly)

Returns the value of attribute local_table.



26
27
28
# File 'lib/bytedecoder.rb', line 26

def local_table
  @local_table
end

#pcObject

Returns the value of attribute pc.



29
30
31
# File 'lib/bytedecoder.rb', line 29

def pc
  @pc
end

#seqObject (readonly)

Returns the value of attribute seq.



28
29
30
# File 'lib/bytedecoder.rb', line 28

def seq
  @seq
end

#stackObject (readonly)

Returns the value of attribute stack.



24
25
26
# File 'lib/bytedecoder.rb', line 24

def stack
  @stack
end

Instance Method Details

#advance(instruction_length) ⇒ Object



39
40
41
# File 'lib/bytedecoder.rb', line 39

def advance(instruction_length)
  @pc += instruction_length
end

#remember(expression) ⇒ Object



43
44
45
46
47
# File 'lib/bytedecoder.rb', line 43

def remember(expression)
  if not expression.is_a?(Expression::Literal) then
    @expressions << expression
  end
end