18 #ifndef LLVM_CLANG_LIB_FORMAT_BREAKABLETOKEN_H 19 #define LLVM_CLANG_LIB_FORMAT_BREAKABLETOKEN_H 24 #include "llvm/ADT/StringSet.h" 25 #include "llvm/Support/Regex.h" 93 typedef std::pair<StringRef::size_type, unsigned> Split;
109 StringRef::size_type Length,
110 unsigned StartColumn)
const = 0;
125 unsigned StartColumn)
const {
126 return getRangeLength(LineIndex, Offset, StringRef::npos, StartColumn);
137 bool Break)
const = 0;
159 virtual Split
getSplit(
unsigned LineIndex,
unsigned TailOffset,
160 unsigned ColumnLimit,
unsigned ContentStartColumn,
161 llvm::Regex &CommentPragmasRegex)
const = 0;
164 virtual void insertBreak(
unsigned LineIndex,
unsigned TailOffset, Split Split,
165 unsigned ContentIndent,
196 llvm::Regex &CommentPragmasRegex)
const {
197 return Split(StringRef::npos, 0);
221 return Split(StringRef::npos, 0);
227 Split SplitAfterLastLine,
241 : Tok(Tok), InPPDirective(InPPDirective), Encoding(Encoding),
257 StringRef Prefix, StringRef Postfix,
261 Split
getSplit(
unsigned LineIndex,
unsigned TailOffset,
unsigned ColumnLimit,
262 unsigned ContentStartColumn,
263 llvm::Regex &CommentPragmasRegex)
const override;
264 void insertBreak(
unsigned LineIndex,
unsigned TailOffset, Split Split,
265 unsigned ContentIndent,
271 StringRef::size_type Length,
272 unsigned StartColumn)
const override;
274 unsigned StartColumn)
const override;
304 Split
getSplit(
unsigned LineIndex,
unsigned TailOffset,
unsigned ColumnLimit,
305 unsigned ContentStartColumn,
306 llvm::Regex &CommentPragmasRegex)
const override;
312 const FormatToken &tokenAt(
unsigned LineIndex)
const;
316 virtual bool mayReflow(
unsigned LineIndex,
317 llvm::Regex &CommentPragmasRegex)
const = 0;
359 StringRef ReflowPrefix =
" ";
365 unsigned OriginalStartColumn,
bool FirstInLine,
370 StringRef::size_type Length,
371 unsigned StartColumn)
const override;
373 unsigned StartColumn)
const override;
376 void insertBreak(
unsigned LineIndex,
unsigned TailOffset, Split Split,
377 unsigned ContentIndent,
380 llvm::Regex &CommentPragmasRegex)
const override;
381 void reflow(
unsigned LineIndex,
388 bool mayReflow(
unsigned LineIndex,
389 llvm::Regex &CommentPragmasRegex)
const override;
404 void adjustWhitespace(
unsigned LineIndex,
int IndentDelta);
416 unsigned IndentAtLineBreak;
420 bool LastLineNeedsDecoration;
423 StringRef Decoration;
427 unsigned DecorationColumn;
431 bool DelimitersOnNewline;
435 unsigned UnbreakableTailLength;
441 unsigned OriginalStartColumn,
bool FirstInLine,
446 StringRef::size_type Length,
447 unsigned StartColumn)
const override;
449 void insertBreak(
unsigned LineIndex,
unsigned TailOffset, Split Split,
450 unsigned ContentIndent,
453 llvm::Regex &CommentPragmasRegex)
const override;
454 void reflow(
unsigned LineIndex,
459 bool mayReflow(
unsigned LineIndex,
460 llvm::Regex &CommentPragmasRegex)
const override;
Contains functions for text encoding manipulation.
This file implements a token annotator, i.e.
Token - This structure provides full information about a lexed token.
WhitespaceManager class manages whitespace around tokens and their replacements.
Dataflow Directional Tag Classes.