/** * Extracts the top-level block comment from the JsDoc comment, if any. * This method differs from the extractMultilineTextualBlock in that it * terminates under different conditions (it doesn't have the same * prechecks), it does not first read in the remaining of the current * line and its conditions for ignoring the "*" (STAR) are different. * * @param token The starting token. * * @return The extraction information. */ private ExtractionInfo extractBlockComment(JsDocToken token) { return extractMultilineComment(token, getWhitespaceOption(WhitespaceOption.TRIM), false, false); }
/** * Extracts the top-level block comment from the JsDoc comment, if any. * This method differs from the extractMultilineTextualBlock in that it * terminates under different conditions (it doesn't have the same * prechecks), it does not first read in the remaining of the current * line and its conditions for ignoring the "*" (STAR) are different. * * @param token The starting token. * * @return The extraction information. */ private ExtractionInfo extractBlockComment(JsDocToken token) { return extractMultilineComment(token, getWhitespaceOption(WhitespaceOption.TRIM), false, false); }
/** * Extracts the text found on the current line and all subsequent until either an annotation, end * of comment or end of file is reached. Note that if this method detects an end of line as the * first token, it will quit immediately (indicating that there is no text where it was expected). * Note that token = info.token; should be called after this method is used to update the token * properly in the parser. * * @param token The start token. * @param option How to handle whitespace. * @param includeAnnotations Whether the extracted text may include annotations. If set to false, * text extraction will stop on the first encountered annotation token. * @return The extraction information. */ private ExtractionInfo extractMultilineTextualBlock( JsDocToken token, WhitespaceOption option, boolean includeAnnotations) { if (token == JsDocToken.EOC || token == JsDocToken.EOL || token == JsDocToken.EOF) { return new ExtractionInfo("", token); } return extractMultilineComment(token, option, true, includeAnnotations); }
/** * Extracts the text found on the current line and all subsequent * until either an annotation, end of comment or end of file is reached. * Note that if this method detects an end of line as the first token, it * will quit immediately (indicating that there is no text where it was * expected). Note that token = info.token; should be called after this * method is used to update the token properly in the parser. * * @param token The start token. * @param option How to handle whitespace. * @param includeAnnotations Whether the extracted text may include * annotations. If set to false, text extraction will stop on the first * encountered annotation token. * * @return The extraction information. */ private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, WhitespaceOption option, boolean includeAnnotations) { if (token == JsDocToken.EOC || token == JsDocToken.EOL || token == JsDocToken.EOF) { return new ExtractionInfo("", token); } return extractMultilineComment(token, option, true, includeAnnotations); }
/** * Important comments begin with /*! They are treated as license blocks, but no further JSDoc * parsing is performed */ void parseImportantComment() { state = State.SEARCHING_ANNOTATION; skipEOLs(); JsDocToken token = next(); ExtractionInfo info = extractMultilineComment(token, WhitespaceOption.PRESERVE, false, true); // An extra space is added by the @license annotation // so we need to add one here so they will be identical String license = " " + info.string; if (fileLevelJsDocBuilder != null) { fileLevelJsDocBuilder.addLicense(license); } else if (jsdocBuilder.shouldParseDocumentation()) { jsdocBuilder.recordBlockDescription(license); } else { jsdocBuilder.recordBlockDescription(""); } }