Module: Johnson::Parser
- Defined in:
- lib/johnson/parser.rb,
lib/johnson/parser/syntax_error.rb
Defined Under Namespace
Classes: SyntaxError
Class Method Summary collapse
- .parse(js, filename = nil, linenum = nil) ⇒ Object
- .parse_io(js, filename = nil, linenum = nil) ⇒ Object
Class Method Details
.parse(js, filename = nil, linenum = nil) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/johnson/parser.rb', line 7 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
16 17 18 |
# File 'lib/johnson/parser.rb', line 16 def parse_io(js, filename = nil, linenum = nil) Johnson::SpiderMonkey::ImmutableNode.parse_io(js, filename, linenum) end |