18 #ifndef LLVM_CLANG_LIB_FORMAT_BREAKABLETOKEN_H
19 #define LLVM_CLANG_LIB_FORMAT_BREAKABLETOKEN_H
24 #include "llvm/Support/Regex.h"
72 typedef std::pair<StringRef::size_type, unsigned>
Split;
87 StringRef::size_type
Length)
const = 0;
92 virtual Split getSplit(
unsigned LineIndex,
unsigned TailOffset,
94 llvm::Regex &CommentPragmasRegex)
const = 0;
122 unsigned ColumnLimit,
123 llvm::Regex &CommentPragmasRegex)
const {
124 return Split(StringRef::npos, 0);
133 unsigned PreviousEndColumn,
134 unsigned ColumnLimit,
135 Split SplitBefore)
const {
143 unsigned PreviousEndColumn,
144 unsigned ColumnLimit,
Split SplitBefore,
155 : Tok(Tok), InPPDirective(InPPDirective), Encoding(Encoding),
171 StringRef::size_type
Length)
const override;
200 Split getSplit(
unsigned LineIndex,
unsigned TailOffset,
unsigned ColumnLimit,
201 llvm::Regex &CommentPragmasRegex)
const override;
220 Split getSplit(
unsigned LineIndex,
unsigned TailOffset,
unsigned ColumnLimit,
221 llvm::Regex &CommentPragmasRegex)
const override;
227 unsigned TailOffset)
const = 0;
232 unsigned PreviousEndColumn,
unsigned ColumnLimit)
const;
239 virtual bool mayReflow(
unsigned LineIndex,
240 llvm::Regex &CommentPragmasRegex)
const = 0;
282 StringRef ReflowPrefix =
" ";
288 unsigned OriginalStartColumn,
bool FirstInLine,
293 StringRef::size_type
Length)
const override;
296 Split
getSplitBefore(
unsigned LineIndex,
unsigned PreviousEndColumn,
297 unsigned ColumnLimit,
298 llvm::Regex &CommentPragmasRegex)
const override;
301 unsigned PreviousEndColumn,
302 unsigned ColumnLimit,
303 Split SplitBefore)
const override;
305 unsigned ColumnLimit, Split SplitBefore,
308 llvm::Regex &CommentPragmasRegex)
const override;
319 void adjustWhitespace(
unsigned LineIndex,
int IndentDelta);
323 unsigned getReflownColumn(StringRef
Content,
unsigned LineIndex,
324 unsigned PreviousEndColumn)
const;
326 unsigned getContentStartColumn(
unsigned LineIndex,
327 unsigned TailOffset)
const override;
339 unsigned IndentAtLineBreak;
343 bool LastLineNeedsDecoration;
346 StringRef Decoration;
350 unsigned DecorationColumn;
356 unsigned OriginalStartColumn,
bool FirstInLine,
361 StringRef::size_type
Length)
const override;
364 Split
getSplitBefore(
unsigned LineIndex,
unsigned PreviousEndColumn,
365 unsigned ColumnLimit,
366 llvm::Regex &CommentPragmasRegex)
const override;
369 unsigned PreviousEndColumn,
370 unsigned ColumnLimit,
371 Split SplitBefore)
const override;
373 unsigned ColumnLimit, Split SplitBefore,
377 llvm::Regex &CommentPragmasRegex)
const override;
380 unsigned getContentStartColumn(
unsigned LineIndex,
381 unsigned TailOffset)
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.