module SFRP::Input::Parser
Public Instance Methods
parse(source_file)
click to toggle source
# File lib/sfrp/input/parser.rb, line 9 def parse(source_file) parser = Parser.new transformer = Transformer.new defs = transformer.apply(parser.parse(source_file.content)) imports, others = defs.each_with_object([[], []]) do |a, o| case a when Raw::Import o[0] << a else o[1] << a end end ns = Raw::Namespace.new(source_file.fmodule_uri, imports) others.each do |a| a.ns = ns a.vconsts.each { |b| b.ns = ns } if a.is_a?(Raw::TConst) end others rescue Parslet::ParseFailed => err raise ParseError.new(err.cause.ascii_tree) end