Sha256: 6ce2d41be3e850e5da317fb595a0f6aea27adeadb0fdf2c3fdf800e2bd570c7b

Contents?: true

Size: 563 Bytes

Versions: 6

Compression:

Stored size: 563 Bytes

Contents

require 'treetop'
require 'grammar'

module ParseAChangelog
  class ParseError < StandardError; end

  class << self
    def parse(file_path)
      file = File.read(file_path)
      parser = KeepAChangelogParser.new
      result = parser.parse(file)

      unless result
        raise parser_error(
                parser.failure_line, parser.failure_column, parser.failure_reason
              )
      end
      
      result
    end

    def parser_error(line, column, reason)
      ParseError.new("line #{line}, column #{column}: #{reason}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
parse_a_changelog-1.3.3 lib/parse_a_changelog.rb
parse_a_changelog-1.3.2 lib/parse_a_changelog.rb
parse_a_changelog-1.3.1 lib/parse_a_changelog.rb
parse_a_changelog-1.3.0 lib/parse_a_changelog.rb
parse_a_changelog-1.2.0 lib/parse_a_changelog.rb
parse_a_changelog-1.1.0 lib/parse_a_changelog.rb