本文整理汇总了Java中com.google.javascript.rhino.Node.FileLevelJsDocBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java Node.FileLevelJsDocBuilder方法的具体用法?Java Node.FileLevelJsDocBuilder怎么用?Java Node.FileLevelJsDocBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.Node
的用法示例。
在下文中一共展示了Node.FileLevelJsDocBuilder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJsDocInfoParser
import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
* Creates a JsDocInfoParser and parses the JsDoc string.
*
* Used both for handling individual JSDoc comments and for handling
* file-level JSDoc comments (@fileoverview and @license).
*
* @param comment The JsDoc comment to parse.
* @param lineno The line number of the node this comment is attached to.
* @param fileLevelJsDocBuilder The builder for file-level JSDocInfo.
* @param fileOverviewInfo The current @fileoverview JSDocInfo, so that the
* parser may warn if another @fileoverview is found. May be null.
* @return A JSDocInfoParser. Will contain either fileoverview jsdoc, or
* normal jsdoc, or no jsdoc (if the method parses to the wrong level).
*/
private JsDocInfoParser createJsDocInfoParser(
String comment, int lineno, int position,
Node.FileLevelJsDocBuilder fileLevelJsDocBuilder,
JSDocInfo fileOverviewInfo) {
// The JsDocInfoParser expects the comment without the initial '/**'.
int numOpeningChars = 3;
JsDocInfoParser jsdocParser =
new JsDocInfoParser(
new JsDocTokenStream(comment.substring(numOpeningChars),
lineno,
position2charno(position) + numOpeningChars),
sourceName,
config,
errorReporter);
jsdocParser.setFileLevelJsDocBuilder(fileLevelJsDocBuilder);
jsdocParser.setFileOverviewJSDocInfo(fileOverviewInfo);
jsdocParser.parse();
return jsdocParser;
}
示例2: transformTree
import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
public static Node transformTree(AstRoot node,
String sourceString,
Config config,
ErrorReporter errorReporter) {
IRFactory irFactory = new IRFactory(sourceString, node.getSourceName(),
config, errorReporter);
Node irNode = irFactory.transform(node);
// @license text gets appended onto the fileLevelJsDocBuilder as found,
// and stored straight into the JSDocInfo for the root node.
Node.FileLevelJsDocBuilder fileLevelJsDocBuilder =
irNode.getJsDocBuilderForNode();
// fileOverviewInfo stores the last bit of fileoverview data we saw.
// We only permit one, so throwing away extras is fair.
// The fileOverviewInfo gets passed into parseJSDocInfo so that
// it can detect when multiple @fileoverviews exist in the same file.
JSDocInfo fileOverviewInfo = null;
if (node.getComments() != null) {
for (Comment comment : node.getComments()) {
if (comment.getCommentType() == JSDOC) {
JsDocInfoParser jsDocParser =
irFactory.createJsDocInfoParser(comment.getValue(),
comment.getLineno(), comment.getAbsolutePosition(),
fileLevelJsDocBuilder, fileOverviewInfo);
if (jsDocParser.getFileOverviewJSDocInfo() != fileOverviewInfo) {
fileOverviewInfo = jsDocParser.getFileOverviewJSDocInfo();
} else {
JSDocInfo info = jsDocParser.retrieveAndResetParsedJSDocInfo();
if (info != null) {
irFactory.attachJsDoc(comment, info);
}
}
}
}
// Only after we've seen all @fileoverview entries, attach the
// last one to the root node, and copy the found license strings
// to that node.
if (fileOverviewInfo != null) {
if ((irNode.getJSDocInfo() != null) &&
(irNode.getJSDocInfo().getLicense() != null)) {
fileOverviewInfo.setLicense(irNode.getJSDocInfo().getLicense());
}
irNode.setJSDocInfo(fileOverviewInfo);
}
}
return irNode;
}
示例3: setFileLevelJsDocBuilder
import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
* Sets the JsDocBuilder for the file-level (root) node of this parse. The
* parser uses the builder to append any preserve annotations it encounters
* in jsdoc comments.
*
* @param fileLevelJsDocBuilder
*/
void setFileLevelJsDocBuilder(
Node.FileLevelJsDocBuilder fileLevelJsDocBuilder) {
this.fileLevelJsDocBuilder = fileLevelJsDocBuilder;
}