Sha256: 0221fffd2930540c2c12e3b652bafb91a01497ba75b6a469d2f485dc38a1f126

Contents?: true

Size: 602 Bytes

Versions: 3

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

require "parser/ruby27"

module RubyNext
  module Language
    class Builder < ::Parser::Builders::Default
      modernize
    end

    class << self
      def parser
        ::Parser::Ruby27.new(Builder.new).tap do |prs|
          prs.diagnostics.tap do |diagnostics|
            diagnostics.all_errors_are_fatal = true
          end
        end
      end

      def parse(source, file = "(string)")
        buffer = ::Parser::Source::Buffer.new(file).tap do |buffer|
          buffer.source = source
        end
        parser.parse(buffer)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ruby-next-core-0.4.0 lib/ruby-next/language/parser.rb
ruby-next-0.3.0 lib/ruby-next/language/parser.rb
ruby-next-core-0.3.0 lib/ruby-next/language/parser.rb