|
Link Here
|
| 1158 |
if (currentError.length>0 && currentError[0] == '"') { |
1158 |
if (currentError.length>0 && currentError[0] == '"') { |
| 1159 |
if (this.reportProblems) { |
1159 |
if (this.reportProblems) { |
| 1160 |
boolean isUrlRef = false; |
1160 |
boolean isUrlRef = false; |
| 1161 |
if (this.tagValue == TAG_SEE_VALUE) { |
1161 |
if (this.tagValue == TAG_SEE_VALUE || this.tagValue == TAG_LINK_VALUE) { |
| 1162 |
int length=currentError.length, i=1 /* first char is " */; |
1162 |
int length=currentError.length, i=1 /* first char is " */; |
| 1163 |
while (i<length && ScannerHelper.isLetter(currentError[i])) { |
1163 |
while (i<length && ScannerHelper.isLetter(currentError[i])) { |
| 1164 |
i++; |
1164 |
i++; |
|
Link Here
|
| 1433 |
return c; |
1433 |
return c; |
| 1434 |
} |
1434 |
} |
| 1435 |
|
1435 |
|
|
|
1436 |
protected int scanJavadocString() throws InvalidInputException { |
| 1437 |
int startPosition = this.index; |
| 1438 |
boolean possibleNextTag = false; |
| 1439 |
boolean seekAhead = true; |
| 1440 |
int endOfToken = -1; |
| 1441 |
try { |
| 1442 |
while (seekAhead) { |
| 1443 |
|
| 1444 |
if (this.index >= this.javadocTextEnd) { |
| 1445 |
if (endOfToken != -1) { |
| 1446 |
this.index = endOfToken; |
| 1447 |
} |
| 1448 |
throw new InvalidInputException(Scanner.UNTERMINATED_STRING); |
| 1449 |
} |
| 1450 |
char currentChar = readChar(); |
| 1451 |
|
| 1452 |
switch(currentChar) { |
| 1453 |
case '@': |
| 1454 |
if (possibleNextTag) { |
| 1455 |
this.index = endOfToken; |
| 1456 |
throw new InvalidInputException(Scanner.UNTERMINATED_STRING); |
| 1457 |
} |
| 1458 |
break; |
| 1459 |
case '}': |
| 1460 |
case '{': |
| 1461 |
if (this.inlineTagStarted) { |
| 1462 |
throw new InvalidInputException(Scanner.UNTERMINATED_STRING); |
| 1463 |
} |
| 1464 |
break; |
| 1465 |
case '*': |
| 1466 |
break; |
| 1467 |
case '\n': |
| 1468 |
case '\r': |
| 1469 |
if (!possibleNextTag) { |
| 1470 |
endOfToken = this.index -1; |
| 1471 |
possibleNextTag = true; |
| 1472 |
} |
| 1473 |
break; |
| 1474 |
case '"': |
| 1475 |
seekAhead = false; |
| 1476 |
break; |
| 1477 |
case '\\': |
| 1478 |
if (this.index >= this.javadocTextEnd) { |
| 1479 |
throw new InvalidInputException(Scanner.UNTERMINATED_STRING); |
| 1480 |
} |
| 1481 |
// We need to call scanner.getNextChar because the scanner.scanEscapeCharacter expects the character |
| 1482 |
// after the '\\' as the currentCharacter. |
| 1483 |
this.scanner.currentPosition = this.index; |
| 1484 |
this.scanner.getNextChar(); |
| 1485 |
this.scanner.scanEscapeCharacter(); |
| 1486 |
this.index = this.scanner.currentPosition; |
| 1487 |
break; |
| 1488 |
default: |
| 1489 |
if (!ScannerHelper.isWhitespace(currentChar)) { |
| 1490 |
possibleNextTag = false; |
| 1491 |
} |
| 1492 |
break; |
| 1493 |
} |
| 1494 |
} |
| 1495 |
} catch (InvalidInputException invalidInput) { |
| 1496 |
if (invalidInput.getMessage().equals(Scanner.INVALID_ESCAPE)) { |
| 1497 |
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed |
| 1498 |
for (int lookAhead = 0; lookAhead < 50; lookAhead++) { |
| 1499 |
if (this.index + lookAhead == this.javadocTextEnd) |
| 1500 |
break; |
| 1501 |
if (this.source[this.index + lookAhead] == '\n') |
| 1502 |
break; |
| 1503 |
if (this.source[this.index + lookAhead] == '\"') { |
| 1504 |
this.index += lookAhead + 1; |
| 1505 |
break; |
| 1506 |
} |
| 1507 |
} |
| 1508 |
} |
| 1509 |
this.scanner.currentPosition = this.index; |
| 1510 |
this.index = startPosition; |
| 1511 |
throw invalidInput; |
| 1512 |
} |
| 1513 |
this.scanner.resetTo(this.index, this.javadocEnd); |
| 1514 |
return TerminalTokens.TokenNameStringLiteral; |
| 1515 |
} |
| 1516 |
|
| 1436 |
/* |
1517 |
/* |
| 1437 |
* Read token only if previous was consumed |
1518 |
* Read token only if previous was consumed |
| 1438 |
*/ |
1519 |
*/ |
| 1439 |
protected int readToken() throws InvalidInputException { |
1520 |
protected int readToken() throws InvalidInputException { |
| 1440 |
if (this.currentTokenType < 0) { |
1521 |
if (this.currentTokenType < 0) { |
| 1441 |
this.tokenPreviousPosition = this.scanner.currentPosition; |
1522 |
this.tokenPreviousPosition = this.scanner.currentPosition; |
|
|
1523 |
if (this.tagValue == TAG_LINK_VALUE || this.tagValue == TAG_SEE_VALUE) { |
| 1524 |
int oldIndex = this.index; |
| 1525 |
char charAhead; |
| 1526 |
do{ |
| 1527 |
charAhead = readChar(); |
| 1528 |
if (charAhead == '"') { |
| 1529 |
this.scanner.resetTo(this.index-1, this.javadocEnd); |
| 1530 |
return scanJavadocString(); |
| 1531 |
} |
| 1532 |
} |
| 1533 |
while( charAhead == ' ' || charAhead == '\t'); // The other whitespace characters are now allowed? |
| 1534 |
this.index = oldIndex; |
| 1535 |
} |
| 1442 |
this.currentTokenType = this.scanner.getNextToken(); |
1536 |
this.currentTokenType = this.scanner.getNextToken(); |
| 1443 |
if (this.scanner.currentPosition > (this.lineEnd+1)) { // be sure to be on next line (lineEnd is still on the same line) |
1537 |
if (this.scanner.currentPosition > (this.lineEnd+1)) { // be sure to be on next line (lineEnd is still on the same line) |
| 1444 |
this.lineStarted = false; |
1538 |
this.lineStarted = false; |