Lines Matching refs:tok

32   return Line.startsWith(tok::kw_for) || Line.startsWith(tok::kw_if) ||  in startsWithInitStatement()
33 Line.startsWith(tok::kw_switch); in startsWithInitStatement()
55 if (Left->Previous && Left->Previous->is(tok::greater) && in isLambdaParameterList()
62 return Left->Previous && Left->Previous->is(tok::r_square) && in isLambdaParameterList()
70 return Tok.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch, in isKeywordWithCondition()
71 tok::kw_constexpr, tok::kw_catch); in isKeywordWithCondition()
85 Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false)); in AnnotatingParser()
100 if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && in parseAngle()
110 ScopedContextCreator ContextCreator(*this, tok::less, 12); in parseAngle()
119 if (Left->Previous && Left->Previous->isNot(tok::kw_template)) in parseAngle()
123 CurrentToken->is(tok::question)) { in parseAngle()
128 if (CurrentToken->is(tok::greater)) { in parseAngle()
135 if (CurrentToken->Next && CurrentToken->Next->is(tok::greater) && in parseAngle()
136 Left->ParentBracket != tok::less && in parseAngle()
160 if (CurrentToken->is(tok::question) && in parseAngle()
165 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace) || in parseAngle()
166 (CurrentToken->isOneOf(tok::colon, tok::question) && InExprContext && in parseAngle()
177 if (CurrentToken->Previous->isOneOf(tok::pipepipe, tok::ampamp) && in parseAngle()
180 !Line.startsWith(tok::kw_template)) { in parseAngle()
186 if (CurrentToken->is(tok::colon) || in parseAngle()
187 (CurrentToken->isOneOf(tok::l_brace, tok::less) && in parseAngle()
188 Previous->isNot(tok::colon))) { in parseAngle()
203 case tok::l_paren: in parseUntouchableParens()
208 case tok::r_paren: in parseUntouchableParens()
225 assert(OpeningParen.is(tok::l_paren)); in parseParens()
228 ScopedContextCreator ContextCreator(*this, tok::l_paren, 1); in parseParens()
243 if (MaybeSel->isObjCAtKeyword(tok::objc_selector) && MaybeSel->Previous && in parseParens()
244 MaybeSel->Previous->is(tok::at)) { in parseParens()
252 while (!Prev->is(tok::kw_operator)) { in parseParens()
261 Prev->Previous && Prev->Previous->isOneOf(tok::period, tok::arrow); in parseParens()
264 (Line.startsWith(Keywords.kw_type, tok::identifier) || in parseParens()
265 Line.startsWith(tok::kw_export, Keywords.kw_type, in parseParens()
266 tok::identifier))) { in parseParens()
271 (OpeningParen.Previous->isOneOf(tok::kw_static_assert, in parseParens()
272 tok::kw_while, tok::l_paren, in parseParens()
273 tok::comma, TT_BinaryOperator) || in parseParens()
279 (OpeningParen.Previous->endsSequence(tok::identifier, in parseParens()
292 !OpeningParen.Previous->is(tok::identifier))) { in parseParens()
308 OpeningParen.Previous->isOneOf(tok::kw_for, tok::kw_catch); in parseParens()
315 if (PrevNonComment->is(tok::kw___attribute)) { in parseParens()
317 } else if (PrevNonComment->isOneOf(TT_TypenameMacro, tok::kw_decltype, in parseParens()
318 tok::kw_typeof, tok::kw__Atomic, in parseParens()
319 tok::kw___underlying_type)) { in parseParens()
322 if (PrevNonComment->isOneOf(tok::kw_decltype, tok::kw_typeof)) in parseParens()
342 CurrentToken->isOneOf(tok::star, tok::amp, tok::ampamp, tok::caret); in parseParens()
346 OpeningParen.Previous && OpeningParen.Previous->is(tok::kw_for); in parseParens()
358 if (PrevPrev && PrevPrev->is(tok::identifier) && in parseParens()
359 Prev->isOneOf(tok::star, tok::amp, tok::ampamp) && in parseParens()
360 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) { in parseParens()
368 CurrentToken->Previous->Previous->isOneOf(tok::l_paren, in parseParens()
369 tok::coloncolon)) { in parseParens()
372 if (CurrentToken->is(tok::comma)) in parseParens()
376 if (CurrentToken->is(tok::r_paren)) { in parseParens()
379 (CurrentToken->Next->is(tok::l_paren) || in parseParens()
380 (CurrentToken->Next->is(tok::l_square) && in parseParens()
382 OpeningParen.setType(OpeningParen.Next->is(tok::caret) in parseParens()
389 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_brace) && in parseParens()
390 OpeningParen.Previous && OpeningParen.Previous->is(tok::l_paren)) { in parseParens()
397 Tok->isOneOf(tok::star, tok::amp, tok::ampamp)) { in parseParens()
438 if (CurrentToken->isOneOf(tok::r_square, tok::r_brace)) in parseParens()
441 if (CurrentToken->is(tok::l_brace) && OpeningParen.is(TT_ObjCBlockLParen)) in parseParens()
443 if (CurrentToken->is(tok::comma) && CurrentToken->Next && in parseParens()
449 (CurrentToken->is(tok::l_paren) && CurrentToken->Next && in parseParens()
450 CurrentToken->Next->isOneOf(tok::star, tok::amp, tok::caret)); in parseParens()
451 if ((CurrentToken->Previous->isOneOf(tok::kw_const, tok::kw_auto) || in parseParens()
453 !(CurrentToken->is(tok::l_brace) || in parseParens()
454 (CurrentToken->is(tok::l_paren) && !ProbablyFunctionTypeLParen))) { in parseParens()
457 if (CurrentToken->isOneOf(tok::semi, tok::colon)) { in parseParens()
470 if (CurrentToken->is(tok::comma)) in parseParens()
488 if (Tok.Previous && Tok.Previous->is(tok::identifier)) in isCSharpAttributeSpecifier()
492 if (Tok.Previous && Tok.Previous->is(tok::r_square)) { in isCSharpAttributeSpecifier()
503 if (AttrTok->is(tok::r_square)) in isCSharpAttributeSpecifier()
507 while (AttrTok && AttrTok->isNot(tok::r_square)) in isCSharpAttributeSpecifier()
519 if (AttrTok->isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, in isCSharpAttributeSpecifier()
520 tok::comment, tok::kw_class, tok::kw_static, in isCSharpAttributeSpecifier()
521 tok::l_square, Keywords.kw_internal)) { in isCSharpAttributeSpecifier()
527 AttrTok->Next->startsSequence(tok::identifier, tok::l_paren)) { in isCSharpAttributeSpecifier()
535 if (!Style.isCpp() || !Tok.startsSequence(tok::l_square, tok::l_square)) in isCpp11AttributeSpecifier()
538 if (Tok.Previous && Tok.Previous->is(tok::at)) in isCpp11AttributeSpecifier()
545 if (AttrTok->startsSequence(tok::kw_using, tok::identifier, tok::colon)) in isCpp11AttributeSpecifier()
547 if (AttrTok->isNot(tok::identifier)) in isCpp11AttributeSpecifier()
549 while (AttrTok && !AttrTok->startsSequence(tok::r_square, tok::r_square)) { in isCpp11AttributeSpecifier()
553 if (AttrTok->is(tok::colon) || in isCpp11AttributeSpecifier()
554 AttrTok->startsSequence(tok::identifier, tok::identifier) || in isCpp11AttributeSpecifier()
555 AttrTok->startsSequence(tok::r_paren, tok::identifier)) { in isCpp11AttributeSpecifier()
558 if (AttrTok->is(tok::ellipsis)) in isCpp11AttributeSpecifier()
562 return AttrTok && AttrTok->startsSequence(tok::r_square, tok::r_square); in isCpp11AttributeSpecifier()
593 bool InsideInlineASM = Line.startsWith(tok::kw_asm); in parseSquare()
600 !CurrentToken->isOneOf(tok::l_brace, tok::r_square) && in parseSquare()
602 Parent->isOneOf(tok::colon, tok::l_square, tok::l_paren, in parseSquare()
603 tok::kw_return, tok::kw_throw) || in parseSquare()
622 Contexts.back().ContextKind == tok::l_brace && in parseSquare()
623 Parent->isOneOf(tok::l_brace, tok::comma)) { in parseSquare()
625 } else if (Style.isCpp() && Contexts.back().ContextKind == tok::l_brace && in parseSquare()
626 Parent && Parent->isOneOf(tok::l_brace, tok::comma)) { in parseSquare()
630 } else if (CurrentToken->is(tok::r_square) && Parent && in parseSquare()
662 if (!Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
663 tok::equal) && in parseSquare()
664 !Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
665 tok::identifier) && in parseSquare()
666 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) { in parseSquare()
671 Parent->isOneOf(TT_BinaryOperator, TT_TemplateCloser, tok::at, in parseSquare()
672 tok::comma, tok::l_paren, tok::l_square, in parseSquare()
673 tok::question, tok::colon, tok::kw_return, in parseSquare()
675 tok::kw_default)) { in parseSquare()
683 ScopedContextCreator ContextCreator(*this, tok::l_square, BindingIncrease); in parseSquare()
693 if (CurrentToken->is(tok::r_square)) { in parseSquare()
699 CurrentToken->Next->is(tok::l_paren)) || in parseSquare()
755 if (CurrentToken->isOneOf(tok::r_paren, tok::r_brace)) in parseSquare()
757 if (CurrentToken->is(tok::colon)) { in parseSquare()
759 CurrentToken->endsSequence(tok::colon, tok::identifier, in parseSquare()
760 tok::kw_using)) { in parseSquare()
769 if (Parent && Parent->is(tok::r_paren)) { in parseSquare()
776 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
797 if (Last->ContextKind == tok::l_brace) in couldBeInStructArrayInitializer()
799 return Depth == 2 && Last->ContextKind != tok::l_brace; in couldBeInStructArrayInitializer()
808 assert(OpeningBrace.is(tok::l_brace)); in parseBrace()
815 ScopedContextCreator ContextCreator(*this, tok::l_brace, 1); in parseBrace()
826 if (CurrentToken->is(tok::r_brace)) { in parseBrace()
831 if (OpeningBrace.ParentBracket == tok::l_brace && in parseBrace()
839 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square)) in parseBrace()
842 if (CurrentToken->isOneOf(tok::colon, tok::l_brace, tok::less)) { in parseBrace()
846 if ((CurrentToken->is(tok::colon) && in parseBrace()
852 Previous->is(tok::string_literal)) { in parseBrace()
856 if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown)) in parseBrace()
861 if (CurrentToken->is(tok::comma)) { in parseBrace()
876 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
878 if (Current->is(tok::comma)) { in updateParameterCount()
883 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
890 if (CurrentToken->is(tok::colon)) { in parseConditional()
902 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTemplateDeclaration()
918 case tok::plus: in consumeToken()
919 case tok::minus: in consumeToken()
923 case tok::colon: in consumeToken()
930 !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) || in consumeToken()
931 Contexts.back().ContextKind == tok::l_paren || // function params in consumeToken()
932 Contexts.back().ContextKind == tok::l_square || // array type in consumeToken()
934 Contexts.back().ContextKind == tok::l_brace) || // object type in consumeToken()
946 if (Contexts.back().ContextKind == tok::l_paren) { in consumeToken()
952 Line.First->startsSequence(tok::kw_export, Keywords.kw_module) || in consumeToken()
953 Line.First->startsSequence(tok::kw_export, Keywords.kw_import)) { in consumeToken()
971 Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); in consumeToken()
976 BeforePrevious->is(tok::colon))) || in consumeToken()
977 BeforePrevious->is(tok::r_square) || in consumeToken()
994 } else if (CurrentToken && CurrentToken->is(tok::numeric_constant)) { in consumeToken()
997 !Line.First->isOneOf(tok::kw_enum, tok::kw_case, in consumeToken()
998 tok::kw_default)) { in consumeToken()
1002 if (Prev->isOneOf(tok::r_paren, tok::kw_noexcept) || in consumeToken()
1005 } else if (Prev->is(tok::kw_try)) { in consumeToken()
1010 if (PrevPrev && PrevPrev->isOneOf(tok::r_paren, tok::kw_noexcept)) in consumeToken()
1016 (Tok->Next->isOneOf(tok::r_paren, tok::comma) || in consumeToken()
1018 Tok->Next->Next->is(tok::colon)))) { in consumeToken()
1022 } else if (Contexts.back().ContextKind == tok::l_paren) { in consumeToken()
1026 case tok::pipe: in consumeToken()
1027 case tok::amp: in consumeToken()
1033 case tok::kw_if: in consumeToken()
1035 CurrentToken->isOneOf(tok::kw_constexpr, tok::identifier)) { in consumeToken()
1039 case tok::kw_while: in consumeToken()
1040 if (CurrentToken && CurrentToken->is(tok::l_paren)) { in consumeToken()
1046 case tok::kw_for: in consumeToken()
1049 if ((Tok->Previous && Tok->Previous->is(tok::period)) || in consumeToken()
1050 (Tok->Next && Tok->Next->is(tok::colon))) { in consumeToken()
1057 if (Style.isCpp() && CurrentToken && CurrentToken->is(tok::kw_co_await)) in consumeToken()
1060 if (!CurrentToken || CurrentToken->isNot(tok::l_paren)) in consumeToken()
1066 case tok::l_paren: in consumeToken()
1071 if (Tok->Previous && Tok->Previous->is(tok::r_paren) && in consumeToken()
1085 !Tok->Previous->isOneOf(tok::kw___attribute, in consumeToken()
1090 case tok::l_square: in consumeToken()
1094 case tok::l_brace: in consumeToken()
1103 case tok::less: in consumeToken()
1126 case tok::r_paren: in consumeToken()
1127 case tok::r_square: in consumeToken()
1129 case tok::r_brace: in consumeToken()
1134 case tok::greater: in consumeToken()
1140 case tok::kw_operator: in consumeToken()
1146 !CurrentToken->isOneOf(tok::l_paren, tok::semi, tok::r_paren)) { in consumeToken()
1147 if (CurrentToken->isOneOf(tok::star, tok::amp)) in consumeToken()
1150 if (CurrentToken && CurrentToken->is(tok::comma) && in consumeToken()
1151 CurrentToken->Previous->isNot(tok::kw_operator)) { in consumeToken()
1155 TT_BinaryOperator, TT_UnaryOperator, tok::comma, in consumeToken()
1156 tok::star, tok::arrow, tok::amp, tok::ampamp)) { in consumeToken()
1160 if (CurrentToken && CurrentToken->is(tok::l_paren)) in consumeToken()
1165 case tok::question: in consumeToken()
1167 Tok->Next->isOneOf(tok::semi, tok::comma, tok::colon, tok::r_paren, in consumeToken()
1168 tok::r_brace)) { in consumeToken()
1187 (Tok->Next && Tok->Next->isOneOf(tok::r_paren, tok::greater)) || in consumeToken()
1188 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next && in consumeToken()
1189 Tok->Next->Next->is(tok::equal))) { in consumeToken()
1196 case tok::kw_template: in consumeToken()
1199 case tok::comma: in consumeToken()
1218 case tok::identifier: in consumeToken()
1224 Tok->Next->isNot(tok::l_paren)) { in consumeToken()
1229 case tok::arrow: in consumeToken()
1231 Tok->Previous->is(tok::kw_noexcept)) { in consumeToken()
1244 if (CurrentToken->is(tok::less)) { in parseCSharpGenericTypeConstraint()
1249 } else if (CurrentToken->is(tok::greater)) { in parseCSharpGenericTypeConstraint()
1253 } else if (CurrentToken->is(tok::comma) && OpenAngleBracketsCount == 0) { in parseCSharpGenericTypeConstraint()
1261 } else if (CurrentToken->is(tok::colon)) { in parseCSharpGenericTypeConstraint()
1271 if (CurrentToken && CurrentToken->is(tok::less)) { in parseIncludeDirective()
1276 if (CurrentToken->isNot(tok::comment) && in parseIncludeDirective()
1313 if (!CurrentToken || !CurrentToken->is(tok::l_paren)) in parseHasInclude()
1339 if (CurrentToken->is(tok::numeric_constant)) { in parsePreprocessorDirective()
1352 case tok::pp_include: in parsePreprocessorDirective()
1353 case tok::pp_include_next: in parsePreprocessorDirective()
1354 case tok::pp_import: in parsePreprocessorDirective()
1359 case tok::pp_error: in parsePreprocessorDirective()
1360 case tok::pp_warning: in parsePreprocessorDirective()
1363 case tok::pp_pragma: in parsePreprocessorDirective()
1366 case tok::pp_if: in parsePreprocessorDirective()
1367 case tok::pp_elif: in parsePreprocessorDirective()
1378 if (Tok->is(tok::l_paren)) { in parsePreprocessorDirective()
1393 if (CurrentToken->is(tok::hash)) { in parseLine()
1408 (Info && Info->getPPKeywordID() == tok::pp_import && in parseLine()
1410 CurrentToken->Next->isOneOf(tok::string_literal, tok::identifier, in parseLine()
1411 tok::kw_static))) { in parseLine()
1419 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
1429 if (CurrentToken && CurrentToken->is(tok::identifier)) { in parseLine()
1444 if (CurrentToken->is(tok::kw_virtual)) in parseLine()
1453 if (Line.First->is(tok::kw_export) && in parseLine()
1488 return Tok.TokenText == "goog" && Tok.Next && Tok.Next->is(tok::period) && in isClosureImportStatement()
1495 Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren); in isClosureImportStatement()
1541 Context(tok::TokenKind ContextKind, unsigned BindingStrength, in Context()
1546 tok::TokenKind ContextKind;
1582 ScopedContextCreator(AnnotatingParser &P, tok::TokenKind ContextKind, in ScopedContextCreator()
1607 if (Line.First->isOneOf(tok::kw_using, tok::kw_return)) in modifyContext()
1609 if (Line.First->is(tok::kw_template)) { in modifyContext()
1611 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
1631 if (Tok->isOneOf(tok::kw_class, tok::kw_enum, tok::kw_concept, in modifyContext()
1632 tok::kw_struct, tok::kw_using)) { in modifyContext()
1642 (Line.startsWith(Keywords.kw_type, tok::identifier) || in modifyContext()
1643 Line.startsWith(tok::kw_export, Keywords.kw_type, in modifyContext()
1644 tok::identifier))) { in modifyContext()
1648 return !Current.Previous || Current.Previous->isNot(tok::kw_operator); in modifyContext()
1656 !Previous->Previous->isOneOf(tok::comma, tok::semi); in modifyContext()
1658 if (Previous->isOneOf(tok::r_square, tok::r_paren)) { in modifyContext()
1666 Previous->isOneOf(tok::star, tok::amp, tok::ampamp) && in modifyContext()
1667 Previous->Previous && Previous->Previous->isNot(tok::equal)) { in modifyContext()
1672 } else if (Current.is(tok::lessless) && in modifyContext()
1673 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1675 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
1687 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
1689 Previous && Previous->isOneOf(tok::star, tok::amp); in modifyContext()
1697 } else if (Current.is(tok::kw_new)) { in modifyContext()
1699 } else if (Current.is(tok::semi) || in modifyContext()
1700 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1701 !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1713 if (Current->is(tok::l_paren)) in untilMatchingParen()
1715 if (Current->is(tok::r_paren)) in untilMatchingParen()
1726 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1727 Current.startsSequence(tok::arrow, tok::identifier, tok::less)) { in isDeductionGuide()
1733 if (TemplateCloser->is(tok::l_paren)) { in isDeductionGuide()
1739 if (TemplateCloser->is(tok::less)) in isDeductionGuide()
1741 if (TemplateCloser->is(tok::greater)) in isDeductionGuide()
1750 TemplateCloser->Next->is(tok::semi) && in isDeductionGuide()
1763 PriorLeadingIdentifier->is(tok::kw_explicit)) { in isDeductionGuide()
1784 Current.is(tok::exclaim)) { in determineTokenType()
1790 : Current.Previous->is(tok::identifier); in determineTokenType()
1793 tok::kw_default, tok::kw_namespace, tok::r_paren, tok::r_square, in determineTokenType()
1794 tok::r_brace, tok::kw_false, tok::kw_true, Keywords.kw_type, in determineTokenType()
1817 } else if (Current.is(tok::semi)) { in determineTokenType()
1822 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
1824 } else if (Current.is(tok::arrow) && in determineTokenType()
1827 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1829 !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) { in determineTokenType()
1832 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
1833 Current.Previous->is(tok::r_brace)) { in determineTokenType()
1840 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1845 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
1847 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1849 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1851 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1853 } else if (Current.is(tok::question)) { in determineTokenType()
1863 (!Current.Previous || Current.Previous->isNot(tok::l_square)) && in determineTokenType()
1864 (!Current.is(tok::greater) && in determineTokenType()
1867 } else if (Current.is(tok::comment)) { in determineTokenType()
1874 Current.Tok.setKind(tok::unknown); in determineTokenType()
1879 } else if (Current.is(tok::l_paren)) { in determineTokenType()
1882 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1887 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1888 tok::comma, tok::period, tok::arrow, in determineTokenType()
1889 tok::coloncolon)) { in determineTokenType()
1892 if (AfterParen->isNot(tok::caret)) { in determineTokenType()
1894 if (BeforeParen->is(tok::identifier) && in determineTokenType()
1905 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
1910 case tok::objc_interface: in determineTokenType()
1911 case tok::objc_implementation: in determineTokenType()
1912 case tok::objc_protocol: in determineTokenType()
1915 case tok::objc_property: in determineTokenType()
1921 } else if (Current.is(tok::period)) { in determineTokenType()
1924 PreviousNoComment->isOneOf(tok::comma, tok::l_brace)) { in determineTokenType()
1943 } else if (Current.isOneOf(tok::identifier, tok::kw_const, tok::kw_noexcept, in determineTokenType()
1944 tok::kw_requires) && in determineTokenType()
1946 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
1954 if (Current.Previous->is(tok::at) && in determineTokenType()
1962 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1976 if (Tok.isNot(tok::identifier) || !Tok.Previous) in isStartOfName()
1991 while (PreviousNotConst && PreviousNotConst->is(tok::kw_const)) in isStartOfName()
2000 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) && in isStartOfName()
2002 PreviousNotConst->Previous->is(tok::hash); in isStartOfName()
2007 PreviousNotConst->MatchingParen->Previous->isNot(tok::period) && in isStartOfName()
2008 PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template); in isStartOfName()
2011 if (PreviousNotConst->is(tok::r_paren) && in isStartOfName()
2021 if (PreviousNotConst->isOneOf(tok::identifier, tok::kw_auto)) in isStartOfName()
2033 return Style.isJavaScript() && PreviousNotConst->is(tok::kw_const); in isStartOfName()
2047 Prev->isOneOf(tok::kw_const_cast, tok::kw_dynamic_cast, in lParenStartsCppCast()
2048 tok::kw_reinterpret_cast, tok::kw_static_cast)) { in lParenStartsCppCast()
2073 if (LeftOfParens->is(tok::r_paren) && in rParenEndsCast()
2082 if (LeftOfParens->is(tok::r_square)) { in rParenEndsCast()
2085 if (Tok->isNot(tok::r_square)) in rParenEndsCast()
2089 if (!Tok || Tok->isNot(tok::l_square)) in rParenEndsCast()
2093 if (!Tok || Tok->isNot(tok::kw_delete)) in rParenEndsCast()
2105 LeftOfParens->Previous->is(tok::kw_operator)) { in rParenEndsCast()
2112 !LeftOfParens->isOneOf(Keywords.kw_in, tok::kw_return, tok::kw_case, in rParenEndsCast()
2113 tok::kw_delete)) { in rParenEndsCast()
2119 if (LeftOfParens->isOneOf(tok::at, tok::r_square, TT_OverloadedOperator, in rParenEndsCast()
2120 TT_TemplateCloser, tok::ellipsis)) { in rParenEndsCast()
2125 if (Tok.Next->is(tok::question)) in rParenEndsCast()
2134 if (Tok.Next->isOneOf(tok::kw_noexcept, tok::kw_volatile, tok::kw_const, in rParenEndsCast()
2135 tok::kw_requires, tok::kw_throw, tok::arrow, in rParenEndsCast()
2143 if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren)) in rParenEndsCast()
2147 if (Tok.Next->isNot(tok::string_literal) && in rParenEndsCast()
2149 Tok.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof))) { in rParenEndsCast()
2163 T->MatchingParen->Previous->is(tok::kw___attribute)) { in rParenEndsCast()
2187 Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater); in rParenEndsCast()
2207 if (Tok.Next->isOneOf(tok::identifier, tok::kw_this)) in rParenEndsCast()
2211 if (Tok.Next->is(tok::l_paren) && Tok.Previous && Tok.Previous->Previous) { in rParenEndsCast()
2212 if (Tok.Previous->is(tok::identifier) && in rParenEndsCast()
2213 Tok.Previous->Previous->is(tok::l_paren)) { in rParenEndsCast()
2225 Tok.Next->isUnaryOperator() || Tok.Next->isOneOf(tok::amp, tok::star); in rParenEndsCast()
2226 if (!NextIsUnary || Tok.Next->is(tok::plus) || in rParenEndsCast()
2227 !Tok.Next->Next->isOneOf(tok::identifier, tok::numeric_constant)) { in rParenEndsCast()
2233 if (!Prev->isOneOf(tok::kw_const, tok::identifier, tok::coloncolon)) in rParenEndsCast()
2252 TT_ConditionalExpr, tok::l_paren, tok::comma, tok::colon, tok::semi, in determineUnaryOperatorByUsage()
2253 tok::equal, tok::question, tok::l_square, tok::l_brace, in determineUnaryOperatorByUsage()
2254 tok::kw_case, tok::kw_co_await, tok::kw_co_return, tok::kw_co_yield, in determineUnaryOperatorByUsage()
2255 tok::kw_delete, tok::kw_return, tok::kw_throw)) { in determineUnaryOperatorByUsage()
2262 if (PrevToken->is(tok::kw_sizeof)) in determineUnaryOperatorByUsage()
2283 if (Style.isCSharp() && Tok.is(tok::ampamp)) in determineStarAmpUsage()
2292 if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) in determineStarAmpUsage()
2296 NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_noexcept) || in determineStarAmpUsage()
2298 (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) { in determineStarAmpUsage()
2302 if (PrevToken->is(tok::coloncolon)) in determineStarAmpUsage()
2305 if (PrevToken->is(tok::r_paren) && PrevToken->is(TT_TypeDeclarationParen)) in determineStarAmpUsage()
2311 if (NextToken->is(tok::l_square) && NextToken->isNot(TT_LambdaLSquare)) in determineStarAmpUsage()
2313 if (NextToken->is(tok::kw_operator) && !IsExpression) in determineStarAmpUsage()
2315 if (NextToken->isOneOf(tok::comma, tok::semi)) in determineStarAmpUsage()
2328 if (PrevToken->is(tok::r_brace) && Tok.is(tok::star) && in determineStarAmpUsage()
2333 PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true, in determineStarAmpUsage()
2334 tok::kw_false, tok::r_brace)) { in determineStarAmpUsage()
2339 while (NextNonParen && NextNonParen->is(tok::l_paren)) in determineStarAmpUsage()
2342 NextNonParen->isOneOf(tok::kw_true, tok::kw_false) || in determineStarAmpUsage()
2354 if (Tok.is(tok::ampamp) && NextToken->is(tok::l_paren)) in determineStarAmpUsage()
2361 if (NextNextToken && NextNextToken->is(tok::arrow)) in determineStarAmpUsage()
2381 if (PrevToken->is(tok::at)) in determinePlusMinusCaretUsage()
2393 if (PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::identifier)) in determineIncrementUsage()
2429 while (Current && (Current->is(tok::kw_return) || in parse()
2430 (Current->is(tok::colon) && in parse()
2475 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2542 NextNonComment->is(tok::less)))) { in getCurrentPrecedence()
2551 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) || in getCurrentPrecedence()
2552 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2566 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2568 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
2613 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
2664 NextNonCommentLine = Line->First->isNot(tok::r_brace) ? Line : nullptr; in setCommentLineLevels()
2719 if (Next->isOneOf(tok::kw_new, tok::kw_delete)) { in isFunctionDeclarationName()
2722 Next->Next->startsSequence(tok::l_square, tok::r_square)) { in isFunctionDeclarationName()
2727 if (Next->startsSequence(tok::l_square, tok::r_square)) { in isFunctionDeclarationName()
2732 if ((Next->isSimpleTypeSpecifier() || Next->is(tok::identifier)) && in isFunctionDeclarationName()
2733 Next->Next && Next->Next->isOneOf(tok::star, tok::amp, tok::ampamp)) { in isFunctionDeclarationName()
2750 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
2751 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
2760 } else if (Next->is(tok::coloncolon)) { in isFunctionDeclarationName()
2764 if (Next->is(tok::kw_operator)) { in isFunctionDeclarationName()
2768 if (!Next->is(tok::identifier)) in isFunctionDeclarationName()
2770 } else if (Next->is(tok::l_paren)) { in isFunctionDeclarationName()
2779 if (!Next || !Next->is(tok::l_paren) || !Next->MatchingParen) in isFunctionDeclarationName()
2782 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
2802 if (IsCpp && Next->Next && Next->Next->is(tok::identifier) && in isFunctionDeclarationName()
2803 !Line.endsWith(tok::semi)) { in isFunctionDeclarationName()
2811 if (Tok->isOneOf(tok::l_paren, TT_TemplateOpener) && Tok->MatchingParen) { in isFunctionDeclarationName()
2815 if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() || in isFunctionDeclarationName()
2816 Tok->isOneOf(TT_PointerOrReference, TT_StartOfName, tok::ellipsis)) { in isFunctionDeclarationName()
2819 if (Tok->isOneOf(tok::l_brace, tok::string_literal, TT_ObjCMethodExpr) || in isFunctionDeclarationName()
2888 if (Parameter->isOneOf(tok::comment, tok::r_brace)) in calculateFormattingInformation()
2890 if (Parameter->Previous && Parameter->Previous->is(tok::comma)) { in calculateFormattingInformation()
2983 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
3001 if (CurrentToken->is(tok::l_brace)) { in calculateArrayInitializerColumnList()
3016 if (CurrentToken->is(tok::l_brace)) in calculateInitializerColumnList()
3018 else if (CurrentToken->is(tok::r_brace)) in calculateInitializerColumnList()
3020 if (Depth == 2 && CurrentToken->isOneOf(tok::l_brace, tok::comma)) { in calculateInitializerColumnList()
3038 if (Left.is(tok::semi)) in splitPenalty()
3046 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
3049 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
3062 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
3064 if (Right.is(tok::l_square)) { in splitPenalty()
3067 if (Left.is(tok::r_square)) in splitPenalty()
3070 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
3079 if (Left.is(tok::coloncolon) || in splitPenalty()
3080 (Right.is(tok::period) && Style.Language == FormatStyle::LK_Proto)) { in splitPenalty()
3084 Right.is(tok::kw_operator)) { in splitPenalty()
3085 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) in splitPenalty()
3097 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3101 if (Left.isOneOf(tok::kw_class, tok::kw_struct)) in splitPenalty()
3103 if (Left.is(tok::comment)) in splitPenalty()
3137 (!Right.Next || Right.Next->isNot(tok::l_paren))) { in splitPenalty()
3148 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
3152 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
3159 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
3165 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3166 Left.Previous->isOneOf(tok::identifier, tok::greater)) { in splitPenalty()
3170 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0) in splitPenalty()
3172 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
3176 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3177 (Left.Previous->is(tok::kw_for) || Left.Previous->isIf())) { in splitPenalty()
3180 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
3182 if (Right.is(tok::r_brace)) in splitPenalty()
3194 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
3204 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && in splitPenalty()
3209 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
3213 if (Left.is(tok::comma)) in splitPenalty()
3215 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
3219 if (Right.is(tok::lessless)) { in splitPenalty()
3221 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
3261 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
3262 !Right.isOneOf(tok::semi, tok::r_paren, tok::hashhash)) { in spaceRequiredBetween()
3265 if (Style.isJson() && Left.is(tok::string_literal) && Right.is(tok::colon)) in spaceRequiredBetween()
3270 Left.Tok.getObjCKeywordID() == tok::objc_property) { in spaceRequiredBetween()
3273 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
3274 return Left.is(tok::hash); in spaceRequiredBetween()
3275 if (Left.isOneOf(tok::hashhash, tok::hash)) in spaceRequiredBetween()
3276 return Right.is(tok::hash); in spaceRequiredBetween()
3277 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
3278 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
3279 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
3284 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
3286 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
3295 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
3299 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && Left.Previous && in spaceRequiredBetween()
3300 Left.Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
3304 if (Left.isOneOf(tok::kw_co_await, tok::kw_co_yield, tok::kw_co_return) && in spaceRequiredBetween()
3305 !Right.isOneOf(tok::semi, tok::r_paren)) { in spaceRequiredBetween()
3309 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
3315 if (Right.isOneOf(tok::semi, tok::comma)) in spaceRequiredBetween()
3317 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
3320 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
3323 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
3325 if (Left.isOneOf(tok::exclaim, tok::tilde)) in spaceRequiredBetween()
3327 if (Left.is(tok::at) && in spaceRequiredBetween()
3328 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant, in spaceRequiredBetween()
3329 tok::numeric_constant, tok::l_paren, tok::l_brace, in spaceRequiredBetween()
3330 tok::kw_true, tok::kw_false)) { in spaceRequiredBetween()
3333 if (Left.is(tok::colon)) in spaceRequiredBetween()
3335 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
3337 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
3342 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
3348 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
3349 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
3350 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
3352 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
3355 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
3380 return !Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
3387 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
3413 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
3422 tok::l_paren)) { in spaceRequiredBetween()
3440 tok::l_paren, tok::coloncolon, tok::l_square); in spaceRequiredBetween()
3443 if (Left.is(tok::ellipsis) && Left.Previous && in spaceRequiredBetween()
3444 Left.Previous->isOneOf(tok::star, tok::amp, tok::ampamp)) { in spaceRequiredBetween()
3448 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
3450 if (Left.is(tok::star) && Right.isOneOf(tok::star, tok::amp, tok::ampamp)) in spaceRequiredBetween()
3452 if (Right.isOneOf(tok::star, tok::amp, tok::ampamp)) { in spaceRequiredBetween()
3454 while (Previous && !Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
3455 if (Previous->is(tok::identifier) || Previous->isSimpleTypeSpecifier()) { in spaceRequiredBetween()
3463 if (Previous->is(tok::coloncolon)) { in spaceRequiredBetween()
3482 if (Previous->endsSequence(tok::kw_operator)) in spaceRequiredBetween()
3484 if (Previous->is(tok::kw_const) || Previous->is(tok::kw_volatile)) { in spaceRequiredBetween()
3498 LSquareTok.endsSequence(tok::l_square, tok::colon, in spaceRequiredBetween()
3501 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
3502 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
3506 Style.SpacesInSquareBrackets && Right.isNot(tok::r_square)); in spaceRequiredBetween()
3508 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
3519 if (Right.is(tok::l_square) && in spaceRequiredBetween()
3523 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral) && in spaceRequiredBetween()
3524 !(!Left.is(tok::r_square) && Style.SpaceBeforeSquareBrackets && in spaceRequiredBetween()
3528 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
3530 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
3531 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
3545 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
3557 if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || in spaceRequiredBetween()
3558 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) { in spaceRequiredBetween()
3571 if (Left.is(tok::semi)) in spaceRequiredBetween()
3573 if (Left.isOneOf(tok::pp_elif, tok::kw_for, tok::kw_while, tok::kw_switch, in spaceRequiredBetween()
3574 tok::kw_case, TT_ForEachMacro, TT_ObjCForIn) || in spaceRequiredBetween()
3595 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
3600 if (!Left.Previous || Left.Previous->isNot(tok::period)) { in spaceRequiredBetween()
3601 if (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch)) { in spaceRequiredBetween()
3605 if (Left.isOneOf(tok::kw_new, tok::kw_delete)) { in spaceRequiredBetween()
3611 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
3613 Left.MatchingParen->Previous->is(tok::kw_delete)) { in spaceRequiredBetween()
3620 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) { in spaceRequiredBetween()
3625 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
3628 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) && in spaceRequiredBetween()
3629 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr)); in spaceRequiredBetween()
3631 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square, in spaceRequiredBetween()
3632 tok::r_paren) || in spaceRequiredBetween()
3634 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
3638 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
3642 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
3651 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
3652 Left.MatchingParen->Previous->is(tok::coloncolon))) { in spaceRequiredBetween()
3658 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
3660 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
3664 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
3665 Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
3670 Right.isOneOf(tok::amp, tok::ampamp) && in spaceRequiredBetween()
3671 Left.isOneOf(tok::kw_const, tok::kw_volatile) && in spaceRequiredBetween()
3672 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
3697 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
3703 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
3711 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
3715 Right.isOneOf(tok::identifier, tok::kw_private)) { in spaceRequiredBefore()
3718 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
3723 if (Left.is(TT_AttributeParen) && Right.is(tok::coloncolon)) in spaceRequiredBefore()
3726 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
3727 return Right.is(tok::coloncolon); in spaceRequiredBefore()
3728 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
3732 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
3738 if (Right.is(tok::period) && in spaceRequiredBefore()
3743 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
3747 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
3750 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
3754 Right.isOneOf(tok::l_brace, tok::less)) { in spaceRequiredBefore()
3758 if (Left.is(tok::percent)) in spaceRequiredBefore()
3762 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
3765 if (Right.is(tok::colon)) in spaceRequiredBefore()
3773 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
3777 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3781 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
3785 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
3788 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
3804 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
3816 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
3820 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3824 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
3825 if (Left.isOneOf(tok::kw_using, Keywords.kw_async, Keywords.kw_when, in spaceRequiredBefore()
3834 if (Left.isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, in spaceRequiredBefore()
3835 tok::kw_virtual, tok::kw_extern, tok::kw_static, in spaceRequiredBefore()
3839 Right.is(tok::l_paren)) { in spaceRequiredBefore()
3846 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
3847 Left.Previous->is(tok::kw_for)) { in spaceRequiredBefore()
3850 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
3869 if (Right.is(tok::star) && in spaceRequiredBefore()
3873 if (Right.isOneOf(tok::l_brace, tok::l_square) && in spaceRequiredBefore()
3878 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
3884 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
3889 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, in spaceRequiredBefore()
3890 tok::kw_void)) { in spaceRequiredBefore()
3895 if (Left.endsSequence(tok::kw_const, Keywords.kw_as)) in spaceRequiredBefore()
3898 tok::kw_const) || in spaceRequiredBefore()
3903 (Left.Previous->is(tok::identifier) || in spaceRequiredBefore()
3904 Left.Previous->isOneOf(tok::r_square, tok::r_brace)))) && in spaceRequiredBefore()
3905 (!Left.Previous || !Left.Previous->is(tok::period))) { in spaceRequiredBefore()
3908 if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous && in spaceRequiredBefore()
3909 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
3913 Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren)) { in spaceRequiredBefore()
3916 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
3917 Left.Previous->is(tok::kw_export)) { in spaceRequiredBefore()
3920 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3926 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
3927 Line.First->isOneOf(Keywords.kw_import, tok::kw_export)) { in spaceRequiredBefore()
3930 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
3933 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square, in spaceRequiredBefore()
3947 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3949 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
3953 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, in spaceRequiredBefore()
3954 tok::kw_protected) || in spaceRequiredBefore()
3967 if (!Right.is(tok::semi) && in spaceRequiredBefore()
3968 (Left.endsSequence(tok::numeric_constant, Keywords.kw_verilogHash) || in spaceRequiredBefore()
3969 Left.endsSequence(tok::numeric_constant, in spaceRequiredBefore()
3971 (Left.is(tok::r_paren) && Left.MatchingParen && in spaceRequiredBefore()
3972 Left.MatchingParen->endsSequence(tok::l_paren, tok::at)))) { in spaceRequiredBefore()
3981 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
3989 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
3997 if (Left.is(tok::comma) && !Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
3999 if (Right.is(tok::comma)) in spaceRequiredBefore()
4015 if (Right.is(tok::colon)) { in spaceRequiredBefore()
4016 if (Line.First->isOneOf(tok::kw_default, tok::kw_case)) in spaceRequiredBefore()
4019 if (!Next || Next->is(tok::semi)) in spaceRequiredBefore()
4023 if (Left.is(tok::question)) in spaceRequiredBefore()
4025 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
4040 if ((Left.isOneOf(tok::minus, tok::minusminus) && in spaceRequiredBefore()
4041 Right.isOneOf(tok::minus, tok::minusminus)) || in spaceRequiredBefore()
4042 (Left.isOneOf(tok::plus, tok::plusplus) && in spaceRequiredBefore()
4043 Right.isOneOf(tok::plus, tok::plusplus))) { in spaceRequiredBefore()
4047 if (!Right.is(tok::l_paren)) { in spaceRequiredBefore()
4051 if (Left.is(tok::exclaim) && Left.TokenText == "not") in spaceRequiredBefore()
4053 if (Left.is(tok::tilde) && Left.TokenText == "compl") in spaceRequiredBefore()
4057 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
4060 return (Style.SpaceAfterLogicalNot && Left.is(tok::exclaim)) || in spaceRequiredBefore()
4079 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4088 if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
4089 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
4090 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
4097 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
4098 (Left.is(tok::identifier) || Left.is(tok::kw_this))) { in spaceRequiredBefore()
4101 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
4107 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
4108 !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren)) { in spaceRequiredBefore()
4113 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, in spaceRequiredBefore()
4114 tok::kw___super, TT_TemplateOpener, in spaceRequiredBefore()
4116 (Left.is(tok::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
4122 return !Left.isOneOf(tok::amp, tok::ampamp) || in spaceRequiredBefore()
4127 Right.isOneOf(tok::amp, tok::ampamp)) { in spaceRequiredBefore()
4130 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
4132 !Right.is(tok::r_paren))) { in spaceRequiredBefore()
4135 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4140 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4141 Line.startsWith(tok::hash)) { in spaceRequiredBefore()
4153 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanBrace()
4160 Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren); in IsFunctionArgument()
4170 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanLambdaBrace()
4179 if (Next->is(tok::comment)) in getFirstNonComment()
4191 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4202 (Right.is(tok::numeric_constant) || in mustBreakBefore()
4203 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
4208 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
4215 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
4221 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
4222 Left.Previous->is(tok::string_literal)) { in mustBreakBefore()
4225 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4226 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
4227 Line.First->isOneOf(tok::identifier, Keywords.kw_import, tok::kw_export, in mustBreakBefore()
4228 tok::kw_const) && in mustBreakBefore()
4236 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4237 (Line.startsWith(tok::kw_enum) || in mustBreakBefore()
4238 Line.startsWith(tok::kw_const, tok::kw_enum) || in mustBreakBefore()
4239 Line.startsWith(tok::kw_export, tok::kw_enum) || in mustBreakBefore()
4240 Line.startsWith(tok::kw_export, tok::kw_const, tok::kw_enum))) { in mustBreakBefore()
4245 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
4264 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
4274 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
4275 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
4292 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
4297 if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
4298 !Right.is(tok::r_square)) { in mustBreakBefore()
4304 if (Left.is(tok::comma)) in mustBreakBefore()
4314 if ((Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) || in mustBreakBefore()
4315 (Style.isJavaScript() && Left.is(tok::l_paren))) && in mustBreakBefore()
4319 (Right.MatchingParen->isOneOf(tok::l_brace, in mustBreakBefore()
4322 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
4325 if (BeforeClosingBrace && (BeforeClosingBrace->is(tok::comma) || in mustBreakBefore()
4331 if (Right.is(tok::comment)) { in mustBreakBefore()
4339 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
4340 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
4358 if (Right.is(tok::kw_concept)) in mustBreakBefore()
4362 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { in mustBreakBefore()
4397 if (Right.is(tok::string_literal) && Right.TokenText.startswith("R\"")) { in mustBreakBefore()
4403 if ((Left.is(tok::l_brace) || (Left.is(tok::less) && Left.Previous && in mustBreakBefore()
4404 Left.Previous->is(tok::equal))) && in mustBreakBefore()
4417 FirstNonComment->isOneOf(Keywords.kw_internal, tok::kw_public, in mustBreakBefore()
4418 tok::kw_private, tok::kw_protected); in mustBreakBefore()
4421 if (Line.startsWith(tok::kw_enum) || in mustBreakBefore()
4422 Line.startsWith(tok::kw_typedef, tok::kw_enum)) { in mustBreakBefore()
4427 FirstNonComment->Next->is(tok::kw_enum)) { in mustBreakBefore()
4440 return (Line.startsWith(tok::kw_class) && Style.BraceWrapping.AfterClass) || in mustBreakBefore()
4441 (Line.startsWith(tok::kw_struct) && Style.BraceWrapping.AfterStruct); in mustBreakBefore()
4468 Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) { in mustBreakBefore()
4475 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && in mustBreakBefore()
4476 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) { in mustBreakBefore()
4512 Right.is(TT_SelectorName) && !Right.is(tok::r_square) && Right.Next) { in mustBreakBefore()
4515 if (Left.is(tok::at)) in mustBreakBefore()
4522 if (LBrace && LBrace->is(tok::colon)) { in mustBreakBefore()
4524 if (LBrace && LBrace->is(tok::at)) { in mustBreakBefore()
4539 ((LBrace->is(tok::l_brace) && in mustBreakBefore()
4541 (LBrace->Next && LBrace->Next->is(tok::r_brace)))) || in mustBreakBefore()
4542 LBrace->is(TT_ArrayInitializerLSquare) || LBrace->is(tok::less))) { in mustBreakBefore()
4564 if (Left.isOneOf(tok::r_brace, tok::greater, tok::r_square)) in mustBreakBefore()
4573 Left.is(tok::l_paren) && Left.BlockParameterCount > 0 && in mustBreakBefore()
4574 !Right.isOneOf(tok::l_paren, TT_LambdaLSquare)) { in mustBreakBefore()
4588 if (!Next->isOneOf(TT_LambdaLSquare, tok::l_brace, tok::caret)) in mustBreakBefore()
4623 tok::kw_return, Keywords.kw_yield, tok::kw_continue, tok::kw_break, in canBreakBefore()
4624 tok::kw_throw, Keywords.kw_interface, Keywords.kw_type, in canBreakBefore()
4625 tok::kw_static, tok::kw_public, tok::kw_private, tok::kw_protected, in canBreakBefore()
4633 Left.isOneOf(tok::r_square, tok::r_paren)) && in canBreakBefore()
4634 Right.isOneOf(tok::l_square, tok::l_paren)) { in canBreakBefore()
4637 if (NonComment && NonComment->is(tok::identifier) && in canBreakBefore()
4641 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
4646 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
4660 if (!Next || !Next->is(tok::colon)) in canBreakBefore()
4680 Right.isOneOf(Keywords.kw_module, tok::kw_namespace, in canBreakBefore()
4681 Keywords.kw_function, tok::kw_class, tok::kw_enum, in canBreakBefore()
4683 Keywords.kw_let, tok::kw_const)) { in canBreakBefore()
4688 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) && in canBreakBefore()
4689 Right.isOneOf(tok::identifier, tok::string_literal)) { in canBreakBefore()
4696 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
4702 if (Left.is(tok::at)) in canBreakBefore()
4704 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
4707 return !Right.is(tok::l_paren); in canBreakBefore()
4715 Right.is(tok::kw_operator)) { in canBreakBefore()
4730 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
4732 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
4734 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
4740 if (Right.is(TT_ObjCMethodExpr) && !Right.is(tok::r_square) && in canBreakBefore()
4745 if (Right.is(tok::colon) && in canBreakBefore()
4749 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
4778 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
4786 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
4790 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
4792 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. in canBreakBefore()
4794 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
4796 if (Right.is(tok::kw_concept)) in canBreakBefore()
4814 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
4815 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
4825 Left.is(tok::kw_operator)) { in canBreakBefore()
4828 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
4832 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
4836 if (Left.is(tok::l_paren) && in canBreakBefore()
4840 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
4849 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
4856 if (Right.is(tok::r_brace)) in canBreakBefore()
4860 if (Right.is(tok::r_paren)) { in canBreakBefore()
4866 return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); in canBreakBefore()
4872 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren, in canBreakBefore()
4873 tok::less, tok::coloncolon); in canBreakBefore()
4876 if (Right.is(tok::kw___attribute) || in canBreakBefore()
4877 (Right.is(tok::l_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
4881 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
4884 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
4911 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
4914 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
4920 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
4921 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
4933 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
4934 tok::kw_class, tok::kw_struct, tok::comment) || in canBreakBefore()
4936 Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless, in canBreakBefore()
4937 tok::colon, tok::l_square, tok::at) || in canBreakBefore()
4938 (Left.is(tok::r_paren) && in canBreakBefore()
4939 Right.isOneOf(tok::identifier, tok::kw_const)) || in canBreakBefore()
4940 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
4970 assert(Reference.isOneOf(tok::amp, tok::ampamp)); in getTokenReferenceAlignment()
4988 if (PointerOrReference.isOneOf(tok::amp, tok::ampamp)) { in getTokenPointerOrReferenceAlignment()
5000 assert(PointerOrReference.is(tok::star)); in getTokenPointerOrReferenceAlignment()