Sha256: eb98055f708bff5f37e6046503aa7720dbd31d8fa640cc569b3884845086698c

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

module Mulang::Ruby
  module SexpParser
    Parser::Builders::Default.emit_lambda = true
    Parser::Builders::Default.emit_procarg0 = true

    def self.parser(ruby_code, parser_class)
      parser = parser_class.new
      parser.diagnostics.consumer = lambda {|it|}
      parser.diagnostics.all_errors_are_fatal = true
      buffer = Parser::Source::Buffer.new('(string)')
      buffer.source = ruby_code
      parser.parse(buffer).tap do |result|
        raise "Syntax error" if result.eql? false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mulang-ruby-6.3.0 lib/mulang/ruby/sexp_parser.rb
mulang-ruby-6.2.0 lib/mulang/ruby/sexp_parser.rb
mulang-ruby-6.1.0 lib/mulang/ruby/sexp_parser.rb