[clang] [Clang][Comments] Support for parsing headers in Doxygen \par commands (PR #91100)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 5 06:08:55 PDT 2024
================
@@ -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
More information about the cfe-commits
mailing list