Lines Matching refs:Left
53 static bool isLambdaParameterList(const FormatToken *Left) { in isLambdaParameterList() argument
55 if (Left->Previous && Left->Previous->is(tok::greater) && in isLambdaParameterList()
56 Left->Previous->MatchingParen && in isLambdaParameterList()
57 Left->Previous->MatchingParen->is(TT_TemplateOpener)) { in isLambdaParameterList()
58 Left = Left->Previous->MatchingParen; in isLambdaParameterList()
62 return Left->Previous && Left->Previous->is(tok::r_square) && in isLambdaParameterList()
63 Left->Previous->MatchingParen && in isLambdaParameterList()
64 Left->Previous->MatchingParen->is(TT_LambdaLSquare); in isLambdaParameterList()
108 FormatToken *Left = CurrentToken->Previous; in parseAngle() local
109 Left->ParentBracket = Contexts.back().ContextKind; in parseAngle()
119 if (Left->Previous && Left->Previous->isNot(tok::kw_template)) in parseAngle()
136 Left->ParentBracket != tok::less && in parseAngle()
143 Left->MatchingParen = CurrentToken; in parseAngle()
144 CurrentToken->MatchingParen = Left; in parseAngle()
151 (Style.Language == FormatStyle::LK_Proto && Left->Previous && in parseAngle()
152 Left->Previous->isOneOf(TT_SelectorName, TT_DictLiteral))) { in parseAngle()
183 updateParameterCount(Left, CurrentToken); in parseAngle()
573 FormatToken *Left = CurrentToken->Previous; in parseSquare() local
574 Left->ParentBracket = Contexts.back().ContextKind; in parseSquare()
575 FormatToken *Parent = Left->getPreviousNonComment(); in parseSquare()
585 bool IsCpp11AttributeSpecifier = isCpp11AttributeSpecifier(*Left) || in parseSquare()
590 isCSharpAttributeSpecifier(*Left) || in parseSquare()
594 bool IsCppStructuredBinding = Left->isCppStructuredBinding(Style); in parseSquare()
599 Left->isNot(TT_LambdaLSquare) && in parseSquare()
613 Left->setType(TT_StructuredBindingLSquare); in parseSquare()
614 } else if (Left->is(TT_Unknown)) { in parseSquare()
616 Left->setType(TT_ObjCMethodExpr); in parseSquare()
618 Left->setType(TT_InlineASMSymbolicNameLSquare); in parseSquare()
620 Left->setType(TT_AttributeSquare); in parseSquare()
624 Left->setType(TT_JsComputedPropertyName); in parseSquare()
627 Left->setType(TT_DesignatedInitializerLSquare); in parseSquare()
629 Left->setType(TT_AttributeSquare); in parseSquare()
632 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
661 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
662 if (!Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
664 !Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
666 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) { in parseSquare()
667 Left->setType(TT_ProtoExtensionLSquare); in parseSquare()
676 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
679 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
701 CurrentToken->Previous->Previous == Left)) && in parseSquare()
702 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
708 Left->setType(TT_Unknown); in parseSquare()
710 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) { in parseSquare()
730 Left->MatchingParen = CurrentToken; in parseSquare()
731 CurrentToken->MatchingParen = Left; in parseSquare()
743 Left->ParameterCount = in parseSquare()
749 if (Left->BlockParameterCount > 1) in parseSquare()
764 } else if (Left->isOneOf(TT_ArraySubscriptLSquare, in parseSquare()
766 Left->setType(TT_ObjCMethodExpr); in parseSquare()
776 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
778 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
783 updateParameterCount(Left, Tok); in parseSquare()
872 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
877 ++Left->BlockParameterCount; in updateParameterCount()
879 ++Left->ParameterCount; in updateParameterCount()
880 if (!Left->Role) in updateParameterCount()
881 Left->Role.reset(new CommaSeparatedList(Style)); in updateParameterCount()
882 Left->Role->CommaFound(Current); in updateParameterCount()
883 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
884 Left->ParameterCount = 1; in updateParameterCount()
3035 const FormatToken &Left = *Tok.Previous; in splitPenalty() local
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()
3051 if (Left.is(TT_JsTypeColon)) in splitPenalty()
3053 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in splitPenalty()
3058 if (Left.opensScope() && Right.closesScope()) 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()
3087 if (Left.is(TT_StartOfName)) in splitPenalty()
3097 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3099 if (Left.is(TT_CastRParen)) in splitPenalty()
3101 if (Left.isOneOf(tok::kw_class, tok::kw_struct)) in splitPenalty()
3103 if (Left.is(tok::comment)) in splitPenalty()
3106 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon, 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()
3184 if (Left.is(TT_TemplateOpener)) in splitPenalty()
3186 if (Left.opensScope()) { in splitPenalty()
3191 (Left.ParameterCount <= 1 || Style.AllowAllArgumentsOnNextLine)) { in splitPenalty()
3194 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
3196 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter in splitPenalty()
3199 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
3202 if (Left.is(TT_UnaryOperator)) in splitPenalty()
3204 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && in splitPenalty()
3205 Left.Previous->isLabelString() && in splitPenalty()
3206 (Left.NextOperator || Left.OperatorIndex != 0)) { 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()
3221 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
3227 if (Left.ClosesTemplateDeclaration) in splitPenalty()
3229 if (Left.ClosesRequiresClause) in splitPenalty()
3231 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
3233 prec::Level Level = Left.getPrecedence(); in splitPenalty()
3259 const FormatToken &Left, in spaceRequiredBetween() argument
3261 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
3265 if (Style.isJson() && Left.is(tok::string_literal) && Right.is(tok::colon)) in spaceRequiredBetween()
3267 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
3270 Left.Tok.getObjCKeywordID() == tok::objc_property) { in spaceRequiredBetween()
3274 return Left.is(tok::hash); in spaceRequiredBetween()
3275 if (Left.isOneOf(tok::hashhash, 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()
3284 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
3285 LeftParen = &Left; 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()
3309 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
3311 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) 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()
3333 if (Left.is(tok::colon)) in spaceRequiredBetween()
3334 return !Left.is(TT_ObjCMethodExpr); in spaceRequiredBetween()
3335 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
3337 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
3340 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
3342 if (Left.is(tok::less) && Right.is(tok::greater)) 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()
3356 if (!Left.MatchingParen) in spaceRequiredBetween()
3359 Left.MatchingParen->getPreviousNonComment(); in spaceRequiredBetween()
3360 if (!TokenBeforeMatchingParen || !Left.is(TT_TypeDeclarationParen)) in spaceRequiredBetween()
3368 (Left.is(TT_AttributeParen) || in spaceRequiredBetween()
3369 Left.canBePointerOrReferenceQualifier())) { in spaceRequiredBetween()
3372 if (Left.Tok.isLiteral()) in spaceRequiredBetween()
3375 if (Left.isTypeOrIdentifier() && Right.Next && Right.Next->Next && in spaceRequiredBetween()
3380 return !Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
3384 (Left.NestingLevel == 0 || in spaceRequiredBetween()
3385 (Left.NestingLevel == 1 && startsWithInitStatement(Line))))); in spaceRequiredBetween()
3387 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
3388 (!Left.is(TT_PointerOrReference) || in spaceRequiredBetween()
3389 (getTokenPointerOrReferenceAlignment(Left) != FormatStyle::PAS_Right && in spaceRequiredBetween()
3393 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
3416 if (Left.Previous && Left.Previous->isTypeOrIdentifier() && Right.Next && in spaceRequiredBetween()
3418 return getTokenPointerOrReferenceAlignment(Left) != in spaceRequiredBetween()
3425 if (getTokenPointerOrReferenceAlignment(Left) == FormatStyle::PAS_Right) in spaceRequiredBetween()
3434 (Left.NestingLevel == Line.First->NestingLevel || in spaceRequiredBetween()
3435 ((Left.NestingLevel == Line.First->NestingLevel + 1) && in spaceRequiredBetween()
3439 return Left.Previous && !Left.Previous->isOneOf( 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()
3453 const FormatToken *Previous = &Left; in spaceRequiredBetween()
3501 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
3502 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
3503 SpaceRequiredForArrayInitializerLSquare(Left, Style)) || in spaceRequiredBetween()
3504 (Left.isOneOf(TT_ArraySubscriptLSquare, TT_StructuredBindingLSquare, 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()
3529 return !Left.Children.empty(); // No spaces in "{}". in spaceRequiredBetween()
3530 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
3535 if (Left.is(TT_BlockComment)) { in spaceRequiredBetween()
3537 return Style.isJavaScript() || !Left.TokenText.endswith("=*/"); in spaceRequiredBetween()
3542 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
3546 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
3548 if (Left.isOneOf(TT_RequiresClause, in spaceRequiredBetween()
3553 if (Left.is(TT_RequiresExpression)) { 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()
3561 if (Left.is(TT_ForEachMacro)) { in spaceRequiredBetween()
3565 if (Left.is(TT_IfMacro)) { 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()
3575 Left.isIf(Line.Type != LT_PreprocessorDirective)) { in spaceRequiredBetween()
3585 if (Line.MightBeFunctionDecl && (Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
3595 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
3596 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) { 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()
3606 return ((!Line.MightBeFunctionDecl || !Left.Previous) && in spaceRequiredBetween()
3611 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
3612 Left.MatchingParen->Previous && 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()
3633 Left.isSimpleTypeSpecifier()) && 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()
3643 (Left.TokenText == "L" || Left.TokenText == "u" || in spaceRequiredBetween()
3644 Left.TokenText == "U" || Left.TokenText == "u8" || in spaceRequiredBetween()
3645 Left.TokenText == "LR" || Left.TokenText == "uR" || in spaceRequiredBetween()
3646 Left.TokenText == "UR" || Left.TokenText == "u8R")) { in spaceRequiredBetween()
3649 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
3650 Left.MatchingParen->Previous && 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()
3671 Left.isOneOf(tok::kw_const, tok::kw_volatile) && in spaceRequiredBetween()
3684 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore() local
3688 if (Left.Finalized) in spaceRequiredBefore()
3692 if (Keywords.isWordLike(Right) && Keywords.isWordLike(Left)) in spaceRequiredBefore()
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()
3706 if (Left.isOneOf(Keywords.kw_module, Keywords.kw_import) && in spaceRequiredBefore()
3711 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
3714 if (Left.is(TT_ModulePartitionColon) && 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()
3729 !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) { in spaceRequiredBefore()
3732 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
3739 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required, in spaceRequiredBefore()
3744 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) { 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()
3752 if (Left.MatchingParen && in spaceRequiredBefore()
3753 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
3758 if (Left.is(tok::percent)) in spaceRequiredBefore()
3762 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) 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()
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()
3792 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
3796 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
3800 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) 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()
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()
3843 if (Left.is(TT_FatArrow)) 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()
3858 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in spaceRequiredBefore()
3864 if (Keywords.IsJavaScriptIdentifier(Left, in spaceRequiredBefore()
3870 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) { in spaceRequiredBefore()
3874 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield, in spaceRequiredBefore()
3880 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
3884 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
3885 Left.Tok.getIdentifierInfo()) { in spaceRequiredBefore()
3889 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, in spaceRequiredBefore()
3895 if (Left.endsSequence(tok::kw_const, Keywords.kw_as)) in spaceRequiredBefore()
3897 if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, in spaceRequiredBefore()
3902 (Left.is(Keywords.kw_of) && Left.Previous && 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()
3912 if (Left.is(Keywords.kw_as) && 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()
3924 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
3926 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
3930 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
3932 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
3942 if (Left.is(TT_NonNullAssertion) && 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()
3955 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract, in spaceRequiredBefore()
3962 if (!Left.is(TT_BinaryOperator) && in spaceRequiredBefore()
3963 Left.isOneOf(Keywords.kw_verilogHash, Keywords.kw_verilogHashHash)) { 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()
3976 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
3979 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
3981 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
3989 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
3994 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) { in spaceRequiredBefore()
3997 if (Left.is(tok::comma) && !Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
4011 if (Left.is(TT_BitFieldColon)) { 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()
4042 (Left.isOneOf(tok::plus, tok::plusplus) && in spaceRequiredBefore()
4046 if (Left.is(TT_UnaryOperator)) { 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()
4066 if (Left.is(TT_CastRParen)) { in spaceRequiredBefore()
4079 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4081 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) { in spaceRequiredBefore()
4084 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4089 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
4093 if (!Style.SpaceBeforeAssignmentOperators && Left.isNot(TT_TemplateCloser) && 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()
4108 !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren)) { in spaceRequiredBefore()
4110 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
4113 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, in spaceRequiredBefore()
4116 (Left.is(tok::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
4118 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
4122 return !Left.isOneOf(tok::amp, tok::ampamp) || in spaceRequiredBefore()
4123 getTokenReferenceAlignment(Left) != FormatStyle::PAS_Right; in spaceRequiredBefore()
4130 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
4131 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && in spaceRequiredBefore()
4135 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4136 Left.MatchingParen && in spaceRequiredBefore()
4137 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) { in spaceRequiredBefore()
4140 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4146 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
4148 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
4186 const FormatToken &Left = *Right.Previous; in mustBreakBefore() local
4191 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4196 Left.is(TT_CSharpNamedArgumentColon)) { in mustBreakBefore()
4208 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
4214 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && 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()
4236 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4245 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
4246 Left.Previous->is(TT_FatArrow)) { in mustBreakBefore()
4254 return !Left.Children.empty(); in mustBreakBefore()
4258 return (Left.NestingLevel == 0 && Line.Level == 0) && in mustBreakBefore()
4259 !Left.Children.empty(); in mustBreakBefore()
4264 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
4265 !Left.Children.empty()) { in mustBreakBefore()
4269 (Left.NestingLevel == 0 && Line.Level == 0 && in mustBreakBefore()
4274 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
4283 if (Left.isStringLiteral() && Right.isStringLiteral()) 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()
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()
4316 Left.isNot(BK_Block) && Left.MatchingParen) { in mustBreakBefore()
4317 BeforeClosingBrace = Left.MatchingParen->Previous; in mustBreakBefore()
4323 BeforeClosingBrace = &Left; in mustBreakBefore()
4332 return Left.isNot(BK_BracedInit) && Left.isNot(TT_CtorInitializerColon) && in mustBreakBefore()
4335 if (Left.isTrailingComment()) in mustBreakBefore()
4337 if (Left.IsUnterminatedLiteral) in mustBreakBefore()
4339 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
4353 if (Left.ClosesTemplateDeclaration && Left.MatchingParen && in mustBreakBefore()
4354 Left.MatchingParen->NestingLevel == 0) { in mustBreakBefore()
4362 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { in mustBreakBefore()
4373 (Left.is(TT_CtorInitializerComma) || in mustBreakBefore()
4379 Left.isOneOf(TT_CtorInitializerColon, TT_CtorInitializerComma)) { in mustBreakBefore()
4394 Left.is(TT_InheritanceComma)) { 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()
4413 if (isAllmanBrace(Left) || isAllmanBrace(Right)) { in mustBreakBefore()
4444 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
4450 if (Left.is(TT_AttributeParen) && Right.is(TT_ObjCDecl)) in mustBreakBefore()
4453 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
4454 if (IsFunctionArgument(Left) && in mustBreakBefore()
4461 (!Left.Children.empty() && in mustBreakBefore()
4468 Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) { in mustBreakBefore()
4474 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
4515 if (Left.is(tok::at)) in mustBreakBefore()
4549 if (Left.ParameterCount == 0) 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()
4576 if (Left.BlockParameterCount > 1) in mustBreakBefore()
4580 if (!Left.Role) in mustBreakBefore()
4582 auto Comma = Left.Role->lastComma(); in mustBreakBefore()
4597 const FormatToken &Left = *Right.Previous; in canBreakBefore() local
4600 if (Left.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon) || in canBreakBefore()
4606 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
4611 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
4632 (Left.Tok.getIdentifierInfo() || in canBreakBefore()
4633 Left.isOneOf(tok::r_square, tok::r_paren)) && in canBreakBefore()
4641 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
4643 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
4646 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
4663 if (Left.is(Keywords.kw_in)) in canBreakBefore()
4675 if (Left.is(Keywords.kw_as)) in canBreakBefore()
4677 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
4679 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
4688 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) && in canBreakBefore()
4696 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
4698 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
4702 if (Left.is(tok::at)) in canBreakBefore()
4704 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
4706 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation)) in canBreakBefore()
4718 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
4726 return Left.is(BK_BracedInit) || in canBreakBefore()
4727 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
4730 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
4734 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
4736 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
4741 Left.isNot(TT_SelectorName)) { in canBreakBefore()
4749 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { 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()
4800 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
4802 if (Left.ClosesRequiresClause) in canBreakBefore()
4808 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
4812 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) 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()
4824 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) || 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()
4829 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) { in canBreakBefore()
4832 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
4836 if (Left.is(tok::l_paren) && in canBreakBefore()
4837 Left.isOneOf(TT_AttributeParen, TT_TypeDeclarationParen)) { in canBreakBefore()
4840 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
4841 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen))) { in canBreakBefore()
4871 if (Left.is(TT_TrailingAnnotation)) { in canBreakBefore()
4878 return !Left.is(TT_AttributeSquare); in canBreakBefore()
4881 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
4887 if (Left.is(TT_CtorInitializerColon)) { in canBreakBefore()
4893 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
4901 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
4909 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
4911 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
4913 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
4914 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
4917 Left.getPrecedence() == prec::Assignment)) { 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()
4927 if (isAllmanLambdaBrace(Left)) in canBreakBefore()
4928 return !isItAnEmptyLambdaAllowed(Left, ShortLambdaOption); in canBreakBefore()
4933 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
4938 (Left.is(tok::r_paren) && in canBreakBefore()
4940 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
4941 (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)); in canBreakBefore()