Module: Johnson::Parser

Defined in:
lib/johnson/parser.rb,
lib/johnson/parser/syntax_error.rb

Defined Under Namespace

Classes: SyntaxError

Class Method Summary collapse

Class Method Details

.parse(js, filename = nil, linenum = nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/johnson/parser.rb', line 8

def parse(js, filename = nil, linenum = nil)
  tree = if js.is_a?(String)
    parse_io(StringIO.new(js), filename, linenum)
  else
    parse_io(js, filename, linenum)
  end
  tree.to_mutable_tree
end

.parse_io(js, filename = nil, linenum = nil) ⇒ Object



17
18
19
# File 'lib/johnson/parser.rb', line 17

def parse_io(js, filename = nil, linenum = nil)
  Johnson::Runtime.send(:default).parse_io(js, filename, linenum)
end