|
Lines 1897-1905
Link Here
|
| 1897 |
CommentFormatterUtil.log(e); |
1897 |
CommentFormatterUtil.log(e); |
| 1898 |
return; |
1898 |
return; |
| 1899 |
} |
1899 |
} |
| 1900 |
int prefixOffset= inputBuffer.indexOf(contentPrefix, lineOffset); |
1900 |
int prefixOffset = inputBuffer.indexOf(contentPrefix, lineOffset); |
| 1901 |
if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) |
1901 |
if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) { |
| 1902 |
inputBuffer.delete(lineOffset, prefixOffset + 1 + 1); |
1902 |
int offsetEnd = prefixOffset + 1; |
|
|
1903 |
char ch = inputBuffer.charAt(offsetEnd); |
| 1904 |
switch (ch) { |
| 1905 |
case '\n': |
| 1906 |
case '\r': |
| 1907 |
break; |
| 1908 |
case ' ': |
| 1909 |
case '\t': |
| 1910 |
case '\u000c' : /* FORM FEED */ |
| 1911 |
offsetEnd++; |
| 1912 |
break; |
| 1913 |
default: |
| 1914 |
if (ScannerHelper.isWhitespace(ch)) { |
| 1915 |
offsetEnd++; |
| 1916 |
} |
| 1917 |
break; |
| 1918 |
} |
| 1919 |
inputBuffer.delete(lineOffset, offsetEnd); |
| 1920 |
} |
| 1903 |
} |
1921 |
} |
| 1904 |
|
1922 |
|
| 1905 |
// 2 - convert HTML to Java (@see JavaDocRegion#convertHtml2Java) |
1923 |
// 2 - convert HTML to Java (@see JavaDocRegion#convertHtml2Java) |
|
Lines 3335-3352
Link Here
|
| 3335 |
// Count the lines until the exact start position of the code |
3353 |
// Count the lines until the exact start position of the code |
| 3336 |
this.scanner.resetTo(end+1, nextStart-1); |
3354 |
this.scanner.resetTo(end+1, nextStart-1); |
| 3337 |
int newLines = 0; |
3355 |
int newLines = 0; |
|
|
3356 |
int realEnd = nextStart; |
| 3357 |
boolean spaceFound = true; |
| 3338 |
try { |
3358 |
try { |
| 3339 |
int token = this.scanner.getNextToken(); |
3359 |
int token = this.scanner.getNextToken(); |
| 3340 |
loop: while (true) { |
3360 |
loop: while (true) { |
| 3341 |
switch (token) { |
3361 |
switch (token) { |
| 3342 |
case TerminalTokens.TokenNameWHITESPACE: |
3362 |
case TerminalTokens.TokenNameWHITESPACE: |
| 3343 |
if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) < 0) { |
3363 |
if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) < 0) { |
|
|
3364 |
if (realEnd != nextStart) |
| 3365 |
realEnd++; |
| 3366 |
spaceFound = true; |
| 3344 |
break loop; |
3367 |
break loop; |
| 3345 |
} |
3368 |
} |
| 3346 |
newLines++; |
3369 |
newLines++; |
| 3347 |
break; |
3370 |
break; |
| 3348 |
case TerminalTokens.TokenNameMULTIPLY: |
3371 |
case TerminalTokens.TokenNameMULTIPLY: |
| 3349 |
nextStart = this.scanner.currentPosition + 1; |
3372 |
realEnd = this.scanner.currentPosition; |
|
|
3373 |
spaceFound = false; |
| 3350 |
break; |
3374 |
break; |
| 3351 |
default: |
3375 |
default: |
| 3352 |
break loop; |
3376 |
break loop; |
|
Lines 3358-3364
Link Here
|
| 3358 |
// skip |
3382 |
// skip |
| 3359 |
} |
3383 |
} |
| 3360 |
if (newLines == 0) newLines=1; |
3384 |
if (newLines == 0) newLines=1; |
| 3361 |
printJavadocGapLines(end+1, nextStart-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); |
3385 |
printJavadocGapLines(end+1, realEnd-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); |
|
|
3386 |
if (realEnd < nextStart) |
| 3387 |
nextStart = realEnd; |
| 3388 |
if (spaceFound == false) |
| 3389 |
addInsertEdit(realEnd, " "); //$NON-NLS-1$ |
| 3362 |
printCodeSnippet(nextStart, codeEnd); |
3390 |
printCodeSnippet(nextStart, codeEnd); |
| 3363 |
nextStart = (int) text.separators[max]; |
3391 |
nextStart = (int) text.separators[max]; |
| 3364 |
printJavadocGapLines(codeEnd+1, nextStart-1, 1, false/* clear blank lines inside <pre> tag as done by old formatter */, false, null); |
3392 |
printJavadocGapLines(codeEnd+1, nextStart-1, 1, false/* clear blank lines inside <pre> tag as done by old formatter */, false, null); |