Lines Matching defs:Tok
30 // the ), ], } or > matching \c Tok.
31 static unsigned getLengthToMatchingParen(const FormatToken &Tok) {
32 if (!Tok.MatchingParen)
34 FormatToken *End = Tok.MatchingParen;
38 return End->TotalLength - Tok.TotalLength + 1;
41 // Returns \c true if \c Tok is the "." or "->" of a call and starts the next
43 static bool startsSegmentOfBuilderTypeCall(const FormatToken &Tok) {
44 return Tok.isMemberAccess() && Tok.Previous && Tok.Previous->closesScope();
54 return Previous.is(tok::comma) && !Current.isTrailingComment() &&
100 if (!Current.MustBreakBefore && Previous.is(tok::l_brace) &&
103 Previous.Previous->isOneOf(tok::l_brace, tok::l_paren, tok::comma))
110 if (Previous.opensScope() && Previous.isNot(tok::l_brace) &&
119 Previous.is(tok::l_brace) && State.Stack.size() > 1 &&
135 if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
137 if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
139 (Current.is(tok::question) || (Current.Type == TT_ConditionalExpr &&
140 Previous.isNot(tok::question)))) ||
142 (Previous.is(tok::question) || Previous.Type == TT_ConditionalExpr))) &&
144 !Current.isOneOf(tok::r_paren, tok::r_brace))
148 !Previous.isOneOf(tok::kw_return, tok::lessless, tok::at) &&
152 if (((Previous.Type == TT_DictLiteral && Previous.is(tok::l_brace)) ||
186 !Current.isTrailingComment() && !Previous.is(tok::lessless) &&
193 if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator &&
208 Current.is(tok::kw_operator)) &&
222 Previous.is(tok::l_brace) && !Current.isOneOf(tok::r_brace, tok::comment))
235 (Current.Previous->Tok.getIdentifierInfo() == nullptr ||
236 Current.Previous->Tok.getIdentifierInfo()->getPPKeywordID() ==
237 tok::pp_not_keyword))) {
261 if (Current.is(tok::equal) &&
262 (State.Line->First->is(tok::kw_for) || Current.NestingLevel == 0) &&
266 const FormatToken *Tok = &Previous;
267 while (Tok && State.Stack.back().VariablePos >= Tok->ColumnWidth) {
268 State.Stack.back().VariablePos -= Tok->ColumnWidth;
269 if (Tok->SpacesRequiredBefore != 0)
271 Tok = Tok->Previous;
304 if (Current.isNot(tok::comment) && Previous.is(tok::l_paren) &&
305 Previous.Previous && Previous.Previous->isOneOf(tok::kw_if, tok::kw_for))
309 else if (!Current.isOneOf(tok::comment, tok::caret) &&
310 (Previous.is(tok::comma) ||
311 (Previous.is(tok::colon) && Previous.Type == TT_ObjCMethodExpr)))
317 (Previous.isNot(tok::lessless) || Previous.OperatorIndex != 0 ||
368 if (NextNonComment->is(tok::lessless) &&
390 } else if (PreviousNonComment && PreviousNonComment->is(tok::colon) &&
408 if ((Previous.isOneOf(tok::comma, tok::semi) &&
414 if (NextNonComment->is(tok::question) ||
415 (PreviousNonComment && PreviousNonComment->is(tok::question)))
434 Current.is(tok::r_brace) &&
444 !PreviousNonComment->isOneOf(tok::comma, tok::semi) &&
453 (PreviousNonComment->is(tok::l_brace) ||
461 if (!(Previous.isOneOf(tok::l_paren, tok::l_brace) ||
485 if (NextNonComment->is(tok::l_brace) && NextNonComment->BlockKind == BK_Block)
488 if (Current.isOneOf(tok::r_brace, tok::r_square)) {
499 if (Current.is(tok::identifier) && Current.Next &&
504 if (NextNonComment->is(tok::lessless) &&
515 ((NextNonComment->is(tok::colon) &&
519 if (Previous.is(tok::comma) && State.Stack.back().VariablePos != 0)
524 (NextNonComment->is(tok::kw_operator) ||
551 Previous.isOneOf(tok::coloncolon, tok::equal)) {
554 if (PreviousNonComment && PreviousNonComment->is(tok::colon) &&
563 PreviousNonComment->isNot(tok::r_brace))
577 if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator) {
583 if ((Current.Type == TT_BinaryOperator && Current.isNot(tok::lessless)) ||
589 if ((Current.is(tok::question) && Style.BreakBeforeTernaryOperators) ||
590 (Current.getPreviousNonComment() && Current.isNot(tok::colon) &&
591 Current.getPreviousNonComment()->is(tok::question) &&
631 if (Current.isNot(tok::comment) && Previous && Previous->is(tok::l_brace) &&
651 } else if (!Current.isOneOf(tok::comment, tok::identifier, tok::hash) &&
686 (Previous && (Previous->opensScope() || Previous->is(tok::kw_return) ||
699 if (!Previous || Previous->isNot(tok::kw_return) || *I > 0)
712 bool BreakBeforeOperator = Previous->is(tok::lessless) ||
747 // Remove the fake r_parens after 'Tok'.
748 static void consumeRParens(LineState& State, const FormatToken &Tok) {
749 for (unsigned i = 0, e = Tok.FakeRParens; i != e; ++i) {
761 // Returns whether 'Tok' opens or closes a scope requiring special handling
779 const FormatToken &Tok = *State.NextToken;
780 if (!Tok.MatchingParen)
782 const FormatToken *Left = &Tok;
783 if (Tok.isOneOf(tok::r_brace, tok::r_square))
784 Left = Tok.MatchingParen;
786 Left->isOneOf(tok::l_brace, tok::l_square) &&
816 if (Current.is(tok::l_brace) || Current.Type == TT_ArrayInitializerLSquare) {
870 (Current.isOneOf(tok::r_paren, tok::r_square) ||
871 (Current.is(tok::r_brace) && State.NextToken != State.Line->First) ||
875 if (Current.is(tok::r_square)) {
878 if (NextNonComment && NextNonComment->isNot(tok::l_square))
947 if (!Current.isStringLiteral() && !Current.is(tok::comment))
976 Current.Previous->is(tok::at)) {