14 #ifndef LLVM_CLANG_AST_COMMENTLEXER_H
15 #define LLVM_CLANG_AST_COMMENTLEXER_H
19 #include "llvm/ADT/SmallString.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/Allocator.h"
23 #include "llvm/Support/raw_ostream.h"
29 class TextTokenRetokenizer;
86 if (Length == 0 || Length == 1)
97 unsigned getLength() const LLVM_READONLY {
return Length; }
102 return StringRef(TextPtr, IntVal);
107 TextPtr = Text.data();
108 IntVal = Text.size();
113 return StringRef(TextPtr, IntVal);
118 TextPtr = Name.data();
119 IntVal = Name.size();
144 return StringRef(TextPtr, IntVal);
149 TextPtr = Text.data();
150 IntVal = Text.size();
165 return StringRef(TextPtr, IntVal);
170 TextPtr = Text.data();
171 IntVal = Text.size();
176 return StringRef(TextPtr, IntVal);
181 TextPtr = Name.data();
182 IntVal = Name.size();
187 return StringRef(TextPtr, IntVal);
192 TextPtr = Name.data();
193 IntVal = Name.size();
198 return StringRef(TextPtr, IntVal);
203 TextPtr = Str.data();
209 return StringRef(TextPtr, IntVal);
214 TextPtr = Name.data();
215 IntVal = Name.size();
225 void operator=(
const Lexer &) =
delete;
229 llvm::BumpPtrAllocator &Allocator;
235 const char *
const BufferStart;
236 const char *
const BufferEnd;
239 const char *BufferPtr;
243 const char *CommentEnd;
245 enum LexerCommentState {
247 LCS_InsideBCPLComment,
253 LexerCommentState CommentState;
261 LS_VerbatimBlockFirstLine,
265 LS_VerbatimBlockBody,
287 StringRef resolveHTMLNamedCharacterReference(StringRef Name)
const;
290 StringRef resolveHTMLDecimalCharacterReference(StringRef Name)
const;
293 StringRef resolveHTMLHexCharacterReference(StringRef Name)
const;
295 void formTokenWithChars(
Token &
Result,
const char *TokEnd,
298 void formTextToken(
Token &Result,
const char *TokEnd) {
299 StringRef Text(BufferPtr, TokEnd - BufferPtr);
300 formTokenWithChars(Result, TokEnd,
tok::text);
305 assert(Loc >= BufferStart && Loc <= BufferEnd &&
306 "Location out of range for this buffer!");
308 const unsigned CharNo = Loc - BufferStart;
313 return Diags.
Report(Loc, DiagID);
317 void skipLineStartingDecorations();
320 void lexCommentText(
Token &T);
322 void setupAndLexVerbatimBlock(
Token &T,
323 const char *TextBegin,
326 void lexVerbatimBlockFirstLine(
Token &T);
328 void lexVerbatimBlockBody(
Token &T);
330 void setupAndLexVerbatimLine(
Token &T,
const char *TextBegin,
333 void lexVerbatimLineText(
Token &T);
335 void lexHTMLCharacterReference(
Token &T);
337 void setupAndLexHTMLStartTag(
Token &T);
339 void lexHTMLStartTag(
Token &T);
341 void setupAndLexHTMLEndTag(
Token &T);
343 void lexHTMLEndTag(
Token &T);
349 const char *BufferStart,
const char *BufferEnd);
355 bool *Invalid =
nullptr)
const;
Defines the SourceManager interface.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
Concrete class used by the front-end to report problems and issues.
A little helper class used to produce diagnostics.
ID
Defines the set of possible language-specific address spaces.
The result type of a method or function.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
Defines the Diagnostic-related interfaces.
This class handles loading and caching of source files into memory.