当前位置: 首页>>代码示例>>Java>>正文


Java CompilerEnvirons.setErrorReporter方法代码示例

本文整理汇总了Java中org.mozilla.javascript.CompilerEnvirons.setErrorReporter方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerEnvirons.setErrorReporter方法的具体用法?Java CompilerEnvirons.setErrorReporter怎么用?Java CompilerEnvirons.setErrorReporter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mozilla.javascript.CompilerEnvirons的用法示例。


在下文中一共展示了CompilerEnvirons.setErrorReporter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.mozilla.javascript.CompilerEnvirons; //导入方法依赖的package包/类
private AstRoot parse(String string, boolean jsdoc) {
    CompilerEnvirons environment = new CompilerEnvirons();

    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(string, null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:18,代码来源:ParserTest.java

示例2: parseAsReader

import org.mozilla.javascript.CompilerEnvirons; //导入方法依赖的package包/类
private AstRoot parseAsReader(String string) throws IOException {
    CompilerEnvirons environment = new CompilerEnvirons();

    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:18,代码来源:ParserTest.java

示例3: scan

import org.mozilla.javascript.CompilerEnvirons; //导入方法依赖的package包/类
/**
 * Scan the given file for class definitions and accumulate dependencies.
 */
private void scan(final File source) throws IOException {
  log.debug("Scanning: " + source);

  ErrorReporter errorReporter = new LogErrorReporter(log);

  CompilerEnvirons env = new CompilerEnvirons();
  env.setErrorReporter(errorReporter);

  Parser parser = new Parser(env, errorReporter);
  Reader reader = new BufferedReader(new FileReader(source));
  try {
    AstRoot root = parser.parse(reader, source.getAbsolutePath(), 0);
    DependencyAccumulator visitor = new DependencyAccumulator(source);
    root.visit(visitor);

    // complain if no def was found in this source
    if (visitor.current == null) {
      log.warn("No class definition was found while processing: " + source);
    }
  }
  finally {
    reader.close();
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:28,代码来源:ClassDefScanner.java

示例4: createCompilerEnvironment

import org.mozilla.javascript.CompilerEnvirons; //导入方法依赖的package包/类
/**
 * Creates options for Rhino based off of the user's preferences.
 *
 * @param errorHandler The container for errors found while parsing.
 * @return The properties for the JS compiler to use.
 */
public static CompilerEnvirons createCompilerEnvironment(ErrorReporter
		errorHandler, JavaScriptLanguageSupport langSupport) {
	CompilerEnvirons env = new CompilerEnvirons();
	env.setErrorReporter(errorHandler);
	env.setIdeMode(true);
	env.setRecordingComments(true);
	env.setRecordingLocalJsDocComments(true);
	env.setRecoverFromErrors(true);
	if(langSupport != null) {
		env.setXmlAvailable(langSupport.isXmlAvailable());
		env.setStrictMode(langSupport.isStrictMode());
		int version = langSupport.getLanguageVersion();
		if (version > 0) {
			Logger.log("[JavaScriptParser]: JS language version set to: " + version);
			env.setLanguageVersion(version);
		}
	}
	return env;
}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:26,代码来源:JavaScriptParser.java


注:本文中的org.mozilla.javascript.CompilerEnvirons.setErrorReporter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。