return parse(comment, parseDocumentation, false, warnings);
}
private JSDocInfo parse(String comment, boolean parseDocumentation,
boolean parseFileOverview, String... warnings) {
TestErrorReporter errorReporter = new TestErrorReporter(null, warnings);
Config config = new Config(extraAnnotations, extraSuppressions,
parseDocumentation, LanguageMode.ECMASCRIPT3, false);
StaticSourceFile file = new SimpleSourceFile("testcode", false);
Node associatedNode = new Node(Token.SCRIPT);
associatedNode.setInputId(new InputId(file.getName()));
associatedNode.setStaticSourceFile(file);
JsDocInfoParser jsdocParser = new JsDocInfoParser(
stream(comment),
comment,
0,
associatedNode,
file,
config,
errorReporter);
if (fileLevelJsDocBuilder != null) {
jsdocParser.setFileLevelJsDocBuilder(fileLevelJsDocBuilder);
}
jsdocParser.parse();
assertTrue("expected warnings were not reported",
errorReporter.hasEncounteredAllWarnings());
if (parseFileOverview) {
return jsdocParser.getFileOverviewJSDocInfo();
} else {
return jsdocParser.retrieveAndResetParsedJSDocInfo();