Lines Matching full:right
199 // tokens to prevent splitting right shift operators and potentially in parseAngle()
476 // categorize it as an unary operator, so set the right type here. in parseParens()
2741 // If there is an identifier (or with a few exceptions a keyword) right in rParenEndsCast()
2749 // Certain other tokens right before the parentheses are also signals that in rParenEndsCast()
2995 // After right braces, star tokens are likely to be pointers to struct, in determineStarAmpUsage()
3029 // Thus, having an identifier on the right-hand side indicates a binary in determineStarAmpUsage()
3250 // intervene so that the fake right paren is inserted correctly. in parse()
4145 const FormatToken &Right = Tok; in splitPenalty() local
4152 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_throws)) in splitPenalty()
4154 if (Right.is(Keywords.kw_implements)) in splitPenalty()
4159 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
4164 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in splitPenalty()
4168 if (Left.opensScope() && Right.closesScope()) in splitPenalty()
4171 if (Right.is(tok::l_square)) in splitPenalty()
4173 if (Right.is(tok::period)) in splitPenalty()
4177 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
4179 if (Right.is(tok::l_square)) { in splitPenalty()
4183 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
4185 if (!Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare, in splitPenalty()
4194 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) || in splitPenalty()
4195 Right.is(tok::kw_operator)) { in splitPenalty()
4196 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) in splitPenalty()
4200 if (InFunctionDecl && Right.NestingLevel == 0) in splitPenalty()
4204 if (Right.is(TT_PointerOrReference)) in splitPenalty()
4206 if (Right.is(TT_LambdaArrow)) in splitPenalty()
4208 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
4222 if (Right.isMemberAccess()) { in splitPenalty()
4242 return !Right.NextOperator || !Right.NextOperator->Previous->closesScope() in splitPenalty()
4247 if (Right.is(TT_TrailingAnnotation) && in splitPenalty()
4248 (!Right.Next || Right.Next->isNot(tok::l_paren))) { in splitPenalty()
4258 bool is_short_annotation = Right.TokenText.size() < 10; in splitPenalty()
4268 if (Right.is(TT_SelectorName)) in splitPenalty()
4294 if (Right.is(tok::r_brace)) in splitPenalty()
4321 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
4322 (Right.NextOperator || Right.OperatorIndex != 0)) { in splitPenalty()
4327 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
4328 (Right.NextOperator || Right.OperatorIndex != 1)) { in splitPenalty()
4331 if (Right.is(tok::lessless)) { in splitPenalty()
4333 if (Left.isNot(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
4347 Level = Right.getPrecedence(); in splitPenalty()
4356 bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const { in spaceRequiredBeforeParens()
4359 if (Right.is(TT_OverloadedOperatorLParen) && in spaceRequiredBeforeParens()
4364 Right.ParameterCount > 0) { in spaceRequiredBeforeParens()
4372 const FormatToken &Right) const { in spaceRequiredBetween()
4374 !Right.isOneOf(tok::semi, tok::r_paren, tok::hashhash)) { in spaceRequiredBetween()
4377 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen && in spaceRequiredBetween()
4378 Right.MatchingParen->is(TT_CastRParen)) { in spaceRequiredBetween()
4387 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
4390 return Right.is(tok::hash); in spaceRequiredBetween()
4391 if (Left.is(BK_Block) && Right.is(tok::r_brace) && in spaceRequiredBetween()
4392 Right.MatchingParen == &Left && Line.Children.empty()) { in spaceRequiredBetween()
4395 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
4397 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
4402 Left.is(tok::r_paren) && Right.is(tok::r_paren)) { in spaceRequiredBetween()
4404 if (InnerLParen && InnerLParen->Previous == Right.MatchingParen) { in spaceRequiredBetween()
4413 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
4414 LeftParen = Right.MatchingParen; in spaceRequiredBetween()
4424 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, in spaceRequiredBetween()
4431 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
4437 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && BeforeLeft && in spaceRequiredBetween()
4443 !Right.isOneOf(tok::semi, tok::r_paren)) { in spaceRequiredBetween()
4447 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
4448 return (Right.is(TT_CastRParen) || in spaceRequiredBetween()
4453 if (Right.isOneOf(tok::semi, tok::comma)) in spaceRequiredBetween()
4455 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
4456 bool IsLightweightGeneric = Right.MatchingParen && in spaceRequiredBetween()
4457 Right.MatchingParen->Next && in spaceRequiredBetween()
4458 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
4461 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
4466 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant, in spaceRequiredBetween()
4475 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
4478 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
4480 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
4485 if (Right.isNot(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4488 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
4492 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
4494 if (Right.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4515 if (Left.isTypeOrIdentifier(LangOpts) && Right.Next && Right.Next->Next && in spaceRequiredBetween()
4516 Right.Next->Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4517 return getTokenPointerOrReferenceAlignment(Right) != in spaceRequiredBetween()
4521 (getTokenPointerOrReferenceAlignment(Right) != in spaceRequiredBetween()
4527 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
4538 Right.canBePointerOrReferenceQualifier()) { in spaceRequiredBetween()
4542 if (Right.Tok.isLiteral()) in spaceRequiredBetween()
4545 if (Right.is(TT_BlockComment)) in spaceRequiredBetween()
4549 if (Right.isOneOf(Keywords.kw_override, Keywords.kw_final, tok::kw_noexcept, in spaceRequiredBetween()
4551 Right.isNot(TT_StartOfName)) { in spaceRequiredBetween()
4555 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
4558 if (BeforeLeft && BeforeLeft->isTypeOrIdentifier(LangOpts) && Right.Next && in spaceRequiredBetween()
4559 Right.Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4563 if (Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare, in spaceRequiredBetween()
4587 if (!Right.startsSequence(tok::identifier, tok::r_paren)) in spaceRequiredBetween()
4589 assert(Right.Next); in spaceRequiredBetween()
4590 const auto *LParen = Right.Next->MatchingParen; in spaceRequiredBetween()
4595 // Ensure right pointer alignment with ellipsis e.g. int *...P in spaceRequiredBetween()
4601 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
4603 if (Left.is(tok::star) && Right.isPointerOrReference()) in spaceRequiredBetween()
4605 if (Right.isPointerOrReference()) { in spaceRequiredBetween()
4645 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square)) in spaceRequiredBetween()
4655 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
4659 Style.SpacesInSquareBrackets && Right.isNot(tok::r_square)); in spaceRequiredBetween()
4661 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
4662 return Right.MatchingParen && in spaceRequiredBetween()
4663 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) && in spaceRequiredBetween()
4664 SpaceRequiredForArrayInitializerLSquare(*Right.MatchingParen, in spaceRequiredBetween()
4667 Right.MatchingParen->isOneOf(TT_ArraySubscriptLSquare, in spaceRequiredBetween()
4671 if (Right.is(tok::l_square) && in spaceRequiredBetween()
4672 !Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare, in spaceRequiredBetween()
4677 Right.is(TT_ArraySubscriptLSquare))) { in spaceRequiredBetween()
4680 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
4683 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4684 Right.MatchingParen->isNot(BK_Block))) { in spaceRequiredBetween()
4694 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
4697 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
4698 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
4699 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4703 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4707 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4715 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4719 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4723 Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBetween()
4734 Right.is(TT_ConditionLParen)) { in spaceRequiredBetween()
4736 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4741 if (Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4742 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4744 if (Line.MightBeFunctionDecl && Right.is(TT_FunctionDeclarationLParen)) { in spaceRequiredBetween()
4745 if (spaceRequiredBeforeParens(Right)) in spaceRequiredBetween()
4756 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4761 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4766 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4773 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4779 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4783 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
4785 if (Right.is(TT_UnaryOperator)) { in spaceRequiredBetween()
4797 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
4798 Right.isNot(BK_Block)) { in spaceRequiredBetween()
4801 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
4805 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
4821 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
4827 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4828 Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
4832 if (Right.is(TT_TrailingAnnotation) && Right.isOneOf(tok::amp, tok::ampamp) && in spaceRequiredBetween()
4834 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
4838 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left; in spaceRequiredBetween()
4845 const FormatToken &Right) const { in spaceRequiredBefore()
4846 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore()
4851 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4857 if (Keywords.isWordLike(Right, IsVerilog) && in spaceRequiredBefore()
4864 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
4869 Right.isOneOf(TT_TemplateOpener, TT_TemplateCloser)) { in spaceRequiredBefore()
4873 if (Right.is(tok::period) && Left.is(tok::numeric_constant)) in spaceRequiredBefore()
4877 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
4881 Right.is(TT_ModulePartitionColon)) { in spaceRequiredBefore()
4885 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
4889 Right.isOneOf(tok::identifier, tok::kw_private)) { in spaceRequiredBefore()
4892 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
4898 Right.is(tok::coloncolon)) { in spaceRequiredBefore()
4903 return Right.is(tok::coloncolon); in spaceRequiredBefore()
4904 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
4909 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4913 if (Left.is(tok::identifier) && Right.is(tok::numeric_constant)) in spaceRequiredBefore()
4914 return Right.TokenText[0] != '.'; in spaceRequiredBefore()
4916 if (Left.Tok.getIdentifierInfo() && Right.Tok.isLiteral()) in spaceRequiredBefore()
4919 if (Right.is(tok::period) && in spaceRequiredBefore()
4924 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
4928 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
4931 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
4935 Right.isOneOf(tok::l_brace, tok::less)) { in spaceRequiredBefore()
4943 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
4944 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4946 if (Right.is(tok::colon) && Left.is(tok::string_literal)) in spaceRequiredBefore()
4954 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
4958 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4962 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
4966 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
4969 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
4973 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
4977 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4981 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
4985 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4989 if (Right.is(TT_CSharpNullable)) in spaceRequiredBefore()
4993 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4997 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
5001 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
5005 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
5009 spaceRequiredBeforeParens(Right); in spaceRequiredBefore()
5020 Right.is(tok::l_paren)) { in spaceRequiredBefore()
5027 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
5031 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
5032 Right.MatchingParen) { in spaceRequiredBefore()
5033 const FormatToken *Next = Right.MatchingParen->getNextNonComment(); in spaceRequiredBefore()
5040 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in spaceRequiredBefore()
5047 Right.is(TT_TemplateString)) { in spaceRequiredBefore()
5050 if (Right.is(tok::star) && in spaceRequiredBefore()
5054 if (Right.isOneOf(tok::l_brace, tok::l_square) && in spaceRequiredBefore()
5059 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
5090 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
5094 Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren)) { in spaceRequiredBefore()
5101 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5103 if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion)) in spaceRequiredBefore()
5105 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
5107 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
5114 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square, in spaceRequiredBefore()
5121 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
5124 Right.isOneOf(Keywords.kw_as, Keywords.kw_in)) { in spaceRequiredBefore()
5128 if (Left.is(TT_CaseLabelArrow) || Right.is(TT_CaseLabelArrow)) in spaceRequiredBefore()
5130 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5133 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
5136 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
5138 spaceRequiredBeforeParens(Right); in spaceRequiredBefore()
5143 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
5153 !Right.isOneOf(tok::r_paren, tok::semi)) || in spaceRequiredBefore()
5154 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) { in spaceRequiredBefore()
5155 const FormatToken *Next = Right.getNextNonComment(); in spaceRequiredBefore()
5164 if (Right.isNot(tok::semi) && in spaceRequiredBefore()
5175 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) { in spaceRequiredBefore()
5179 if (Left.is(tok::arrow) || Right.is(tok::arrow)) in spaceRequiredBefore()
5184 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at)) in spaceRequiredBefore()
5187 if (Right.is(tok::l_square) && in spaceRequiredBefore()
5192 if (Right.isOneOf(tok::period, Keywords.kw_apostrophe) && in spaceRequiredBefore()
5200 if ((Right.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
5201 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) && in spaceRequiredBefore()
5210 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) || in spaceRequiredBefore()
5211 (Left.is(tok::star) && Right.is(tok::semi))) { in spaceRequiredBefore()
5215 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
5218 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength)) in spaceRequiredBefore()
5222 Right.isOneOf(tok::lessless, tok::greatergreater)) || in spaceRequiredBefore()
5229 if (Left.is(tok::l_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5231 if (Left.is(tok::r_brace) && Right.is(tok::r_square)) in spaceRequiredBefore()
5234 if (Right.isOneOf(TT_TableGenDAGArgListColon, in spaceRequiredBefore()
5240 if (Right.is(TT_TableGenCondOperatorColon)) in spaceRequiredBefore()
5244 Right.isNot(TT_TableGenDAGArgCloser)) { in spaceRequiredBefore()
5248 if (Right.isOneOf(tok::l_paren, tok::less) && in spaceRequiredBefore()
5255 Right.isOneOf(tok::l_brace, tok::colon)) { in spaceRequiredBefore()
5259 if (Left.is(tok::hash) || Right.is(tok::hash)) in spaceRequiredBefore()
5267 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
5272 canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
5280 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
5284 if (Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow) || in spaceRequiredBefore()
5288 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBefore()
5294 if (Right.is(tok::comma)) in spaceRequiredBefore()
5296 if (Right.is(TT_ObjCBlockLParen)) in spaceRequiredBefore()
5298 if (Right.is(TT_CtorInitializerColon)) in spaceRequiredBefore()
5300 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon) in spaceRequiredBefore()
5302 if (Right.is(TT_RangeBasedForLoopColon) && in spaceRequiredBefore()
5310 if (Right.is(tok::colon)) { in spaceRequiredBefore()
5311 if (Right.is(TT_CaseLabelColon)) in spaceRequiredBefore()
5313 if (Right.is(TT_GotoLabelColon)) in spaceRequiredBefore()
5316 if (!Right.getNextNonComment()) in spaceRequiredBefore()
5318 if (Right.is(TT_ObjCMethodExpr)) in spaceRequiredBefore()
5322 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
5324 if (Right.is(TT_DictLiteral)) in spaceRequiredBefore()
5326 if (Right.is(TT_AttributeColon)) in spaceRequiredBefore()
5328 if (Right.is(TT_CSharpNamedArgumentColon)) in spaceRequiredBefore()
5330 if (Right.is(TT_GenericSelectionColon)) in spaceRequiredBefore()
5332 if (Right.is(TT_BitFieldColon)) { in spaceRequiredBefore()
5340 Right.isOneOf(tok::minus, tok::minusminus)) || in spaceRequiredBefore()
5342 Right.isOneOf(tok::plus, tok::plusplus))) { in spaceRequiredBefore()
5348 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
5357 Right.isOneOf(TT_BinaryOperator, TT_SelectorName); in spaceRequiredBefore()
5360 auto ShouldAddSpacesInAngles = [this, &Right]() { in spaceRequiredBefore()
5364 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
5368 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
5373 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
5377 if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
5379 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
5383 Right.getPrecedence() == prec::Assignment) { in spaceRequiredBefore()
5386 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
5390 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
5394 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
5396 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
5407 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
5410 if (Right.is(TT_StructuredBindingLSquare)) { in spaceRequiredBefore()
5415 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && in spaceRequiredBefore()
5416 Right.isOneOf(tok::amp, tok::ampamp)) { in spaceRequiredBefore()
5417 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left; in spaceRequiredBefore()
5419 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) || in spaceRequiredBefore()
5421 Right.isNot(tok::r_paren))) { in spaceRequiredBefore()
5424 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
5429 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
5433 if (Right.is(TT_TrailingUnaryOperator)) in spaceRequiredBefore()
5437 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
5464 const FormatToken &Right) const { in mustBreakBefore()
5465 const FormatToken &Left = *Right.Previous; in mustBreakBefore()
5466 if (Right.NewlinesBefore > 1 && Style.MaxEmptyLinesToKeep > 0) in mustBreakBefore()
5476 const auto *AfterRight = Right.Next; in mustBreakBefore()
5479 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
5483 if (Right.is(TT_CSharpNamedArgumentColon) || in mustBreakBefore()
5487 if (Right.is(TT_CSharpGenericTypeConstraint)) in mustBreakBefore()
5490 (Right.is(tok::numeric_constant) || in mustBreakBefore()
5491 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
5497 (Right.isAccessSpecifier(/*ColonRequired=*/false) || in mustBreakBefore()
5498 Right.is(Keywords.kw_internal))) { in mustBreakBefore()
5502 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
5503 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
5508 if (Right.is(tok::string_literal) && Left.is(tok::plus) && BeforeLeft && in mustBreakBefore()
5532 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && BeforeLeft && in mustBreakBefore()
5551 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
5561 if (Right.is(tok::plus) && Left.is(tok::string_literal) && AfterRight && in mustBreakBefore()
5576 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) && in mustBreakBefore()
5583 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left)) in mustBreakBefore()
5588 if (Left.isStringLiteral() && Right.isStringLiteral()) in mustBreakBefore()
5601 Right.isNot(tok::r_square)) || in mustBreakBefore()
5603 if (Right.is(tok::l_brace)) in mustBreakBefore()
5605 // scan to the right if an we see an object or an array inside in mustBreakBefore()
5607 for (const auto *Tok = &Right; Tok; Tok = Tok->Next) { in mustBreakBefore()
5622 Right.isNot(TT_TableGenDAGArgCloser)) { in mustBreakBefore()
5627 if (Right.is(TT_TableGenDAGArgCloser) && Right.MatchingParen && in mustBreakBefore()
5628 Right.MatchingParen->is(TT_TableGenDAGArgOpenerToBreak) && in mustBreakBefore()
5629 &Left != Right.MatchingParen->Next) { in mustBreakBefore()
5635 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) && in mustBreakBefore()
5650 } else if (Right.MatchingParen && in mustBreakBefore()
5651 (Right.MatchingParen->isOneOf(tok::l_brace, in mustBreakBefore()
5654 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
5663 if (Right.is(tok::comment)) { in mustBreakBefore()
5665 (Right.NewlinesBefore > 0 && Right.HasUnescapedNewline); in mustBreakBefore()
5673 Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight && in mustBreakBefore()
5675 return Right.NewlinesBefore > 0; in mustBreakBefore()
5678 if (Right.is(TT_RequiresClause)) { in mustBreakBefore()
5693 if (Right.is(tok::kw_concept)) in mustBreakBefore()
5697 Right.NewlinesBefore > 0); in mustBreakBefore()
5699 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { in mustBreakBefore()
5711 Right.is(TT_CtorInitializerColon))) { in mustBreakBefore()
5722 Right.isOneOf(TT_CtorInitializerComma, TT_CtorInitializerColon)) { in mustBreakBefore()
5728 Right.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5739 Right.is(TT_InheritanceComma)) { in mustBreakBefore()
5746 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) { in mustBreakBefore()
5750 return Right.IsMultiline && Right.NewlinesBefore > 0; in mustBreakBefore()
5754 Right.NestingLevel == 1 && Style.Language == FormatStyle::LK_Proto) { in mustBreakBefore()
5759 if (Right.is(TT_InlineASMBrace)) in mustBreakBefore()
5760 return Right.HasUnescapedNewline; in mustBreakBefore()
5762 if (isAllmanBrace(Left) || isAllmanBrace(Right)) { in mustBreakBefore()
5789 if (Right.isNot(TT_FunctionLBrace)) { in mustBreakBefore()
5804 Right.is(TT_ObjCDecl)) { in mustBreakBefore()
5822 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) && in mustBreakBefore()
5830 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && in mustBreakBefore()
5835 if (Right.is(TT_ProtoExtensionLSquare)) in mustBreakBefore()
5865 if (Style.isProto() && Right.is(TT_SelectorName) && in mustBreakBefore()
5866 Right.isNot(tok::r_square) && AfterRight) { in mustBreakBefore()
5913 // left---. .---right in mustBreakBefore()
5926 const FormatToken &Right) const { in canBreakBefore()
5927 const FormatToken &Left = *Right.Previous; in canBreakBefore()
5931 Right.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon)) { in canBreakBefore()
5938 if (Right.is(TT_CSharpNullable)) in canBreakBefore()
5945 if (Right.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
5950 const FormatToken *NonComment = Right.getPreviousNonComment(); in canBreakBefore()
5961 if (Right.NestingLevel == 0 && in canBreakBefore()
5964 Right.isOneOf(tok::l_square, tok::l_paren)) { in canBreakBefore()
5971 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
5976 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
5981 if (Right.is(Keywords.kw_is)) { in canBreakBefore()
5982 const FormatToken *Next = Right.getNextNonComment(); in canBreakBefore()
5995 if (Right.is(Keywords.kw_in)) in canBreakBefore()
5997 if (Right.is(Keywords.kw_as)) in canBreakBefore()
5999 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_infer)) { in canBreakBefore()
6010 Right.isOneOf(Keywords.kw_module, tok::kw_namespace, in canBreakBefore()
6019 Right.isOneOf(tok::identifier, tok::string_literal)) { in canBreakBefore()
6022 if (Right.is(TT_TemplateString) && Right.closesScope()) in canBreakBefore()
6026 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
6035 if (Right.is(tok::l_paren)) { in canBreakBefore()
6043 if (Left.is(tok::hash) || Right.is(tok::hash)) in canBreakBefore()
6054 return Right.isNot(tok::l_paren); in canBreakBefore()
6055 if (Right.is(TT_PointerOrReference)) { in canBreakBefore()
6057 (getTokenPointerOrReferenceAlignment(Right) == in canBreakBefore()
6059 (!Right.Next || Right.Next->isNot(TT_FunctionDeclarationName))); in canBreakBefore()
6061 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) || in canBreakBefore()
6062 Right.is(tok::kw_operator)) { in canBreakBefore()
6067 if (Right.isTrailingComment()) { in canBreakBefore()
6074 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
6077 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
6079 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
6085 if (Right.is(TT_InheritanceColon)) in canBreakBefore()
6087 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) && in canBreakBefore()
6092 if (Right.is(tok::colon) && in canBreakBefore()
6093 !Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) { in canBreakBefore()
6098 if (!Style.AlwaysBreakBeforeMultilineStrings && Right.isStringLiteral()) in canBreakBefore()
6124 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
6125 Right.is(TT_DictLiteral)) || in canBreakBefore()
6126 Right.is(TT_ArrayInitializerLSquare)) { in canBreakBefore()
6132 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
6133 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) { in canBreakBefore()
6136 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
6137 Right.Next->is(TT_ObjCMethodExpr))) { in canBreakBefore()
6142 if (Right.is(tok::kw_concept)) in canBreakBefore()
6144 if (Right.is(TT_RequiresClause)) in canBreakBefore()
6148 Right.NewlinesBefore > 0; in canBreakBefore()
6154 if (Right.isOneOf(TT_RangeBasedForLoopColon, TT_OverloadedOperatorLParen, in canBreakBefore()
6160 if (Right.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
6162 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
6164 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
6165 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
6168 if (Right.is(TT_BinaryOperator) && in canBreakBefore()
6171 Right.getPrecedence() != prec::Assignment)) { in canBreakBefore()
6178 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
6182 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
6194 if (Right.is(TT_ImplicitStringLiteral)) in canBreakBefore()
6197 if (Right.is(TT_TemplateCloser)) in canBreakBefore()
6199 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
6200 Right.MatchingParen->is(TT_LambdaLSquare)) { in canBreakBefore()
6206 if (Right.is(tok::r_brace)) { in canBreakBefore()
6207 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) || in canBreakBefore()
6208 (Right.isBlockIndentedInitRBrace(Style))); in canBreakBefore()
6212 if (Right.is(tok::r_paren)) { in canBreakBefore()
6214 !Right.MatchingParen) { in canBreakBefore()
6217 auto Next = Right.Next; in canBreakBefore()
6222 const FormatToken *Previous = Right.MatchingParen->Previous; in canBreakBefore()
6229 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren, in canBreakBefore()
6233 if (Right.isAttribute()) in canBreakBefore()
6236 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare)) in canBreakBefore()
6239 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
6242 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
6247 (!Right.isTrailingComment() || Right.NewlinesBefore > 0); in canBreakBefore()
6249 if (Right.is(TT_CtorInitializerColon)) in canBreakBefore()
6255 if (Right.is(TT_CtorInitializerComma) && in canBreakBefore()
6263 if (Right.is(TT_InheritanceComma) && in canBreakBefore()
6269 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
6278 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
6279 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
6284 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) { in canBreakBefore()
6287 if (isAllmanLambdaBrace(Right)) in canBreakBefore()
6288 return !isItAnEmptyLambdaAllowed(Right, ShortLambdaOption); in canBreakBefore()
6291 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) { in canBreakBefore()
6298 return Right.Next && Right.Next->is(tok::l_paren); in canBreakBefore()
6304 Right.isMemberAccess() || in canBreakBefore()
6305 Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless, in canBreakBefore()
6308 Right.isOneOf(tok::identifier, tok::kw_const)) || in canBreakBefore()
6309 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) || in canBreakBefore()
6310 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser)); in canBreakBefore()