Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit ec3a0c0

Browse files
committed
Locate separate sentences in different extracted tokens.
1 parent 799cc59 commit ec3a0c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/rules/dartdoc_summary_line.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ RegExp _sentenceBreak = RegExp(r'[^\.]+\.\s+[^\.]+');
170170
/// Returns the offset of the token that contains a sentence break.
171171
int? _findSentenceBreak(Iterable<Token> tokens) {
172172
for (Token tk in tokens) {
173+
// "Corner case": If token is not last, and ends with a period.
174+
// This used to be accepted, but shouldn't.
175+
if (tk != tokens.last && tk.lexeme.endsWith('.')) {
176+
return tk.end - 1;
177+
}
178+
// Attempt to locate the period in the middle of the lexeme.
173179
RegExpMatch? match = _sentenceBreak.firstMatch(tk.lexeme);
174180
if (match != null) {
175181
return tk.offset + tk.lexeme.indexOf('.', match.start);

0 commit comments

Comments
 (0)