Sha256: f2f86b9bbdcdc04a396180232bbf392e8ffd575021747c3868b29cd21a5a27e6
Contents?: true
Size: 990 Bytes
Versions: 11
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true require "parser/rubynext" module RubyNext module Language class Builder < ::Parser::Builders::Default modernize end class << self def parser ::Parser::RubyNext.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) rescue ::Parser::SyntaxError => e raise ::SyntaxError, e.message end def parse_with_comments(source, file = "(string)") buffer = ::Parser::Source::Buffer.new(file).tap do |buffer| buffer.source = source end parser.parse_with_comments(buffer) rescue ::Parser::SyntaxError => e raise ::SyntaxError, e.message end end end end
Version data entries
11 entries across 11 versions & 1 rubygems