A new instance of Parser.
Returns a new instance of Parser.
2 3 4 5
# File 'lib/hcl/parser.rb', line 2 def initialize(src) @src = src @parslet = HCL::Parslet.new end
7 8 9 10 11 12 13 14 15 16
# File 'lib/hcl/parser.rb', line 7 def parse ast = begin @parslet.parse(@src) rescue Parslet::ParseFailed => error puts error.parse_failure_cause.ascii_tree raise end HCL::Decoder.new.decode(ast) end