Lines Matching refs:Right

3725   const FormatToken &Right = Tok;  in splitPenalty()  local
3732 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_throws)) in splitPenalty()
3734 if (Right.is(Keywords.kw_implements)) in splitPenalty()
3739 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
3744 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in splitPenalty()
3748 if (Left.opensScope() && Right.closesScope()) in splitPenalty()
3751 if (Right.is(tok::l_square)) in splitPenalty()
3753 if (Right.is(tok::period)) in splitPenalty()
3757 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
3759 if (Right.is(tok::l_square)) { in splitPenalty()
3763 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
3765 if (!Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare, in splitPenalty()
3774 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) || in splitPenalty()
3775 Right.is(tok::kw_operator)) { in splitPenalty()
3776 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) in splitPenalty()
3780 if (InFunctionDecl && Right.NestingLevel == 0) in splitPenalty()
3784 if (Right.is(TT_PointerOrReference)) in splitPenalty()
3786 if (Right.is(TT_TrailingReturnArrow)) in splitPenalty()
3788 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3802 if (Right.isMemberAccess()) { in splitPenalty()
3822 return !Right.NextOperator || !Right.NextOperator->Previous->closesScope() in splitPenalty()
3827 if (Right.is(TT_TrailingAnnotation) && in splitPenalty()
3828 (!Right.Next || Right.Next->isNot(tok::l_paren))) { in splitPenalty()
3838 bool is_short_annotation = Right.TokenText.size() < 10; in splitPenalty()
3848 if (Right.is(TT_SelectorName)) in splitPenalty()
3874 if (Right.is(tok::r_brace)) in splitPenalty()
3901 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
3902 (Right.NextOperator || Right.OperatorIndex != 0)) { in splitPenalty()
3907 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
3908 (Right.NextOperator || Right.OperatorIndex != 1)) { in splitPenalty()
3911 if (Right.is(tok::lessless)) { in splitPenalty()
3913 if (Left.isNot(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
3927 Level = Right.getPrecedence(); in splitPenalty()
3936 bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const { in spaceRequiredBeforeParens()
3939 if (Right.is(TT_OverloadedOperatorLParen) && in spaceRequiredBeforeParens()
3944 Right.ParameterCount > 0) { in spaceRequiredBeforeParens()
3952 const FormatToken &Right) const { in spaceRequiredBetween()
3954 !Right.isOneOf(tok::semi, tok::r_paren, tok::hashhash)) { in spaceRequiredBetween()
3957 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen && in spaceRequiredBetween()
3958 Right.MatchingParen->is(TT_CastRParen)) { in spaceRequiredBetween()
3967 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
3970 return Right.is(tok::hash); in spaceRequiredBetween()
3971 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
3973 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
3980 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
3981 LeftParen = Right.MatchingParen; in spaceRequiredBetween()
3991 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, in spaceRequiredBetween()
3998 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
4002 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && Left.Previous && in spaceRequiredBetween()
4008 !Right.isOneOf(tok::semi, tok::r_paren)) { in spaceRequiredBetween()
4012 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
4013 return (Right.is(TT_CastRParen) || in spaceRequiredBetween()
4018 if (Right.isOneOf(tok::semi, tok::comma)) in spaceRequiredBetween()
4020 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
4021 bool IsLightweightGeneric = Right.MatchingParen && in spaceRequiredBetween()
4022 Right.MatchingParen->Next && in spaceRequiredBetween()
4023 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
4026 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
4031 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant, in spaceRequiredBetween()
4040 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
4043 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
4045 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
4050 if (Right.isNot(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4053 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
4057 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
4059 if (Right.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4080 if (Left.isTypeOrIdentifier() && Right.Next && Right.Next->Next && in spaceRequiredBetween()
4081 Right.Next->Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4082 return getTokenPointerOrReferenceAlignment(Right) != in spaceRequiredBetween()
4086 (getTokenPointerOrReferenceAlignment(Right) != in spaceRequiredBetween()
4092 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
4103 Right.canBePointerOrReferenceQualifier()) { in spaceRequiredBetween()
4107 if (Right.Tok.isLiteral()) in spaceRequiredBetween()
4110 if (Right.is(TT_BlockComment)) in spaceRequiredBetween()
4114 if (Right.isOneOf(Keywords.kw_override, Keywords.kw_final, tok::kw_noexcept, in spaceRequiredBetween()
4116 Right.isNot(TT_StartOfName)) { in spaceRequiredBetween()
4120 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
4123 if (Left.Previous && Left.Previous->isTypeOrIdentifier() && Right.Next && in spaceRequiredBetween()
4124 Right.Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4128 if (Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare, in spaceRequiredBetween()
4155 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
4157 if (Left.is(tok::star) && Right.isPointerOrReference()) in spaceRequiredBetween()
4159 if (Right.isPointerOrReference()) { in spaceRequiredBetween()
4199 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square)) in spaceRequiredBetween()
4209 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
4213 Style.SpacesInSquareBrackets && Right.isNot(tok::r_square)); in spaceRequiredBetween()
4215 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
4216 return Right.MatchingParen && in spaceRequiredBetween()
4217 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) && in spaceRequiredBetween()
4218 SpaceRequiredForArrayInitializerLSquare(*Right.MatchingParen, in spaceRequiredBetween()
4221 Right.MatchingParen->isOneOf(TT_ArraySubscriptLSquare, in spaceRequiredBetween()
4225 if (Right.is(tok::l_square) && in spaceRequiredBetween()
4226 !Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare, in spaceRequiredBetween()
4231 Right.is(TT_ArraySubscriptLSquare))) { in spaceRequiredBetween()
4234 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
4237 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4238 Right.MatchingParen->isNot(BK_Block))) { in spaceRequiredBetween()
4248 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
4251 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
4252 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
4253 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4257 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4261 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4269 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4273 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4277 Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBetween()
4288 Right.is(TT_ConditionLParen)) { in spaceRequiredBetween()
4290 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4295 if (Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4296 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4301 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4304 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4311 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4316 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4321 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4328 spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4334 return spaceRequiredBeforeParens(Right); in spaceRequiredBetween()
4338 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
4340 if (Right.is(TT_UnaryOperator)) { in spaceRequiredBetween()
4352 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
4353 Right.isNot(BK_Block)) { in spaceRequiredBetween()
4356 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
4360 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
4376 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
4382 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4383 Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
4387 if (Right.getType() == TT_TrailingAnnotation && in spaceRequiredBetween()
4388 Right.isOneOf(tok::amp, tok::ampamp) && in spaceRequiredBetween()
4390 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
4394 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left; in spaceRequiredBetween()
4401 const FormatToken &Right) const { in spaceRequiredBefore()
4402 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore()
4407 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4410 if (Keywords.isWordLike(Right) && Keywords.isWordLike(Left)) in spaceRequiredBefore()
4415 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
4420 Right.isOneOf(TT_TemplateOpener, TT_TemplateCloser)) { in spaceRequiredBefore()
4424 if (Right.is(tok::period) && Left.is(tok::numeric_constant)) in spaceRequiredBefore()
4428 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
4432 Right.is(TT_ModulePartitionColon)) { in spaceRequiredBefore()
4436 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
4440 Right.isOneOf(tok::identifier, tok::kw_private)) { in spaceRequiredBefore()
4443 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
4449 Right.is(tok::coloncolon)) { in spaceRequiredBefore()
4454 return Right.is(tok::coloncolon); in spaceRequiredBefore()
4455 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
4460 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4464 if (Right.is(tok::period) && in spaceRequiredBefore()
4469 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
4473 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
4476 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
4480 Right.isOneOf(tok::l_brace, tok::less)) { in spaceRequiredBefore()
4488 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
4489 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4491 if (Right.is(tok::colon) && Left.is(tok::string_literal)) in spaceRequiredBefore()
4499 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
4503 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4507 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
4511 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
4514 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
4518 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
4522 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4526 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
4530 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4534 if (Right.is(TT_CSharpNullable)) in spaceRequiredBefore()
4538 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4542 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
4546 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4550 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
4554 spaceRequiredBeforeParens(Right); in spaceRequiredBefore()
4565 Right.is(tok::l_paren)) { in spaceRequiredBefore()
4572 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
4576 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
4577 Right.MatchingParen) { in spaceRequiredBefore()
4578 const FormatToken *Next = Right.MatchingParen->getNextNonComment(); in spaceRequiredBefore()
4585 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in spaceRequiredBefore()
4592 Right.is(TT_TemplateString)) { in spaceRequiredBefore()
4595 if (Right.is(tok::star) && in spaceRequiredBefore()
4599 if (Right.isOneOf(tok::l_brace, tok::l_square) && in spaceRequiredBefore()
4604 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
4635 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4639 Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren)) { in spaceRequiredBefore()
4646 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4648 if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion)) in spaceRequiredBefore()
4650 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
4652 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
4659 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square, in spaceRequiredBefore()
4666 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4669 Right.isOneOf(Keywords.kw_as, Keywords.kw_in)) { in spaceRequiredBefore()
4673 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4676 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4679 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4681 spaceRequiredBeforeParens(Right); in spaceRequiredBefore()
4687 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4699 !Right.isOneOf(tok::r_paren, tok::semi)) || in spaceRequiredBefore()
4700 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) { in spaceRequiredBefore()
4701 const FormatToken *Next = Right.getNextNonComment(); in spaceRequiredBefore()
4710 if (Right.isNot(tok::semi) && in spaceRequiredBefore()
4721 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) { in spaceRequiredBefore()
4725 if (Left.is(tok::arrow) || Right.is(tok::arrow)) in spaceRequiredBefore()
4730 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at)) in spaceRequiredBefore()
4733 if (Right.is(tok::l_square) && in spaceRequiredBefore()
4738 if (Right.isOneOf(tok::period, Keywords.kw_apostrophe) && in spaceRequiredBefore()
4746 if ((Right.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
4747 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) && in spaceRequiredBefore()
4756 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) || in spaceRequiredBefore()
4757 (Left.is(tok::star) && Right.is(tok::semi))) { in spaceRequiredBefore()
4761 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
4764 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength)) in spaceRequiredBefore()
4768 Right.isOneOf(tok::lessless, tok::greatergreater)) || in spaceRequiredBefore()
4775 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4780 canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
4788 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
4792 if (Right.is(TT_TrailingReturnArrow) || Left.is(TT_TrailingReturnArrow)) in spaceRequiredBefore()
4795 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBefore()
4801 if (Right.is(tok::comma)) in spaceRequiredBefore()
4803 if (Right.is(TT_ObjCBlockLParen)) in spaceRequiredBefore()
4805 if (Right.is(TT_CtorInitializerColon)) in spaceRequiredBefore()
4807 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon) in spaceRequiredBefore()
4809 if (Right.is(TT_RangeBasedForLoopColon) && in spaceRequiredBefore()
4817 if (Right.is(tok::colon)) { in spaceRequiredBefore()
4818 if (Right.is(TT_CaseLabelColon)) in spaceRequiredBefore()
4820 if (Right.is(TT_GotoLabelColon)) in spaceRequiredBefore()
4823 if (!Right.getNextNonComment()) in spaceRequiredBefore()
4825 if (Right.is(TT_ObjCMethodExpr)) in spaceRequiredBefore()
4829 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
4831 if (Right.is(TT_DictLiteral)) in spaceRequiredBefore()
4833 if (Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4835 if (Right.is(TT_CSharpNamedArgumentColon)) in spaceRequiredBefore()
4837 if (Right.is(TT_GenericSelectionColon)) in spaceRequiredBefore()
4839 if (Right.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4847 Right.isOneOf(tok::minus, tok::minusminus)) || in spaceRequiredBefore()
4849 Right.isOneOf(tok::plus, tok::plusplus))) { in spaceRequiredBefore()
4853 if (Right.isNot(tok::l_paren)) { in spaceRequiredBefore()
4863 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
4867 Right.is(TT_BinaryOperator); in spaceRequiredBefore()
4874 Right.isOneOf(TT_BinaryOperator, TT_SelectorName); in spaceRequiredBefore()
4877 auto ShouldAddSpacesInAngles = [this, &Right]() { in spaceRequiredBefore()
4881 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4885 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4890 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4894 if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
4896 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
4900 Right.getPrecedence() == prec::Assignment) { in spaceRequiredBefore()
4903 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
4907 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
4911 return Right.hasWhitespaceBefore(); in spaceRequiredBefore()
4913 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
4924 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
4927 if (Right.is(TT_StructuredBindingLSquare)) { in spaceRequiredBefore()
4932 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && in spaceRequiredBefore()
4933 Right.isOneOf(tok::amp, tok::ampamp)) { in spaceRequiredBefore()
4934 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left; in spaceRequiredBefore()
4936 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) || in spaceRequiredBefore()
4938 Right.isNot(tok::r_paren))) { in spaceRequiredBefore()
4941 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4946 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4950 if (Right.is(TT_TrailingUnaryOperator)) in spaceRequiredBefore()
4954 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
4981 const FormatToken &Right) const { in mustBreakBefore()
4982 const FormatToken &Left = *Right.Previous; in mustBreakBefore()
4983 if (Right.NewlinesBefore > 1 && Style.MaxEmptyLinesToKeep > 0) in mustBreakBefore()
4987 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4991 if (Right.is(TT_CSharpNamedArgumentColon) || in mustBreakBefore()
4995 if (Right.is(TT_CSharpGenericTypeConstraint)) in mustBreakBefore()
4997 if (Right.Next && Right.Next->is(TT_FatArrow) && in mustBreakBefore()
4998 (Right.is(tok::numeric_constant) || in mustBreakBefore()
4999 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
5005 (Right.isAccessSpecifier(/*ColonRequired=*/false) || in mustBreakBefore()
5006 Right.is(Keywords.kw_internal))) { in mustBreakBefore()
5010 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
5011 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
5017 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
5041 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
5060 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
5070 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
5071 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
5085 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) && in mustBreakBefore()
5092 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left)) in mustBreakBefore()
5097 if (Left.isStringLiteral() && Right.isStringLiteral()) in mustBreakBefore()
5110 Right.isNot(tok::r_square)) || in mustBreakBefore()
5112 if (Right.is(tok::l_brace)) in mustBreakBefore()
5116 for (const auto *Tok = &Right; Tok; Tok = Tok->Next) { in mustBreakBefore()
5126 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) && in mustBreakBefore()
5141 } else if (Right.MatchingParen && in mustBreakBefore()
5142 (Right.MatchingParen->isOneOf(tok::l_brace, in mustBreakBefore()
5145 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
5154 if (Right.is(tok::comment)) { in mustBreakBefore()
5156 (Right.NewlinesBefore > 0 && Right.HasUnescapedNewline); in mustBreakBefore()
5162 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
5163 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
5166 if (Right.is(TT_RequiresClause)) { in mustBreakBefore()
5181 if (Right.is(tok::kw_concept)) in mustBreakBefore()
5185 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { in mustBreakBefore()
5197 Right.is(TT_CtorInitializerColon))) { in mustBreakBefore()
5208 Right.isOneOf(TT_CtorInitializerComma, TT_CtorInitializerColon)) { in mustBreakBefore()
5214 Right.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5225 Right.is(TT_InheritanceComma)) { in mustBreakBefore()
5232 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) { in mustBreakBefore()
5236 return Right.IsMultiline && Right.NewlinesBefore > 0; in mustBreakBefore()
5240 Right.NestingLevel == 1 && Style.Language == FormatStyle::LK_Proto) { in mustBreakBefore()
5245 if (Right.is(TT_InlineASMBrace)) in mustBreakBefore()
5246 return Right.HasUnescapedNewline; in mustBreakBefore()
5248 if (isAllmanBrace(Left) || isAllmanBrace(Right)) { in mustBreakBefore()
5276 if (Right.isNot(TT_FunctionLBrace)) { in mustBreakBefore()
5291 Right.is(TT_ObjCDecl)) { in mustBreakBefore()
5309 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) && in mustBreakBefore()
5317 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && in mustBreakBefore()
5322 if (Right.is(TT_ProtoExtensionLSquare)) in mustBreakBefore()
5352 if (Style.isProto() && Right.is(TT_SelectorName) && in mustBreakBefore()
5353 Right.isNot(tok::r_square) && Right.Next) { in mustBreakBefore()
5362 FormatToken *LBrace = Right.Next; in mustBreakBefore()
5413 const FormatToken &Right) const { in canBreakBefore()
5414 const FormatToken &Left = *Right.Previous; in canBreakBefore()
5418 Right.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon)) { in canBreakBefore()
5425 if (Right.is(TT_CSharpNullable)) in canBreakBefore()
5432 if (Right.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
5437 const FormatToken *NonComment = Right.getPreviousNonComment(); in canBreakBefore()
5448 if (Right.NestingLevel == 0 && in canBreakBefore()
5451 Right.isOneOf(tok::l_square, tok::l_paren)) { in canBreakBefore()
5458 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
5463 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
5468 if (Right.is(Keywords.kw_is)) { in canBreakBefore()
5469 const FormatToken *Next = Right.getNextNonComment(); in canBreakBefore()
5482 if (Right.is(Keywords.kw_in)) in canBreakBefore()
5484 if (Right.is(Keywords.kw_as)) in canBreakBefore()
5486 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_infer)) { in canBreakBefore()
5497 Right.isOneOf(Keywords.kw_module, tok::kw_namespace, in canBreakBefore()
5506 Right.isOneOf(tok::identifier, tok::string_literal)) { in canBreakBefore()
5509 if (Right.is(TT_TemplateString) && Right.closesScope()) in canBreakBefore()
5513 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
5524 return Right.isNot(tok::l_paren); in canBreakBefore()
5525 if (Right.is(TT_PointerOrReference)) { in canBreakBefore()
5527 (getTokenPointerOrReferenceAlignment(Right) == in canBreakBefore()
5529 (!Right.Next || Right.Next->isNot(TT_FunctionDeclarationName))); in canBreakBefore()
5531 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) || in canBreakBefore()
5532 Right.is(tok::kw_operator)) { in canBreakBefore()
5537 if (Right.isTrailingComment()) { in canBreakBefore()
5544 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
5547 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
5549 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
5555 if (Right.is(TT_InheritanceColon)) in canBreakBefore()
5557 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) && in canBreakBefore()
5562 if (Right.is(tok::colon) && in canBreakBefore()
5563 !Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) { in canBreakBefore()
5568 if (!Style.AlwaysBreakBeforeMultilineStrings && Right.isStringLiteral()) in canBreakBefore()
5594 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
5595 Right.is(TT_DictLiteral)) || in canBreakBefore()
5596 Right.is(TT_ArrayInitializerLSquare)) { in canBreakBefore()
5602 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
5603 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) { in canBreakBefore()
5606 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
5607 Right.Next->is(TT_ObjCMethodExpr))) { in canBreakBefore()
5612 if (Right.is(tok::kw_concept)) in canBreakBefore()
5614 if (Right.is(TT_RequiresClause)) in canBreakBefore()
5620 if (Right.isOneOf(TT_RangeBasedForLoopColon, TT_OverloadedOperatorLParen, in canBreakBefore()
5626 if (Right.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
5628 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
5630 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
5631 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
5634 if (Right.is(TT_BinaryOperator) && in canBreakBefore()
5637 Right.getPrecedence() != prec::Assignment)) { in canBreakBefore()
5644 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
5648 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
5660 if (Right.is(TT_ImplicitStringLiteral)) in canBreakBefore()
5663 if (Right.is(TT_TemplateCloser)) in canBreakBefore()
5665 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
5666 Right.MatchingParen->is(TT_LambdaLSquare)) { in canBreakBefore()
5672 if (Right.is(tok::r_brace)) { in canBreakBefore()
5673 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) || in canBreakBefore()
5674 (Right.isBlockIndentedInitRBrace(Style))); in canBreakBefore()
5678 if (Right.is(tok::r_paren)) { in canBreakBefore()
5680 !Right.MatchingParen) { in canBreakBefore()
5683 auto Next = Right.Next; in canBreakBefore()
5688 const FormatToken *Previous = Right.MatchingParen->Previous; in canBreakBefore()
5695 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren, in canBreakBefore()
5699 if (Right.isAttribute()) in canBreakBefore()
5702 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare)) in canBreakBefore()
5705 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
5708 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
5713 (!Right.isTrailingComment() || Right.NewlinesBefore > 0); in canBreakBefore()
5715 if (Right.is(TT_CtorInitializerColon)) in canBreakBefore()
5721 if (Right.is(TT_CtorInitializerComma) && in canBreakBefore()
5729 if (Right.is(TT_InheritanceComma) && in canBreakBefore()
5735 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
5744 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
5745 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
5750 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) { in canBreakBefore()
5753 if (isAllmanLambdaBrace(Right)) in canBreakBefore()
5754 return !isItAnEmptyLambdaAllowed(Right, ShortLambdaOption); in canBreakBefore()
5757 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) { in canBreakBefore()
5764 return Right.Next && Right.Next->is(tok::l_paren); in canBreakBefore()
5770 Right.isMemberAccess() || in canBreakBefore()
5771 Right.isOneOf(TT_TrailingReturnArrow, tok::lessless, tok::colon, in canBreakBefore()
5774 Right.isOneOf(tok::identifier, tok::kw_const)) || in canBreakBefore()
5775 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) || in canBreakBefore()
5776 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser)); in canBreakBefore()