@@ -222,18 +222,19 @@ class TextTokenRetokenizer {
222
222
return true ;
223
223
}
224
224
225
- // / Check if this line starts with @par or \par
225
+ // Check if this line starts with @par or \par
226
226
bool startsWithParCommand () {
227
227
unsigned Offset = 1 ;
228
228
229
- // / Skip all whitespace characters at the beginning.
230
- // / This needs to backtrack because Pos has already advanced past the
231
- // / actual \par or @par command by the time this function is called.
229
+ // Skip all whitespace characters at the beginning.
230
+ // This needs to backtrack because Pos has already advanced past the
231
+ // actual \par or @par command by the time this function is called.
232
232
while (isWhitespace (*(Pos.BufferPtr - Offset)))
233
233
Offset++;
234
234
235
- // / Check if next four characters are \par or @par
236
- llvm::StringRef LineStart (Pos.BufferPtr - 5 , 4 );
235
+ // Once we've reached the whitespace, backtrack and check if the previous four
236
+ // characters are \par or @par.
237
+ llvm::StringRef LineStart (Pos.BufferPtr - Offset - 3 , 4 );
237
238
return LineStart.starts_with (" \\ par" ) || LineStart.starts_with (" @par" );
238
239
}
239
240
@@ -253,7 +254,7 @@ class TextTokenRetokenizer {
253
254
return false ;
254
255
255
256
// Read until the end of this token, which is effectively the end of the
256
- // line This gets us the content of the par header, if there is one.
257
+ // line. This gets us the content of the par header, if there is one.
257
258
while (!isEnd ()) {
258
259
WordText.push_back (peek ());
259
260
if (Pos.BufferPtr + 1 == Pos.BufferEnd ) {
0 commit comments