14 #ifndef LLVM_CLANG_AST_COMMENTLEXER_H 15 #define LLVM_CLANG_AST_COMMENTLEXER_H 19 #include "llvm/ADT/SmallString.h" 20 #include "llvm/ADT/StringRef.h" 21 #include "llvm/Support/Allocator.h" 22 #include "llvm/Support/raw_ostream.h" 28 class TextTokenRetokenizer;
85 if (Length == 0 || Length == 1)
96 unsigned getLength() const LLVM_READONLY {
return Length; }
101 return StringRef(TextPtr, IntVal);
106 TextPtr = Text.data();
107 IntVal = Text.size();
112 return StringRef(TextPtr, IntVal);
117 TextPtr = Name.data();
118 IntVal = Name.size();
143 return StringRef(TextPtr, IntVal);
148 TextPtr = Text.data();
149 IntVal = Text.size();
164 return StringRef(TextPtr, IntVal);
169 TextPtr = Text.data();
170 IntVal = Text.size();
175 return StringRef(TextPtr, IntVal);
180 TextPtr = Name.data();
181 IntVal = Name.size();
186 return StringRef(TextPtr, IntVal);
191 TextPtr = Name.data();
192 IntVal = Name.size();
197 return StringRef(TextPtr, IntVal);
202 TextPtr = Str.data();
208 return StringRef(TextPtr, IntVal);
213 TextPtr = Name.data();
214 IntVal = Name.size();
224 void operator=(
const Lexer &) =
delete;
228 llvm::BumpPtrAllocator &Allocator;
234 const char *
const BufferStart;
235 const char *
const BufferEnd;
238 const char *BufferPtr;
242 const char *CommentEnd;
244 enum LexerCommentState {
246 LCS_InsideBCPLComment,
252 LexerCommentState CommentState;
260 LS_VerbatimBlockFirstLine,
264 LS_VerbatimBlockBody,
291 StringRef resolveHTMLNamedCharacterReference(StringRef Name)
const;
294 StringRef resolveHTMLDecimalCharacterReference(StringRef Name)
const;
297 StringRef resolveHTMLHexCharacterReference(StringRef Name)
const;
299 void formTokenWithChars(
Token &Result,
const char *TokEnd,
302 void formTextToken(
Token &Result,
const char *TokEnd) {
303 StringRef
Text(BufferPtr, TokEnd - BufferPtr);
304 formTokenWithChars(Result, TokEnd,
tok::text);
309 assert(Loc >= BufferStart && Loc <= BufferEnd &&
310 "Location out of range for this buffer!");
312 const unsigned CharNo = Loc - BufferStart;
317 return Diags.
Report(Loc, DiagID);
321 void skipLineStartingDecorations();
324 void lexCommentText(
Token &T);
326 void setupAndLexVerbatimBlock(
Token &T,
const char *TextBegin,
char Marker,
329 void lexVerbatimBlockFirstLine(
Token &T);
331 void lexVerbatimBlockBody(
Token &T);
333 void setupAndLexVerbatimLine(
Token &T,
const char *TextBegin,
336 void lexVerbatimLineText(
Token &T);
338 void lexHTMLCharacterReference(
Token &T);
340 void setupAndLexHTMLStartTag(
Token &T);
342 void lexHTMLStartTag(
Token &T);
344 void setupAndLexHTMLEndTag(
Token &T);
346 void lexHTMLEndTag(
Token &T);
351 const char *BufferStart,
const char *BufferEnd,
352 bool ParseCommands =
true);
357 bool *Invalid =
nullptr)
const;
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
Defines the SourceManager interface.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Concrete class used by the front-end to report problems and issues.
Defines the Diagnostic-related interfaces.
A little helper class used to produce diagnostics.
Encodes a location in the source.
Dataflow Directional Tag Classes.
This class handles loading and caching of source files into memory.