int offset = 0;
offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset);
// 先頭の "{"
JavadocToken head = scanner.lookahead(offset);
if (head.getKind() != LEFT_BRACE) {
return null;
}
// タグ開始文字 "@"
offset++;
JavadocToken at = scanner.lookahead(offset);
if (at.getKind() != AT) {
return null;
}
// タグ名
offset++;
int nameCount = countWhileTagName(scanner, offset);
String tagName = buildString(JavadocScannerUtil.lookaheadTokens(
scanner, offset, nameCount));
offset += nameCount;
// 末端の検出
int blockEnd = JavadocScannerUtil.countUntil(S_INLINE_BLOCK_DELIM,
scanner,
offset);
JavadocToken token = scanner.lookahead(offset + blockEnd);
JavadocTokenKind kind = token.getKind();
// 次のブロックの開始を検出すると、このブロックは長さ0になる
if (kind == LEFT_BRACE) {
blockEnd = 0;
}
boolean legalBlock = (kind == JavadocTokenKind.RIGHT_BRACE);
JavadocToken tail = scanner.lookahead(offset + blockEnd);
int startIndex = scanner.getIndex() + offset;
int stopIndex = startIndex + blockEnd;
int startPos = head.getStartPosition();
int endPos = tail.getStartPosition();
if (legalBlock) {
endPos += tail.getText().length();
}
IrLocation blockLocation = new IrLocation(startPos, endPos - startPos);
DefaultJavadocScanner blockScanner = new DefaultJavadocScanner(
new ArrayList<JavadocToken>(scanner.getTokens().subList(startIndex,