lib/fig/parser.rb in fig18-0.1.39 vs lib/fig/parser.rb in fig18-0.1.40
- old
+ new
@@ -1,27 +1,24 @@
require 'polyglot'
require 'treetop'
require 'fig/grammar'
+require 'fig/logging'
+require 'fig/packageerror'
module Fig
class Parser
def initialize
@parser = FigParser.new
end
def parse_package(package_name, version_name, directory, input)
input = input.gsub(/#.*$/, '')
result = @parser.parse(" #{input} ")
- if result.nil?
- $stderr.puts "#{directory}: #{@parser.failure_reason}"
- exit 10
+ if result.nil?
+ Fig::Logging.fatal "#{directory}: #{@parser.failure_reason}"
+ raise PackageError.new
end
result.to_package(package_name, version_name, directory)
end
-
-# def parse_descriptor(descriptor)
-# puts @parser.methods.sort
-# end
end
-
end