Parent

Class Index [+]

Quicksearch

RKelly::Runtime

Constants

UNDEFINED
(Not documented)

Public Class Methods

new() click to toggle source

(Not documented)

# File lib/rkelly/runtime.rb, line 8
    def initialize
      @parser = Parser.new
      @scope  = ScopeChain.new
    end

Public Instance Methods

call_function(function_name, *args) click to toggle source

(Not documented)

# File lib/rkelly/runtime.rb, line 23
    def call_function(function_name, *args)
      function = @scope[function_name].value
      @scope.new_scope { |chain|
        function.js_call(chain, *(args.map { |x|
          RKelly::JS::Property.new(:param, x)
        }))
      }.value
    end
define_function(function, &block) click to toggle source

(Not documented)

# File lib/rkelly/runtime.rb, line 32
    def define_function(function, &block)
      @scope[function.to_s].function = block
    end
execute(js) click to toggle source

Execute js

# File lib/rkelly/runtime.rb, line 14
    def execute(js)
      function_visitor  = Visitors::FunctionVisitor.new(@scope)
      eval_visitor      = Visitors::EvaluationVisitor.new(@scope)
      tree = @parser.parse(js)
      function_visitor.accept(tree)
      eval_visitor.accept(tree)
      @scope
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.