public static RubyValue eval(String evalText, RubyBinding binding) {
   RubyCompiler compiler = new RubyCompiler();
   try {
     CompilationResults codes = compiler.compileString(evalText);
     RubyProgram p = codes.getRubyProgram();
     return p.invoke(
         binding.getSelf(), binding.getVariables(), binding.getBlock(), binding.getScope());
   } catch (RecognitionException e) {
     throw new RubyException(RubyRuntime.SyntaxErrorClass, e.toString());
   } catch (TokenStreamException e) {
     throw new RubyException(RubyRuntime.SyntaxErrorClass, e.toString());
   } catch (InstantiationException e) {
     throw new RubyException(e.toString());
   } catch (IllegalAccessException e) {
     throw new RubyException(e.toString());
   }
 }
  @RubyLevelMethod(name = "instance_eval")
  public static RubyValue instanceEval(RubyValue receiver, RubyArray args, RubyBlock block) {
    if (null == args && null == block) {
      throw new RubyException(RubyRuntime.ArgumentErrorClass, "block not supplied");
    }

    if (null != args) {
      RubyBinding binding = new RubyBinding();
      System.out.println(receiver);
      binding.setScope((RubyModule) receiver);
      binding.setSelf(receiver);
      return eval(args.get(0).toStr(), binding);
    } else {
      block.setSelf(receiver);
      return block.invoke(receiver);
    }
  }
 private static RubyValue eval(String evalText, RubyBinding binding, String file_name) {
   RubyCompiler compiler = new RubyCompiler(binding, false);
   try {
     CompilationResults codes = compiler.compileString(file_name, evalText);
     RubyProgram p = codes.getRubyProgram();
     if (null != binding) {
       return p.invoke(
           binding.getSelf(), binding.getVariables(), binding.getBlock(), binding.getScope());
     } else {
       return p.invoke();
     }
   } catch (RecognitionException e) {
     throw new RubyException(RubyRuntime.SyntaxErrorClass, file_name + " " + e.toString());
   } catch (TokenStreamException e) {
     throw new RubyException(RubyRuntime.SyntaxErrorClass, file_name + " " + e.toString());
   } catch (InstantiationException e) {
     throw new RubyException(e.toString());
   } catch (IllegalAccessException e) {
     throw new RubyException(e.toString());
   }
 }