@@ -149,18 +149,19 @@ class TextTokenRetokenizer {
149
149
addToken ();
150
150
}
151
151
152
- // / Check if this line starts with @par or \par
152
+ // Check if this line starts with @par or \par
153
153
bool startsWithParCommand () {
154
154
unsigned Offset = 1 ;
155
155
156
- // / Skip all whitespace characters at the beginning.
157
- // / This needs to backtrack because Pos has already advanced past the
158
- // / actual \par or @par command by the time this function is called.
156
+ // Skip all whitespace characters at the beginning.
157
+ // This needs to backtrack because Pos has already advanced past the
158
+ // actual \par or @par command by the time this function is called.
159
159
while (isWhitespace (*(Pos.BufferPtr - Offset)))
160
160
Offset++;
161
161
162
- // / Check if next four characters are \par or @par
163
- llvm::StringRef LineStart (Pos.BufferPtr - 5 , 4 );
162
+ // Once we've reached the whitespace, backtrack and check if the previous four
163
+ // characters are \par or @par.
164
+ llvm::StringRef LineStart (Pos.BufferPtr - Offset - 3 , 4 );
164
165
return LineStart.starts_with (" \\ par" ) || LineStart.starts_with (" @par" );
165
166
}
166
167
@@ -180,7 +181,7 @@ class TextTokenRetokenizer {
180
181
return false ;
181
182
182
183
// Read until the end of this token, which is effectively the end of the
183
- // line This gets us the content of the par header, if there is one.
184
+ // line. This gets us the content of the par header, if there is one.
184
185
while (!isEnd ()) {
185
186
WordText.push_back (peek ());
186
187
if (Pos.BufferPtr + 1 == Pos.BufferEnd ) {
0 commit comments