diff --git a/projects/Closure/32/com/google/javascript/jscomp/parsing/JsDocInfoParser.java b/projects/Closure/32/com/google/javascript/jscomp/parsing/JsDocInfoParser.java index f6a6400..cfdccbe 100644 --- a/projects/Closure/32/com/google/javascript/jscomp/parsing/JsDocInfoParser.java +++ b/projects/Closure/32/com/google/javascript/jscomp/parsing/JsDocInfoParser.java @@ -1355,12 +1355,14 @@ private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, // Track the start of the line to count whitespace that // the tokenizer skipped. Because this case is rare, it's easier // to do this here than in the tokenizer. + int lineStartChar = -1; do { switch (token) { case STAR: if (ignoreStar) { // Mark the position after the star as the new start of the line. + lineStartChar = stream.getCharno() + 1; } else { // The star is part of the comment. if (builder.length() > 0) { @@ -1379,6 +1381,7 @@ private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, } ignoreStar = true; + lineStartChar = 0; token = next(); continue; @@ -1386,7 +1389,19 @@ private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, ignoreStar = false; state = State.SEARCHING_ANNOTATION; + boolean isEOC = token == JsDocToken.EOC; + if (!isEOC) { + if (lineStartChar != -1 && option == WhitespaceOption.PRESERVE) { + int numSpaces = stream.getCharno() - lineStartChar; + for (int i = 0; i < numSpaces; i++) { + builder.append(' '); + } + lineStartChar = -1; + } else if (builder.length() > 0) { // All tokens must be separated by a space. + builder.append(' '); + } + } if (token == JsDocToken.EOC || token == JsDocToken.EOF || @@ -1411,9 +1426,6 @@ private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, return new ExtractionInfo(multilineText, token); } - if (builder.length() > 0) { - builder.append(' '); - } builder.append(toString(token)); line = stream.getRemainingJSDocLine();