13 #ifndef LLVM_CLANG_AST_COMMENTLEXER_H 14 #define LLVM_CLANG_AST_COMMENTLEXER_H 18 #include "llvm/ADT/SmallString.h" 19 #include "llvm/ADT/StringRef.h" 20 #include "llvm/Support/Allocator.h" 21 #include "llvm/Support/raw_ostream.h" 27 class TextTokenRetokenizer;
84 if (Length == 0 || Length == 1)
95 unsigned getLength() const LLVM_READONLY {
return Length; }
100 return StringRef(TextPtr, IntVal);
105 TextPtr = Text.data();
106 IntVal = Text.size();
111 return StringRef(TextPtr, IntVal);
116 TextPtr = Name.data();
117 IntVal = Name.size();
142 return StringRef(TextPtr, IntVal);
147 TextPtr = Text.data();
148 IntVal = Text.size();
163 return StringRef(TextPtr, IntVal);
168 TextPtr = Text.data();
169 IntVal = Text.size();
174 return StringRef(TextPtr, IntVal);
179 TextPtr = Name.data();
180 IntVal = Name.size();
185 return StringRef(TextPtr, IntVal);
190 TextPtr = Name.data();
191 IntVal = Name.size();
196 return StringRef(TextPtr, IntVal);
201 TextPtr = Str.data();
207 return StringRef(TextPtr, IntVal);
212 TextPtr = Name.data();
213 IntVal = Name.size();
223 void operator=(
const Lexer &) =
delete;
227 llvm::BumpPtrAllocator &Allocator;
233 const char *
const BufferStart;
234 const char *
const BufferEnd;
237 const char *BufferPtr;
241 const char *CommentEnd;
243 enum LexerCommentState {
245 LCS_InsideBCPLComment,
251 LexerCommentState CommentState;
259 LS_VerbatimBlockFirstLine,
263 LS_VerbatimBlockBody,
290 StringRef resolveHTMLNamedCharacterReference(StringRef Name)
const;
293 StringRef resolveHTMLDecimalCharacterReference(StringRef Name)
const;
296 StringRef resolveHTMLHexCharacterReference(StringRef Name)
const;
298 void formTokenWithChars(
Token &Result,
const char *TokEnd,
301 void formTextToken(
Token &Result,
const char *TokEnd) {
302 StringRef
Text(BufferPtr, TokEnd - BufferPtr);
303 formTokenWithChars(Result, TokEnd,
tok::text);
308 assert(Loc >= BufferStart && Loc <= BufferEnd &&
309 "Location out of range for this buffer!");
311 const unsigned CharNo = Loc - BufferStart;
316 return Diags.
Report(Loc, DiagID);
320 void skipLineStartingDecorations();
323 void lexCommentText(
Token &T);
325 void setupAndLexVerbatimBlock(
Token &T,
const char *TextBegin,
char Marker,
328 void lexVerbatimBlockFirstLine(
Token &T);
330 void lexVerbatimBlockBody(
Token &T);
332 void setupAndLexVerbatimLine(
Token &T,
const char *TextBegin,
335 void lexVerbatimLineText(
Token &T);
337 void lexHTMLCharacterReference(
Token &T);
339 void setupAndLexHTMLStartTag(
Token &T);
341 void lexHTMLStartTag(
Token &T);
343 void setupAndLexHTMLEndTag(
Token &T);
345 void lexHTMLEndTag(
Token &T);
350 const char *BufferStart,
const char *BufferEnd,
351 bool ParseCommands =
true);
356 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.