class EleetScript::NamespaceContext

Attributes

global_vars[R]

Public Instance Methods

add_namespace(name, value) click to toggle source
# File lib/lang/runtime/context.rb, line 163
def add_namespace(name, value)
  @namespaces[name] = value
end
es_nil() click to toggle source
# File lib/lang/runtime/context.rb, line 175
def es_nil
  @root_ns["nil"]
end
namespace(name) click to toggle source
# File lib/lang/runtime/context.rb, line 155
def namespace(name)
  ns = @namespaces[name]
  if ns.nil? && @parent_context
    ns = @parent_context.namespaces[ns]
  end
  ns
end
namespace_context() click to toggle source
# File lib/lang/runtime/context.rb, line 183
def namespace_context
  self
end
new_class_context(current_self, current_class = nil) click to toggle source
# File lib/lang/runtime/context.rb, line 187
def new_class_context(current_self, current_class = nil)
  ctx = ClassContext.new(current_self, current_class)
  ctx.parent_context = self
  ctx
end
new_namespace_context() click to toggle source
# File lib/lang/runtime/context.rb, line 193
def new_namespace_context
  ctx = NamespaceContext.new(nil, nil, @root_ns)
  ctx.current_self = @root_ns["Object"].new(ctx)
  ctx.current_class = current_self.runtime_class
  ctx.parent_context = self
  ctx
end
root_ns() click to toggle source
# File lib/lang/runtime/context.rb, line 179
def root_ns
  @root_ns
end

Private Instance Methods

init_namespace(root = nil) click to toggle source
# File lib/lang/runtime/context.rb, line 203
def init_namespace(root = nil)
  if root.nil?
    @root_ns = self
    @global_vars = ProcessedKeyHash.new
    @global_vars.set_key_preprocessor do |key|
      key[0] == "$" ? key[1..-1] : key
    end
  else
    @root_ns = root
  end
end