Sha256: 609bd077950538acd95bf84eeebf63dfdf78e3a6f6de519db90de89820e0808e

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

module RubyAST
  module J
    jar_path = File.expand_path(File.dirname(__FILE__) + '/../../jar/jrubyparser-0.2.jar')

    if defined?(JRUBY_VERSION)
      require 'java'
      require jar_path

      java_import java.io.StringReader
      java_import java.io.StringWriter
      java_import org.jrubyparser.parser.ParserConfiguration
      java_import org.jrubyparser.Parser
      java_import org.jrubyparser.rewriter.ReWriteVisitor
      java_import org.jrubyparser.CompatVersion

      ::SyntaxException = org.jrubyparser.lexer.SyntaxException
    else
      require 'rjb'
      Rjb::load(jar_path, [])

      StringReader = Rjb::import('java.io.StringReader')
      StringWriter = Rjb::import('java.io.StringWriter')
      ParserConfiguration = Rjb::import('org.jrubyparser.parser.ParserConfiguration')
      Parser = Rjb::import('org.jrubyparser.Parser')
      ReWriteVisitor = Rjb::import('org.jrubyparser.rewriter.ReWriteVisitor')
      CompatVersion = Rjb::import('org.jrubyparser.CompatVersion')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyast-0.0.2 lib/rubyast/include_jrubyparser.rb
rubyast-0.0.1 lib/rubyast/include_jrubyparser.rb