aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/CommentLexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/CommentLexer.h')
-rw-r--r--include/clang/AST/CommentLexer.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/include/clang/AST/CommentLexer.h b/include/clang/AST/CommentLexer.h
index 5bb075807be5..52c4eb9e309a 100644
--- a/include/clang/AST/CommentLexer.h
+++ b/include/clang/AST/CommentLexer.h
@@ -52,7 +52,7 @@ enum TokenKind {
};
} // end namespace tok
-/// \brief Comment token.
+/// Comment token.
class Token {
friend class Lexer;
friend class TextTokenRetokenizer;
@@ -72,7 +72,7 @@ class Token {
/// Integer value associated with a token.
///
- /// If the token is a konwn command, contains command ID and TextPtr is
+ /// If the token is a known command, contains command ID and TextPtr is
/// unused (command spelling can be found with CommandTraits). Otherwise,
/// contains the length of the string that starts at TextPtr.
unsigned IntVal;
@@ -217,7 +217,7 @@ public:
void dump(const Lexer &L, const SourceManager &SM) const;
};
-/// \brief Comment lexer.
+/// Comment lexer.
class Lexer {
private:
Lexer(const Lexer &) = delete;
@@ -281,6 +281,11 @@ private:
/// command, including command marker.
SmallString<16> VerbatimBlockEndCommandName;
+ /// If true, the commands, html tags, etc will be parsed and reported as
+ /// separate tokens inside the comment body. If false, the comment text will
+ /// be parsed into text and newline tokens.
+ bool ParseCommands;
+
/// Given a character reference name (e.g., "lt"), return the character that
/// it stands for (e.g., "<").
StringRef resolveHTMLNamedCharacterReference(StringRef Name) const;
@@ -315,12 +320,11 @@ private:
/// Eat string matching regexp \code \s*\* \endcode.
void skipLineStartingDecorations();
- /// Lex stuff inside comments. CommentEnd should be set correctly.
+ /// Lex comment text, including commands if ParseCommands is set to true.
void lexCommentText(Token &T);
- void setupAndLexVerbatimBlock(Token &T,
- const char *TextBegin,
- char Marker, const CommandInfo *Info);
+ void setupAndLexVerbatimBlock(Token &T, const char *TextBegin, char Marker,
+ const CommandInfo *Info);
void lexVerbatimBlockFirstLine(Token &T);
@@ -343,14 +347,13 @@ private:
public:
Lexer(llvm::BumpPtrAllocator &Allocator, DiagnosticsEngine &Diags,
- const CommandTraits &Traits,
- SourceLocation FileLoc,
- const char *BufferStart, const char *BufferEnd);
+ const CommandTraits &Traits, SourceLocation FileLoc,
+ const char *BufferStart, const char *BufferEnd,
+ bool ParseCommands = true);
void lex(Token &T);
- StringRef getSpelling(const Token &Tok,
- const SourceManager &SourceMgr,
+ StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr,
bool *Invalid = nullptr) const;
};