Sha256: 89148968f179f9d83a6e4307a8167a4fbf8b8ebc233f260f795a2d6f75ef5ac7
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
module Minjs::Lex # # 14 Program # module Program include Minjs # Tests next literals sequence is Program or not. # # If sequence is Program # return ECMA262::Prog object and # forward lexical parser position. # Otherwise return nil and position is not changed. # # @return [ECMA262::Prog] element # # @see http://www.ecma-international.org/ecma-262 ECMA262 14 def program(context) prog = source_elements(context) if lex.eof? return prog else raise ParseError.new("unexpceted token", lex) end end # Tests next literals sequence is SourceElements or not. # # If sequence is SourceElements # return ECMA262::SourceElements object and # forward lexical parser position. # Otherwise return nil and position is not changed. # # @return [ECMA262::SourceElements] element # # @see http://www.ecma-international.org/ecma-262 ECMA262 14 def source_elements(context) prog = [] while t = source_element(context) prog.push(t) end ECMA262::Prog.new(context, ECMA262::SourceElements.new(prog)) end def source_element(context) #lex.eval_lit{ statement(context) #} or lex.eval_lit{ => statement # func_declaration(context) #} end private :source_element end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
minjs-0.4.0 | lib/minjs/lex/program.rb |