Sha256: 5d19ad84f9cb1ed79030fc2d5e5048f20dc4de6bb18aa12835bd5fef1b6c88e2

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

module Minjs
  #
  # 14 Program
  #
  module Program
    def program(lex, context)
      prog = source_elements(@lex, @global_context)
      if lex.eof?
        return prog
      else
        raise ParseError.new("unexpceted token", lex)
      end
    end

    def source_elements(lex, context, options = {})
      prog = []
      while t = source_element(lex, context)
        prog.push(t)
      end
      ECMA262::Prog.new(context, ECMA262::SourceElements.new(prog))
    end

    def source_element(lex, context)
      #lex.eval_lit{
      statement(lex, context)
      #} or lex.eval_lit{ => statement
      #  func_declaration(lex, context)
      #}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minjs-0.3.0 lib/minjs/program.rb