org.jruby.Ruby.parseFile()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.jruby.Ruby.parseFile方法的一些代码示例,展示了Ruby.parseFile的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.parseFile方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:parseFile

Ruby.parseFile介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

public Node parseFile(InputStream in, String file, DynamicScope scope) {
  return parseFile(in, file, scope, 0);
}

代码示例来源:origin: org.jruby/jruby-complete

public ParseResult parseFile(String file, InputStream in, DynamicScope scope) {
  return parseFile(file, in, scope, 0);
}

代码示例来源:origin: org.jruby/jruby-core

public Node parseFile(InputStream in, String file, DynamicScope scope) {
  return parseFile(in, file, scope, 0);
}

代码示例来源:origin: org.jruby/jruby-core

public ParseResult parseFile(String file, InputStream in, DynamicScope scope) {
  return parseFile(file, in, scope, 0);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public Node parseFile(InputStream in, String file, DynamicScope scope) {
  return parseFile(in, file, scope, 0);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public Node parseFile(InputStream in, String file, DynamicScope scope) {
  return parseFile(in, file, scope, 0);
}

代码示例来源:origin: org.jruby/jruby-complete

private Node parse(ThreadContext context, FileResource file, String fileName) throws IOException {
    try (InputStream stream = file.openInputStream()) {
      return context.runtime.parseFile(stream, fileName, null, 0);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-complete

/**
   * Parse the script and return an object which can be run().  This allows the script
   * to be parsed once and evaluated many times.
   * @param runtime to parse the script under
   * @param in the script as an inputstream to be parsed
   * @param filename the filename to display for parse errors and backtraces
   * @param lineNumber the linenumber to display for parse errors and backtraces
   * @return an object which can be run
   */
  public EvalUnit parse(Ruby runtime, InputStream in, String filename, int lineNumber) {
    return new InterpretedEvalUnit(runtime, runtime.parseFile(in, filename, null, lineNumber));
  }
};

代码示例来源:origin: org.jruby/jruby-core

private Node parse(ThreadContext context, FileResource file, String fileName) throws IOException {
    try (InputStream stream = file.openInputStream()) {
      return context.runtime.parseFile(stream, fileName, null, 0);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-core

/**
   * Parse the script and return an object which can be run().  This allows the script
   * to be parsed once and evaluated many times.
   * @param runtime to parse the script under
   * @param in the script as an inputstream to be parsed
   * @param filename the filename to display for parse errors and backtraces
   * @param lineNumber the linenumber to display for parse errors and backtraces
   * @return an object which can be run
   */
  public EvalUnit parse(Ruby runtime, InputStream in, String filename, int lineNumber) {
    return new InterpretedEvalUnit(runtime, runtime.parseFile(in, filename, null, lineNumber));
  }
};

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
   * Parse the script and return an object which can be run().  This allows the script
   * to be parsed once and evaluated many times.
   * @param runtime to parse the script under
   * @param in the script as an inputstream to be parsed
   * @param filename the filename to display for parse errors and backtraces
   * @param lineNumber the linenumber to display for parse errors and backtraces
   * @return an object which can be run
   */
  public EvalUnit parse(Ruby runtime, InputStream in, String filename, int lineNumber) {
    return new InterpretedEvalUnit(runtime, runtime.parseFile(in, filename, null, lineNumber));
  }
};

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
   * Parse the script and return an object which can be run().  This allows the script
   * to be parsed once and evaluated many times.
   * @param runtime to parse the script under
   * @param in the script as an inputstream to be parsed
   * @param filename the filename to display for parse errors and backtraces
   * @param lineNumber the linenumber to display for parse errors and backtraces
   * @return an object which can be run
   */
  public EvalUnit parse(Ruby runtime, InputStream in, String filename, int lineNumber) {
    return new InterpretedEvalUnit(runtime, runtime.parseFile(in, filename, null, lineNumber));
  }
};

代码示例来源:origin: org.jruby/jruby-core

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(scriptName, in, null);
    // toss an anonymous module into the search path
    if (wrap) wrapWithModule((RubyBasicObject) self, parseResult);
    runInterpreter(context, parseResult, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(scriptName, in, null);
    // toss an anonymous module into the search path
    if (wrap) wrapWithModule((RubyBasicObject) self, parseResult);
    runInterpreter(context, parseResult, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

parseResult = context.runtime.parseFile(stream, filename, scope, lineno);

代码示例来源:origin: org.jruby/jruby-core

parseResult = context.runtime.parseFile(stream, filename, scope, lineno);

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  
  try {
    ThreadContext.pushBacktrace(context, "(root)", file, 0);
    context.preNodeEval(objectClass, self, scriptName);
    Node node = parseFile(in, scriptName, null);
    if (wrap) {
      // toss an anonymous module into the search path
      ((RootNode)node).getStaticScope().setModule(RubyModule.newModule(this));
    }
    runInterpreter(context, node, self);
  } catch (JumpException.ReturnJump rj) {
    return;
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  
  try {
    ThreadContext.pushBacktrace(context, "(root)", file, 0);
    context.preNodeEval(objectClass, self, scriptName);
    Node node = parseFile(in, scriptName, null);
    if (wrap) {
      // toss an anonymous module into the search path
      ((RootNode)node).getStaticScope().setModule(RubyModule.newModule(this));
    }
    runInterpreter(context, node, self);
  } catch (JumpException.ReturnJump rj) {
    return;
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public void compileAndLoadFile(String filename, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  InputStream readStream = in;
  String oldFile = context.getFile();
  int oldLine = context.getLine();
  try {
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(filename, in, null);
    RootNode root = (RootNode) parseResult;
    if (wrap) {
      wrapWithModule((RubyBasicObject) self, root);
    } else {
      root.getStaticScope().setModule(getObject());
    }
    runNormally(root, wrap);
  } finally {
    context.postNodeEval();
  }
}

代码示例来源:origin: org.jruby/jruby-core

public void compileAndLoadFile(String filename, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  InputStream readStream = in;
  String oldFile = context.getFile();
  int oldLine = context.getLine();
  try {
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(filename, in, null);
    RootNode root = (RootNode) parseResult;
    if (wrap) {
      wrapWithModule((RubyBasicObject) self, root);
    } else {
      root.getStaticScope().setModule(getObject());
    }
    runNormally(root, wrap);
  } finally {
    context.postNodeEval();
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法