clang
8.0.0
|
A wrapper around a Token
storing information about the whitespace characters preceding it.
More...
#include "/work/www-prereleases/8.0.0/rc5/docsbuild/llvm.src/tools/clang/lib/Format/FormatToken.h"
Public Member Functions | |
FormatToken () | |
bool | is (tok::TokenKind Kind) const |
bool | is (TokenType TT) const |
bool | is (const IdentifierInfo *II) const |
bool | is (tok::PPKeywordKind Kind) const |
template<typename A , typename B > | |
bool | isOneOf (A K1, B K2) const |
template<typename A , typename B , typename... Ts> | |
bool | isOneOf (A K1, B K2, Ts... Ks) const |
template<typename T > | |
bool | isNot (T Kind) const |
bool | closesScopeAfterBlock () const |
template<typename A , typename... Ts> | |
bool | startsSequence (A K1, Ts... Tokens) const |
true if this token starts a sequence with the given tokens in order, following the Next pointers, ignoring comments. More... | |
template<typename A , typename... Ts> | |
bool | endsSequence (A K1, Ts... Tokens) const |
true if this token ends a sequence with the given tokens in order, following the Previous pointers, ignoring comments. More... | |
bool | isStringLiteral () const |
bool | isObjCAtKeyword (tok::ObjCKeywordKind Kind) const |
bool | isAccessSpecifier (bool ColonRequired=true) const |
bool | isSimpleTypeSpecifier () const |
Determine whether the token is a simple-type-specifier. More... | |
bool | isObjCAccessSpecifier () const |
bool | opensScope () const |
Returns whether Tok is ([{ or an opening < of a template or in protos. More... | |
bool | closesScope () const |
Returns whether Tok is )]} or a closing > of a template or in protos. More... | |
bool | isMemberAccess () const |
Returns true if this is a "." or "->" accessing a member. More... | |
bool | isUnaryOperator () const |
bool | isBinaryOperator () const |
bool | isTrailingComment () const |
bool | isFunctionLikeKeyword () const |
Returns true if this is a keyword that can be used like a function call (e.g. More... | |
bool | isLabelString () const |
Returns true if this is a string literal that's like a label, e.g. More... | |
SourceLocation | getStartOfNonWhitespace () const |
Returns actual token start location without leading escaped newlines and whitespace. More... | |
prec::Level | getPrecedence () const |
FormatToken * | getPreviousNonComment () const |
Returns the previous token ignoring comments. More... | |
const FormatToken * | getNextNonComment () const |
Returns the next token ignoring comments. More... | |
bool | opensBlockOrBlockTypeList (const FormatStyle &Style) const |
Returns true if this tokens starts a block-type list, i.e. More... | |
bool | isCppStructuredBinding (const FormatStyle &Style) const |
Returns whether the token is the left square bracket of a C++ structured binding declaration. More... | |
bool | closesBlockOrBlockTypeList (const FormatStyle &Style) const |
Same as opensBlockOrBlockTypeList, but for the closing token. More... | |
const FormatToken * | getNamespaceToken () const |
Return the actual namespace token, if this token starts a namespace block. More... | |
Public Attributes | |
Token | Tok |
The Token . More... | |
unsigned | NewlinesBefore = 0 |
The number of newlines immediately before the Token . More... | |
bool | HasUnescapedNewline = false |
Whether there is at least one unescaped newline before the Token . More... | |
SourceRange | WhitespaceRange |
The range of the whitespace immediately preceding the Token . More... | |
unsigned | LastNewlineOffset = 0 |
The offset just past the last ' ' in this token's leading whitespace (relative to WhiteSpaceStart ). More... | |
unsigned | ColumnWidth = 0 |
The width of the non-whitespace parts of the token (or its first line for multi-line tokens) in columns. More... | |
unsigned | LastLineColumnWidth = 0 |
Contains the width in columns of the last line of a multi-line token. More... | |
bool | IsMultiline = false |
Whether the token text contains newlines (escaped or not). More... | |
bool | IsFirst = false |
Indicates that this is the first token of the file. More... | |
bool | MustBreakBefore = false |
Whether there must be a line break before this token. More... | |
StringRef | TokenText |
The raw text of the token. More... | |
bool | IsUnterminatedLiteral = 0 |
Set to true if this token is an unterminated literal. More... | |
BraceBlockKind | BlockKind = BK_Unknown |
Contains the kind of block if this token is a brace. More... | |
TokenType | Type = TT_Unknown |
unsigned | SpacesRequiredBefore = 0 |
The number of spaces that should be inserted before this token. More... | |
bool | CanBreakBefore = false |
true if it is allowed to break before this token. More... | |
bool | ClosesTemplateDeclaration = false |
true if this is the ">" of "template<..>". More... | |
unsigned | ParameterCount = 0 |
Number of parameters, if this is "(", "[" or "<". More... | |
unsigned | BlockParameterCount = 0 |
Number of parameters that are nested blocks, if this is "(", "[" or "<". More... | |
tok::TokenKind | ParentBracket = tok::unknown |
If this is a bracket ("<", "(", "[" or "{"), contains the kind of the surrounding bracket. More... | |
std::unique_ptr< TokenRole > | Role |
A token can have a special role that can carry extra information about the token's formatting. More... | |
ParameterPackingKind | PackingKind = PPK_Inconclusive |
If this is an opening parenthesis, how are the parameters packed? More... | |
unsigned | TotalLength = 0 |
The total length of the unwrapped line up to and including this token. More... | |
unsigned | OriginalColumn = 0 |
The original 0-based column of this token, including expanded tabs. More... | |
unsigned | UnbreakableTailLength = 0 |
The length of following tokens until the next natural split point, or the next token that can be broken. More... | |
unsigned | BindingStrength = 0 |
The binding strength of a token. More... | |
unsigned | NestingLevel = 0 |
The nesting level of this token, i.e. More... | |
unsigned | IndentLevel = 0 |
The indent level of this token. Copied from the surrounding line. More... | |
unsigned | SplitPenalty = 0 |
Penalty for inserting a line break before this token. More... | |
unsigned | LongestObjCSelectorName = 0 |
If this is the first ObjC selector name in an ObjC method definition or call, this contains the length of the longest name. More... | |
unsigned | ObjCSelectorNameParts = 0 |
If this is the first ObjC selector name in an ObjC method definition or call, this contains the number of parts that the whole selector consist of. More... | |
unsigned | ParameterIndex = 0 |
The 0-based index of the parameter/argument. More... | |
SmallVector< prec::Level, 4 > | FakeLParens |
Stores the number of required fake parentheses and the corresponding operator precedence. More... | |
unsigned | FakeRParens = 0 |
Insert this many fake ) after this token for correct indentation. More... | |
bool | StartsBinaryExpression = false |
true if this token starts a binary expression, i.e. More... | |
bool | EndsBinaryExpression = false |
true if this token ends a binary expression. More... | |
unsigned | OperatorIndex = 0 |
If this is an operator (or "."/"->") in a sequence of operators with the same precedence, contains the 0-based operator index. More... | |
FormatToken * | NextOperator = nullptr |
If this is an operator (or "."/"->") in a sequence of operators with the same precedence, points to the next operator. More... | |
bool | PartOfMultiVariableDeclStmt = false |
Is this token part of a DeclStmt defining multiple variables? More... | |
bool | ContinuesLineCommentSection = false |
Does this line comment continue a line comment section? More... | |
FormatToken * | MatchingParen = nullptr |
If this is a bracket, this points to the matching one. More... | |
FormatToken * | Previous = nullptr |
The previous token in the unwrapped line. More... | |
FormatToken * | Next = nullptr |
The next token in the unwrapped line. More... | |
SmallVector< AnnotatedLine *, 1 > | Children |
If this token starts a block, this contains all the unwrapped lines in it. More... | |
FormatDecision | Decision = FD_Unformatted |
Stores the formatting decision for the token once it was made. More... | |
bool | Finalized = false |
If true , this token has been fully formatted (indented and potentially re-formatted inside), and we do not allow further formatting changes. More... | |
A wrapper around a Token
storing information about the whitespace characters preceding it.
Definition at line 124 of file FormatToken.h.
|
inline |
Definition at line 125 of file FormatToken.h.
Referenced by getNamespaceToken().
|
inline |
Same as opensBlockOrBlockTypeList, but for the closing token.
Definition at line 516 of file FormatToken.h.
References closesScope(), is(), and opensBlockOrBlockTypeList().
|
inline |
Returns whether Tok
is )]} or a closing > of a template or in protos.
Definition at line 381 of file FormatToken.h.
References is(), and isOneOf().
Referenced by closesBlockOrBlockTypeList(), closesScopeAfterBlock(), and clang::format::startsSegmentOfBuilderTypeCall().
|
inline |
Definition at line 325 of file FormatToken.h.
References clang::format::BK_Block, closesScope(), and closesScopeAfterBlock().
Referenced by closesScopeAfterBlock().
|
inline |
true
if this token ends a sequence with the given tokens in order, following the Previous
pointers, ignoring comments.
Definition at line 343 of file FormatToken.h.
|
inline |
Return the actual namespace token, if this token starts a namespace block.
Definition at line 524 of file FormatToken.h.
References FormatToken(), getNextNonComment(), is(), and isOneOf().
|
inline |
Returns the next token ignoring comments.
Definition at line 481 of file FormatToken.h.
Referenced by clang::format::ContinuationIndenter::getColumnLimit(), getNamespaceToken(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
|
inline |
Definition at line 467 of file FormatToken.h.
References clang::getBinOpPrecedence(), and clang::Token::getKind().
Referenced by isBinaryOperator().
|
inline |
Returns the previous token ignoring comments.
Definition at line 473 of file FormatToken.h.
References is(), and Previous.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), clang::format::getEnclosingFunctionName(), isCppStructuredBinding(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
|
inline |
Returns actual token start location without leading escaped newlines and whitespace.
This can be different to Tok.getLocation(), which includes leading escaped newlines.
Definition at line 463 of file FormatToken.h.
References clang::SourceRange::getEnd().
Referenced by clang::format::AffectedRangeManager::affectsCharSourceRange(), and clang::format::WhitespaceManager::replaceWhitespaceInToken().
|
inline |
Definition at line 307 of file FormatToken.h.
References clang::Token::is().
Referenced by addContextSensitiveTypeNullability(), clang::format::AffectedRangeManager::affectsCharSourceRange(), clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), CheckAvailabilitySpecList(), closesBlockOrBlockTypeList(), closesScope(), compareModuleHeaders(), diagnoseRedundantPropertyNullability(), formatModuleId(), clang::format::WhitespaceManager::generateReplacements(), clang::format::ContinuationIndenter::getColumnLimit(), clang::format::getEnclosingFunctionName(), clang::ModuleMapParser::getLocation(), getNamespaceToken(), getNextNonComment(), getPreviousNonComment(), clang::format::hash_combine(), clang::TokenLexer::Init(), isAccessSpecifier(), clang::format::isAllmanBrace(), isCppStructuredBinding(), clang::format::AdditionalKeywords::IsJavaScriptIdentifier(), isLabelString(), isNot(), isObjCAccessSpecifier(), isOneOf(), isTrailingComment(), isValidAfterIdentifierInDeclarator(), clang::Parser::ObjCTypeParamListScope::leave(), clang::format::FormatTokenLexer::lex(), clang::format::mustBeJSIdent(), opensBlockOrBlockTypeList(), clang::format::opensProtoMessageField(), opensScope(), parseDeclareSimdClauses(), clang::Parser::ParseOpenMPParensExpr(), clang::Parser::ParseOpenMPVarList(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), clang::Parser::ConditionDeclarationOrInitStatementState::result(), clang::Parser::UnannotatedTentativeParsingAction::RevertAnnotations(), clang::format::TokenAnnotator::setCommentLineLevels(), SetupFixedPointError(), shouldAddRequirement(), clang::format::ShouldBreakBeforeBrace(), clang::format::switchesFormatting(), takeDeclAttributes(), and clang::TokenRewriter::TokenRewriter().
Definition at line 308 of file FormatToken.h.
|
inline |
Definition at line 309 of file FormatToken.h.
References clang::Token::getIdentifierInfo().
|
inline |
Definition at line 312 of file FormatToken.h.
References clang::Token::getIdentifierInfo(), and clang::IdentifierInfo::getPPKeywordID().
Definition at line 353 of file FormatToken.h.
References is(), isOneOf(), and isSimpleTypeSpecifier().
|
inline |
Definition at line 413 of file FormatToken.h.
References clang::prec::Comma, and getPrecedence().
Referenced by clang::format::FormatTokenLexer::lex().
|
inline |
Returns whether the token is the left square bracket of a C++ structured binding declaration.
Definition at line 504 of file FormatToken.h.
References getPreviousNonComment(), is(), clang::format::FormatStyle::isCpp(), isNot(), and isOneOf().
|
inline |
Returns true
if this is a keyword that can be used like a function call (e.g.
sizeof, typeid, ...).
Definition at line 425 of file FormatToken.h.
References clang::Token::getKind().
|
inline |
Returns true
if this is a string literal that's like a label, e.g.
ends with "=" or ":".
Definition at line 445 of file FormatToken.h.
|
inline |
Returns true
if this is a "." or "->" accessing a member.
Definition at line 391 of file FormatToken.h.
References isOneOf().
Referenced by clang::format::startsSegmentOfBuilderTypeCall().
|
inline |
Definition at line 323 of file FormatToken.h.
References is().
Referenced by addContextSensitiveTypeNullability(), CheckAvailabilitySpecList(), diagnoseRedundantPropertyNullability(), isCppStructuredBinding(), clang::Parser::ObjCTypeParamListScope::leave(), clang::format::opensProtoMessageField(), parseDeclareSimdClauses(), clang::Parser::ParseOpenMPParensExpr(), clang::Parser::ParseOpenMPVarList(), clang::Parser::UnannotatedTentativeParsingAction::RevertAnnotations(), clang::format::TokenAnnotator::setCommentLineLevels(), and takeDeclAttributes().
|
inline |
Definition at line 361 of file FormatToken.h.
References is(), and isObjCAtKeyword().
|
inline |
Definition at line 349 of file FormatToken.h.
References clang::Token::isObjCAtKeyword().
Referenced by addContextSensitiveTypeNullability(), CheckAvailabilitySpecList(), isObjCAccessSpecifier(), clang::Parser::ObjCTypeParamListScope::leave(), and takeDeclAttributes().
|
inline |
Definition at line 316 of file FormatToken.h.
References is().
Referenced by addContextSensitiveTypeNullability(), closesScope(), diagnoseRedundantPropertyNullability(), clang::format::CommaSeparatedList::formatAfterToken(), getNamespaceToken(), clang::format::hash_combine(), isAccessSpecifier(), clang::format::isAllmanBrace(), isCppStructuredBinding(), clang::format::isJSDeclOrStmt(), isMemberAccess(), isOneOf(), clang::format::FormatTokenLexer::lex(), clang::format::AnnotatedLine::mightBeFunctionDefinition(), clang::format::mustBeJSIdent(), clang::format::mustBeJSIdentOrValue(), opensScope(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), clang::Parser::ConditionDeclarationOrInitStatementState::result(), and takeDeclAttributes().
|
inline |
Definition at line 320 of file FormatToken.h.
bool clang::format::FormatToken::isSimpleTypeSpecifier | ( | ) | const |
Determine whether the token is a simple-type-specifier.
Definition at line 40 of file FormatToken.cpp.
References clang::Token::getKind(), and Tok.
Referenced by isAccessSpecifier().
|
inline |
Definition at line 347 of file FormatToken.h.
References clang::Token::getKind(), and clang::tok::isStringLiteral().
Referenced by clang::format::ContinuationIndenter::getColumnLimit(), and clang::format::getEnclosingFunctionName().
|
inline |
Definition at line 418 of file FormatToken.h.
References is(), and NewlinesBefore.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
|
inline |
Definition at line 397 of file FormatToken.h.
References clang::Token::getKind().
|
inline |
Returns true
if this tokens starts a block-type list, i.e.
a list that should be indented with a block indent.
Definition at line 490 of file FormatToken.h.
References clang::format::BK_Block, clang::format::FormatStyle::Cpp11BracedListStyle, is(), clang::format::FormatStyle::Language, clang::format::FormatStyle::LK_Proto, clang::format::FormatStyle::LK_TextProto, and opensScope().
Referenced by closesBlockOrBlockTypeList().
|
inline |
Returns whether Tok
is ([{ or an opening < of a template or in protos.
Definition at line 371 of file FormatToken.h.
References is(), and isOneOf().
Referenced by opensBlockOrBlockTypeList().
|
inline |
true
if this token starts a sequence with the given tokens in order, following the Next
pointers, ignoring comments.
Definition at line 336 of file FormatToken.h.
unsigned clang::format::FormatToken::BindingStrength = 0 |
The binding strength of a token.
This is a combined value of operator precedence, parenthesis nesting, etc.
Definition at line 224 of file FormatToken.h.
BraceBlockKind clang::format::FormatToken::BlockKind = BK_Unknown |
Contains the kind of block if this token is a brace.
Definition at line 178 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), clang::format::hash_combine(), and clang::format::isAllmanBrace().
unsigned clang::format::FormatToken::BlockParameterCount = 0 |
Number of parameters that are nested blocks, if this is "(", "[" or "<".
Definition at line 196 of file FormatToken.h.
true
if it is allowed to break before this token.
Definition at line 186 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::precomputeFormattingInfos().
SmallVector<AnnotatedLine *, 1> clang::format::FormatToken::Children |
If this token starts a block, this contains all the unwrapped lines in it.
Definition at line 297 of file FormatToken.h.
Referenced by clang::format::AffectedRangeManager::affectsCharSourceRange().
true
if this is the ">" of "template<..>".
Definition at line 189 of file FormatToken.h.
unsigned clang::format::FormatToken::ColumnWidth = 0 |
The width of the non-whitespace parts of the token (or its first line for multi-line tokens) in columns.
We need this to correctly measure number of columns a token spans.
Definition at line 150 of file FormatToken.h.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation(), clang::format::CodePointsBetween(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::ContinuationIndenter::getColumnLimit(), clang::format::getEnclosingFunctionName(), and clang::format::FormatTokenLexer::lex().
Does this line comment continue a line comment section?
Only set to true if Type
== TT_LineComment
.
Definition at line 284 of file FormatToken.h.
FormatDecision clang::format::FormatToken::Decision = FD_Unformatted |
Stores the formatting decision for the token once it was made.
Definition at line 300 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::replaceWhitespace().
true
if this token ends a binary expression.
Definition at line 266 of file FormatToken.h.
SmallVector<prec::Level, 4> clang::format::FormatToken::FakeLParens |
Stores the number of required fake parentheses and the corresponding operator precedence.
If multiple fake parentheses start at a token, this vector stores them in reverse order, i.e. inner fake parenthesis first.
Definition at line 258 of file FormatToken.h.
unsigned clang::format::FormatToken::FakeRParens = 0 |
Insert this many fake ) after this token for correct indentation.
Definition at line 260 of file FormatToken.h.
If true
, this token has been fully formatted (indented and potentially re-formatted inside), and we do not allow further formatting changes.
Definition at line 305 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::addUntouchableToken(), clang::format::BreakableBlockComment::mayReflow(), clang::format::BreakableLineCommentSection::mayReflow(), clang::format::WhitespaceManager::replaceWhitespace(), and clang::format::WhitespaceManager::replaceWhitespaceInToken().
Whether there is at least one unescaped newline before the Token
.
Definition at line 138 of file FormatToken.h.
Referenced by clang::format::FormatTokenLexer::lex(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), and clang::format::printDebugInfo().
unsigned clang::format::FormatToken::IndentLevel = 0 |
The indent level of this token. Copied from the surrounding line.
Definition at line 231 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::Change::indentAndNestingLevel().
Indicates that this is the first token of the file.
Definition at line 160 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::addUntouchableToken(), clang::format::FormatTokenLexer::lex(), clang::format::WhitespaceManager::replaceWhitespace(), and clang::format::WhitespaceManager::replaceWhitespaceInToken().
Whether the token text contains newlines (escaped or not).
Definition at line 157 of file FormatToken.h.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation(), clang::format::ContinuationIndenter::getColumnLimit(), and clang::format::FormatTokenLexer::lex().
bool clang::format::FormatToken::IsUnterminatedLiteral = 0 |
Set to true
if this token is an unterminated literal.
Definition at line 175 of file FormatToken.h.
Referenced by clang::format::getEnclosingFunctionName().
unsigned clang::format::FormatToken::LastLineColumnWidth = 0 |
Contains the width in columns of the last line of a multi-line token.
Definition at line 154 of file FormatToken.h.
Referenced by clang::format::FormatTokenLexer::lex().
unsigned clang::format::FormatToken::LastNewlineOffset = 0 |
The offset just past the last '
' in this token's leading whitespace (relative to WhiteSpaceStart
).
0 if there is no '
'.
Definition at line 145 of file FormatToken.h.
Referenced by clang::format::AffectedRangeManager::affectsCharSourceRange(), and clang::format::FormatTokenLexer::lex().
unsigned clang::format::FormatToken::LongestObjCSelectorName = 0 |
If this is the first ObjC selector name in an ObjC method definition or call, this contains the length of the longest name.
This being set to 0 means that the selectors should not be colon-aligned, e.g. because several of them are block-type.
Definition at line 241 of file FormatToken.h.
FormatToken* clang::format::FormatToken::MatchingParen = nullptr |
If this is a bracket, this points to the matching one.
Definition at line 287 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), clang::format::getEnclosingFunctionName(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
Whether there must be a line break before this token.
This happens for example when a preprocessor directive ended directly before the token.
Definition at line 166 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
unsigned clang::format::FormatToken::NestingLevel = 0 |
The nesting level of this token, i.e.
the number of surrounding (), [], {} or <>.
Definition at line 228 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::Change::indentAndNestingLevel(), clang::format::maxNestingDepth(), clang::format::opensProtoMessageField(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
unsigned clang::format::FormatToken::NewlinesBefore = 0 |
The number of newlines immediately before the Token
.
This can be used to determine what the user wrote in the original code and thereby e.g. leave an empty line between two function definitions.
Definition at line 134 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::addUntouchableToken(), clang::format::AffectedRangeManager::affectsCharSourceRange(), clang::format::ContinuationIndenter::getInitialState(), clang::format::isAllmanBrace(), isTrailingComment(), clang::format::FormatTokenLexer::lex(), clang::format::printDebugInfo(), and clang::format::TokenAnnotator::setCommentLineLevels().
FormatToken* clang::format::FormatToken::Next = nullptr |
The next token in the unwrapped line.
Definition at line 293 of file FormatToken.h.
Referenced by clang::format::AffectedRangeManager::affectsCharSourceRange(), clang::format::CommaSeparatedList::formatAfterToken(), getNextNonComment(), clang::format::maxNestingDepth(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), clang::format::TokenAnnotator::setCommentLineLevels(), and clang::format::BreakableLineCommentSection::updateNextToken().
FormatToken* clang::format::FormatToken::NextOperator = nullptr |
If this is an operator (or "."/"->") in a sequence of operators with the same precedence, points to the next operator.
Definition at line 274 of file FormatToken.h.
Referenced by clang::format::getLengthToNextOperator().
unsigned clang::format::FormatToken::ObjCSelectorNameParts = 0 |
If this is the first ObjC selector name in an ObjC method definition or call, this contains the number of parts that the whole selector consist of.
Definition at line 246 of file FormatToken.h.
unsigned clang::format::FormatToken::OperatorIndex = 0 |
If this is an operator (or "."/"->") in a sequence of operators with the same precedence, contains the 0-based operator index.
Definition at line 270 of file FormatToken.h.
unsigned clang::format::FormatToken::OriginalColumn = 0 |
The original 0-based column of this token, including expanded tabs.
The configured TabWidth is used as tab width.
Definition at line 215 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::addUntouchableToken(), clang::format::FormatTokenLexer::lex(), and clang::format::TokenAnnotator::setCommentLineLevels().
ParameterPackingKind clang::format::FormatToken::PackingKind = PPK_Inconclusive |
If this is an opening parenthesis, how are the parameters packed?
Definition at line 207 of file FormatToken.h.
unsigned clang::format::FormatToken::ParameterCount = 0 |
Number of parameters, if this is "(", "[" or "<".
Definition at line 192 of file FormatToken.h.
unsigned clang::format::FormatToken::ParameterIndex = 0 |
The 0-based index of the parameter/argument.
For ObjC it is set for the selector name token. For now calculated only for ObjC.
Definition at line 251 of file FormatToken.h.
tok::TokenKind clang::format::FormatToken::ParentBracket = tok::unknown |
If this is a bracket ("<", "(", "[" or "{"), contains the kind of the surrounding bracket.
Definition at line 200 of file FormatToken.h.
Is this token part of a DeclStmt
defining multiple variables?
Only set if Type
== TT_StartOfName
.
Definition at line 279 of file FormatToken.h.
FormatToken* clang::format::FormatToken::Previous = nullptr |
The previous token in the unwrapped line.
Definition at line 290 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), getPreviousNonComment(), clang::format::isAllmanBrace(), clang::format::opensProtoMessageField(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), clang::format::printDebugInfo(), and clang::format::startsSegmentOfBuilderTypeCall().
std::unique_ptr<TokenRole> clang::format::FormatToken::Role |
A token can have a special role that can carry extra information about the token's formatting.
Definition at line 204 of file FormatToken.h.
unsigned clang::format::FormatToken::SpacesRequiredBefore = 0 |
The number of spaces that should be inserted before this token.
Definition at line 183 of file FormatToken.h.
unsigned clang::format::FormatToken::SplitPenalty = 0 |
Penalty for inserting a line break before this token.
Definition at line 234 of file FormatToken.h.
true
if this token starts a binary expression, i.e.
has at least one fake l_paren with a precedence greater than prec::Unknown.
Definition at line 264 of file FormatToken.h.
Token clang::format::FormatToken::Tok |
The Token
.
Definition at line 128 of file FormatToken.h.
Referenced by clang::format::hash_combine(), clang::format::AdditionalKeywords::IsJavaScriptIdentifier(), isSimpleTypeSpecifier(), clang::format::FormatTokenLexer::lex(), clang::format::mustBeJSIdent(), clang::format::mustBeJSIdentOrValue(), and clang::format::printDebugInfo().
StringRef clang::format::FormatToken::TokenText |
The raw text of the token.
Contains the raw token text without leading whitespace and without leading escaped newlines.
Definition at line 172 of file FormatToken.h.
Referenced by clang::format::AffectedRangeManager::affectsCharSourceRange(), clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableStringLiteral::BreakableStringLiteral(), clang::format::continuesLineCommentSection(), clang::format::ContinuationIndenter::getColumnLimit(), clang::format::getEnclosingFunctionName(), isLabelString(), clang::format::FormatTokenLexer::lex(), and clang::format::switchesFormatting().
unsigned clang::format::FormatToken::TotalLength = 0 |
The total length of the unwrapped line up to and including this token.
Definition at line 211 of file FormatToken.h.
Referenced by clang::format::TokenAnnotator::calculateFormattingInformation(), clang::format::CodePointsBetween(), and clang::format::getLengthToNextOperator().
TokenType clang::format::FormatToken::Type = TT_Unknown |
Definition at line 180 of file FormatToken.h.
Referenced by clang::format::CommaSeparatedList::formatAfterToken(), and clang::format::FormatTokenLexer::lex().
unsigned clang::format::FormatToken::UnbreakableTailLength = 0 |
The length of following tokens until the next natural split point, or the next token that can be broken.
Definition at line 219 of file FormatToken.h.
Referenced by clang::format::ContinuationIndenter::getColumnLimit(), and clang::format::getEnclosingFunctionName().
SourceRange clang::format::FormatToken::WhitespaceRange |
The range of the whitespace immediately preceding the Token
.
Definition at line 141 of file FormatToken.h.
Referenced by clang::format::WhitespaceManager::addUntouchableToken(), clang::format::AffectedRangeManager::affectsCharSourceRange(), clang::format::FormatTokenLexer::lex(), and clang::format::WhitespaceManager::replaceWhitespace().