本文整理汇总了Java中org.mozilla.javascript.CompilerEnvirons.setRecordingLocalJsDocComments方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerEnvirons.setRecordingLocalJsDocComments方法的具体用法?Java CompilerEnvirons.setRecordingLocalJsDocComments怎么用?Java CompilerEnvirons.setRecordingLocalJsDocComments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mozilla.javascript.CompilerEnvirons
的用法示例。
在下文中一共展示了CompilerEnvirons.setRecordingLocalJsDocComments方法的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;
}
示例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;
}
示例3: parseFile
import org.mozilla.javascript.CompilerEnvirons; //导入方法依赖的package包/类
/**
*
* @param fileName
* @param staticMethods
* @param staticFields
* @return
* @throws FileNotFoundException
* @throws IOException
*/
Collection<JsFile> parseFile(final String fileName,
final List<JsMethod> staticMethods,
final Map<String, JsElement> staticFields)
throws FileNotFoundException, IOException {
try (final Reader reader = new FileReader(fileName)) {
final CompilerEnvirons env = new CompilerEnvirons();
env.setRecordingLocalJsDocComments(true);
env.setAllowSharpComments(true);
env.setRecordingComments(true);
final AstRoot node = new Parser(env).parse(reader, fileName, 1);
final JavaScriptFileParser parser = new JavaScriptFileParser(fileName);
node.visitAll(parser);
staticMethods.addAll(parser.getStaticMethods());
staticFields.putAll(parser.getConsts());
return parser.getFiles();
}
}
示例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;
}