================ @@ -149,6 +149,63 @@ class TextTokenRetokenizer { addToken(); } + /// Check if this line starts with @par or \par + bool startsWithParCommand() { + unsigned Offset = 1; + + /// Skip all whitespace characters at the beginning. + /// This needs to backtrack because Pos has already advanced past the + /// actual \par or @par command by the time this function is called. + while (isWhitespace(*(Pos.BufferPtr - Offset))) + Offset++; ---------------- AaronBallman wrote:
Rather than backtracking, can't we still do a peek ahead? e.g., once we've seen `@par`, we can do a peek to see if the next token is a newline or not (or do a scan through the buffer to see if there is a non-whitespace character or only whitespace ending with a newline/eof)? https://github.com/llvm/llvm-project/pull/91100 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits