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()
140 FormatToken *Left = CurrentToken->Previous; in parseAngle() local
141 Left->ParentBracket = Contexts.back().ContextKind; in parseAngle()
151 if (Left->Previous && Left->Previous->isNot(tok::kw_template)) in parseAngle()
168 Left->ParentBracket != tok::less && in parseAngle()
174 Left->MatchingParen = CurrentToken; in parseAngle()
175 CurrentToken->MatchingParen = Left; in parseAngle()
182 (Style.Language == FormatStyle::LK_Proto && Left->Previous && in parseAngle()
183 Left->Previous->isOneOf(TT_SelectorName, TT_DictLiteral))) { in parseAngle()
214 updateParameterCount(Left, CurrentToken); in parseAngle()
588 FormatToken *Left = CurrentToken->Previous; in parseSquare() local
589 Left->ParentBracket = Contexts.back().ContextKind; in parseSquare()
590 FormatToken *Parent = Left->getPreviousNonComment(); in parseSquare()
602 isCpp11AttributeSpecifier(*Left) || IsInnerSquare; in parseSquare()
606 isCSharpAttributeSpecifier(*Left) || in parseSquare()
610 bool IsCppStructuredBinding = Left->isCppStructuredBinding(Style); in parseSquare()
615 Left->isNot(TT_LambdaLSquare) && in parseSquare()
629 Left->setType(TT_StructuredBindingLSquare); in parseSquare()
630 } else if (Left->is(TT_Unknown)) { in parseSquare()
632 Left->setType(TT_ObjCMethodExpr); in parseSquare()
634 Left->setType(TT_InlineASMSymbolicNameLSquare); in parseSquare()
636 Left->setType(TT_AttributeSquare); in parseSquare()
637 if (!IsInnerSquare && Left->Previous) in parseSquare()
638 Left->Previous->EndsCppAttributeGroup = false; in parseSquare()
642 Left->setType(TT_JsComputedPropertyName); in parseSquare()
645 Left->setType(TT_DesignatedInitializerLSquare); in parseSquare()
647 Left->setType(TT_AttributeSquare); in parseSquare()
650 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
679 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
680 if (!Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
682 !Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
684 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) { in parseSquare()
685 Left->setType(TT_ProtoExtensionLSquare); in parseSquare()
694 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
697 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
722 CurrentToken->Previous->Previous == Left)) && in parseSquare()
723 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
729 Left->setType(TT_Unknown); in parseSquare()
731 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) { in parseSquare()
751 Left->MatchingParen = CurrentToken; in parseSquare()
752 CurrentToken->MatchingParen = Left; in parseSquare()
764 Left->ParameterCount = in parseSquare()
770 if (Left->BlockParameterCount > 1) in parseSquare()
786 Left->isOneOf(TT_ArraySubscriptLSquare, in parseSquare()
788 Left->setType(TT_ObjCMethodExpr); in parseSquare()
798 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
800 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
805 updateParameterCount(Left, Tok); in parseSquare()
894 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
899 ++Left->BlockParameterCount; in updateParameterCount()
901 ++Left->ParameterCount; in updateParameterCount()
902 if (!Left->Role) in updateParameterCount()
903 Left->Role.reset(new CommaSeparatedList(Style)); in updateParameterCount()
904 Left->Role->CommaFound(Current); in updateParameterCount()
905 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
906 Left->ParameterCount = 1; in updateParameterCount()
3145 const FormatToken &Left = *Tok.Previous; in splitPenalty() local
3148 if (Left.is(tok::semi)) in splitPenalty()
3157 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
3160 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
3162 if (Left.is(TT_JsTypeColon)) in splitPenalty()
3164 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in splitPenalty()
3169 if (Left.opensScope() && Right.closesScope()) in splitPenalty()
3181 if (Left.is(tok::r_square)) in splitPenalty()
3184 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
3193 if (Left.is(tok::coloncolon)) in splitPenalty()
3199 if (Left.is(TT_StartOfName)) in splitPenalty()
3209 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3211 if (Left.is(TT_CastRParen)) in splitPenalty()
3213 if (Left.isOneOf(tok::kw_class, tok::kw_struct, tok::kw_union)) in splitPenalty()
3215 if (Left.is(tok::comment)) in splitPenalty()
3218 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon, in splitPenalty()
3260 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
3264 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
3271 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
3277 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3278 Left.Previous->isOneOf(tok::identifier, tok::greater)) { in splitPenalty()
3282 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0) in splitPenalty()
3284 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
3288 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3289 (Left.Previous->isOneOf(tok::kw_for, tok::kw__Generic) || in splitPenalty()
3290 Left.Previous->isIf())) { in splitPenalty()
3293 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
3297 if (Left.is(TT_TemplateOpener)) in splitPenalty()
3299 if (Left.opensScope()) { in splitPenalty()
3304 (Left.ParameterCount <= 1 || Style.AllowAllArgumentsOnNextLine)) { in splitPenalty()
3307 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
3309 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter in splitPenalty()
3312 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
3315 if (Left.is(TT_UnaryOperator)) in splitPenalty()
3317 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && in splitPenalty()
3318 Left.Previous->isLabelString() && in splitPenalty()
3319 (Left.NextOperator || Left.OperatorIndex != 0)) { in splitPenalty()
3322 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
3326 if (Left.is(tok::comma)) in splitPenalty()
3328 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
3334 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
3340 if (Left.ClosesTemplateDeclaration) in splitPenalty()
3342 if (Left.ClosesRequiresClause) in splitPenalty()
3344 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
3346 prec::Level Level = Left.getPrecedence(); in splitPenalty()
3372 const FormatToken &Left, in spaceRequiredBetween() argument
3374 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
3378 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen && in spaceRequiredBetween()
3382 if (Style.isJson() && Left.is(tok::string_literal) && Right.is(tok::colon)) in spaceRequiredBetween()
3384 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
3387 Left.Tok.getObjCKeywordID() == tok::objc_property) { in spaceRequiredBetween()
3391 return Left.is(tok::hash); in spaceRequiredBetween()
3392 if (Left.isOneOf(tok::hashhash, tok::hash)) in spaceRequiredBetween()
3394 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
3395 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
3401 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
3402 LeftParen = &Left; in spaceRequiredBetween()
3412 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, in spaceRequiredBetween()
3419 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
3423 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && Left.Previous && in spaceRequiredBetween()
3424 Left.Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
3428 if (Left.isOneOf(tok::kw_co_await, tok::kw_co_yield, tok::kw_co_return) && in spaceRequiredBetween()
3433 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
3435 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
3447 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
3449 if (Left.isOneOf(tok::exclaim, tok::tilde)) in spaceRequiredBetween()
3451 if (Left.is(tok::at) && in spaceRequiredBetween()
3457 if (Left.is(tok::colon)) in spaceRequiredBetween()
3458 return !Left.is(TT_ObjCMethodExpr); in spaceRequiredBetween()
3459 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
3461 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
3464 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
3466 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
3475 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
3476 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
3478 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
3481 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
3482 if (!Left.MatchingParen) in spaceRequiredBetween()
3485 Left.MatchingParen->getPreviousNonComment(); in spaceRequiredBetween()
3486 if (!TokenBeforeMatchingParen || !Left.is(TT_TypeDeclarationParen)) in spaceRequiredBetween()
3494 (Left.is(TT_AttributeParen) || in spaceRequiredBetween()
3495 Left.canBePointerOrReferenceQualifier())) { in spaceRequiredBetween()
3498 if (Left.Tok.isLiteral()) in spaceRequiredBetween()
3501 if (Left.isTypeOrIdentifier() && Right.Next && Right.Next->Next && in spaceRequiredBetween()
3506 return !Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
3510 (Left.NestingLevel == 0 || in spaceRequiredBetween()
3511 (Left.NestingLevel == 1 && startsWithInitStatement(Line))))); in spaceRequiredBetween()
3513 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
3514 (!Left.is(TT_PointerOrReference) || in spaceRequiredBetween()
3515 (getTokenPointerOrReferenceAlignment(Left) != FormatStyle::PAS_Right && in spaceRequiredBetween()
3519 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
3543 if (Left.Previous && Left.Previous->isTypeOrIdentifier() && Right.Next && in spaceRequiredBetween()
3545 return getTokenPointerOrReferenceAlignment(Left) != in spaceRequiredBetween()
3552 if (getTokenPointerOrReferenceAlignment(Left) == FormatStyle::PAS_Right) in spaceRequiredBetween()
3561 (Left.NestingLevel == Line.First->NestingLevel || in spaceRequiredBetween()
3562 ((Left.NestingLevel == Line.First->NestingLevel + 1) && in spaceRequiredBetween()
3566 return Left.Previous && !Left.Previous->isOneOf( in spaceRequiredBetween()
3570 if (Left.is(tok::ellipsis) && Left.Previous && in spaceRequiredBetween()
3571 Left.Previous->isOneOf(tok::star, tok::amp, tok::ampamp)) { in spaceRequiredBetween()
3575 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
3577 if (Left.is(tok::star) && Right.isOneOf(tok::star, tok::amp, tok::ampamp)) in spaceRequiredBetween()
3580 const FormatToken *Previous = &Left; in spaceRequiredBetween()
3628 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
3629 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
3630 SpaceRequiredForArrayInitializerLSquare(Left, Style)) || in spaceRequiredBetween()
3631 (Left.isOneOf(TT_ArraySubscriptLSquare, TT_StructuredBindingLSquare, in spaceRequiredBetween()
3650 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral) && in spaceRequiredBetween()
3651 !(!Left.is(tok::r_square) && Style.SpaceBeforeSquareBrackets && in spaceRequiredBetween()
3655 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
3656 return !Left.Children.empty(); // No spaces in "{}". in spaceRequiredBetween()
3657 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
3662 if (Left.is(TT_BlockComment)) { in spaceRequiredBetween()
3664 return Style.isJavaScript() || !Left.TokenText.endswith("=*/"); in spaceRequiredBetween()
3669 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
3673 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
3675 if (Left.isOneOf(TT_RequiresClause, in spaceRequiredBetween()
3680 if (Left.is(TT_RequiresExpression)) { in spaceRequiredBetween()
3684 if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || in spaceRequiredBetween()
3685 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) { in spaceRequiredBetween()
3688 if (Left.is(TT_ForEachMacro)) { in spaceRequiredBetween()
3692 if (Left.is(TT_IfMacro)) { in spaceRequiredBetween()
3698 if (Left.is(tok::semi)) in spaceRequiredBetween()
3700 if (Left.isOneOf(tok::pp_elif, tok::kw_for, tok::kw_while, tok::kw_switch, in spaceRequiredBetween()
3702 Left.isIf(Line.Type != LT_PreprocessorDirective) || in spaceRequiredBetween()
3713 if (Line.MightBeFunctionDecl && (Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
3723 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
3724 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) { in spaceRequiredBetween()
3728 if (!Left.Previous || Left.Previous->isNot(tok::period)) { in spaceRequiredBetween()
3729 if (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch)) { in spaceRequiredBetween()
3733 if (Left.isOneOf(tok::kw_new, tok::kw_delete)) { in spaceRequiredBetween()
3734 return ((!Line.MightBeFunctionDecl || !Left.Previous) && in spaceRequiredBetween()
3739 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
3740 Left.MatchingParen->Previous && in spaceRequiredBetween()
3741 Left.MatchingParen->Previous->is(tok::kw_delete)) { in spaceRequiredBetween()
3748 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) { in spaceRequiredBetween()
3753 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
3756 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) && in spaceRequiredBetween()
3757 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr)); in spaceRequiredBetween()
3759 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square, in spaceRequiredBetween()
3761 Left.isSimpleTypeSpecifier()) && in spaceRequiredBetween()
3766 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
3770 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
3771 (Left.TokenText == "L" || Left.TokenText == "u" || in spaceRequiredBetween()
3772 Left.TokenText == "U" || Left.TokenText == "u8" || in spaceRequiredBetween()
3773 Left.TokenText == "LR" || Left.TokenText == "uR" || in spaceRequiredBetween()
3774 Left.TokenText == "UR" || Left.TokenText == "u8R")) { in spaceRequiredBetween()
3777 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
3778 Left.MatchingParen->Previous && in spaceRequiredBetween()
3779 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
3780 Left.MatchingParen->Previous->is(tok::coloncolon))) { in spaceRequiredBetween()
3786 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
3788 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
3799 Left.isOneOf(tok::kw_const, tok::kw_volatile) && in spaceRequiredBetween()
3812 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore() local
3816 if (Left.Finalized) in spaceRequiredBefore()
3820 if (Keywords.isWordLike(Right) && Keywords.isWordLike(Left)) in spaceRequiredBefore()
3825 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
3830 if (Right.is(tok::period) && Left.is(tok::numeric_constant)) in spaceRequiredBefore()
3834 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
3837 if (Left.isOneOf(Keywords.kw_module, Keywords.kw_import) && in spaceRequiredBefore()
3842 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
3845 if (Left.is(TT_ModulePartitionColon) && in spaceRequiredBefore()
3849 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
3854 if (Left.is(TT_AttributeParen) && Right.is(tok::coloncolon)) in spaceRequiredBefore()
3857 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
3860 !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) { in spaceRequiredBefore()
3863 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
3870 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required, in spaceRequiredBefore()
3875 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) { in spaceRequiredBefore()
3878 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
3881 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
3883 if (Left.MatchingParen && in spaceRequiredBefore()
3884 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
3889 if (Left.is(tok::percent)) in spaceRequiredBefore()
3893 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
3904 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
3908 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3916 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
3919 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
3923 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
3927 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
3931 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
3935 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
3947 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
3951 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3956 if (Left.isOneOf(tok::kw_using, Keywords.kw_async, Keywords.kw_when, in spaceRequiredBefore()
3965 if (Left.isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, in spaceRequiredBefore()
3974 if (Left.is(TT_FatArrow)) in spaceRequiredBefore()
3977 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
3978 Left.Previous->is(tok::kw_for)) { in spaceRequiredBefore()
3981 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
3989 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in spaceRequiredBefore()
3995 if (Keywords.IsJavaScriptIdentifier(Left, in spaceRequiredBefore()
4001 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) { in spaceRequiredBefore()
4005 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield, in spaceRequiredBefore()
4011 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
4015 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
4016 Left.Tok.getIdentifierInfo()) { in spaceRequiredBefore()
4020 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, in spaceRequiredBefore()
4026 if (Left.endsSequence(tok::kw_const, Keywords.kw_as)) in spaceRequiredBefore()
4028 if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, in spaceRequiredBefore()
4033 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
4034 (Left.Previous->is(tok::identifier) || in spaceRequiredBefore()
4035 Left.Previous->isOneOf(tok::r_square, tok::r_brace)))) && in spaceRequiredBefore()
4036 (!Left.Previous || !Left.Previous->is(tok::period))) { in spaceRequiredBefore()
4039 if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous && in spaceRequiredBefore()
4040 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4043 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
4047 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
4048 Left.Previous->is(tok::kw_export)) { in spaceRequiredBefore()
4051 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4055 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
4057 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
4061 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
4063 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4073 if (Left.is(TT_NonNullAssertion) && in spaceRequiredBefore()
4078 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4080 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4084 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, in spaceRequiredBefore()
4086 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract, in spaceRequiredBefore()
4094 if ((Left.is(TT_VerilogTableItem) && in spaceRequiredBefore()
4096 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) { in spaceRequiredBefore()
4101 if (Left.isNot(TT_BinaryOperator) && in spaceRequiredBefore()
4102 Left.isOneOf(Keywords.kw_verilogHash, Keywords.kw_verilogHashHash)) { in spaceRequiredBefore()
4107 (Left.endsSequence(tok::numeric_constant, Keywords.kw_verilogHash) || in spaceRequiredBefore()
4108 Left.endsSequence(tok::numeric_constant, in spaceRequiredBefore()
4110 (Left.is(tok::r_paren) && Left.MatchingParen && in spaceRequiredBefore()
4111 Left.MatchingParen->endsSequence(tok::l_paren, tok::at)))) { in spaceRequiredBefore()
4116 if (Left.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
4117 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) { in spaceRequiredBefore()
4122 Left.isOneOf(TT_VerilogDimensionedTypeName, Keywords.kw_function)) { in spaceRequiredBefore()
4129 !(Left.isOneOf(Keywords.kw_assign, Keywords.kw_unique) || in spaceRequiredBefore()
4130 Keywords.isVerilogWordOperator(Left)) && in spaceRequiredBefore()
4131 (Left.isOneOf(tok::r_square, tok::r_paren, tok::r_brace, in spaceRequiredBefore()
4133 Keywords.isWordLike(Left))) { in spaceRequiredBefore()
4137 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
4140 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
4143 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
4145 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
4153 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
4158 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) { in spaceRequiredBefore()
4161 if (Left.is(tok::comma) && !Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
4175 if (Left.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4192 if (Left.is(tok::question)) in spaceRequiredBefore()
4194 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
4211 if ((Left.isOneOf(tok::minus, tok::minusminus) && in spaceRequiredBefore()
4213 (Left.isOneOf(tok::plus, tok::plusplus) && in spaceRequiredBefore()
4217 if (Left.is(TT_UnaryOperator)) { in spaceRequiredBefore()
4222 if (Left.is(tok::exclaim) && Left.TokenText == "not") in spaceRequiredBefore()
4224 if (Left.is(tok::tilde) && Left.TokenText == "compl") in spaceRequiredBefore()
4228 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
4231 return (Style.SpaceAfterLogicalNot && Left.is(tok::exclaim)) || in spaceRequiredBefore()
4237 if (Left.is(TT_CastRParen)) { in spaceRequiredBefore()
4250 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4252 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) { in spaceRequiredBefore()
4255 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4260 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
4264 if (!Style.SpaceBeforeAssignmentOperators && Left.isNot(TT_TemplateCloser) && in spaceRequiredBefore()
4269 (Left.is(tok::identifier) || Left.is(tok::kw_this))) { in spaceRequiredBefore()
4272 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
4279 !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren)) { in spaceRequiredBefore()
4281 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
4284 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, in spaceRequiredBefore()
4287 (Left.is(tok::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
4289 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
4293 return !Left.isOneOf(tok::amp, tok::ampamp) || in spaceRequiredBefore()
4294 getTokenReferenceAlignment(Left) != FormatStyle::PAS_Right; in spaceRequiredBefore()
4301 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
4302 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && in spaceRequiredBefore()
4306 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4307 Left.MatchingParen && in spaceRequiredBefore()
4308 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) { in spaceRequiredBefore()
4311 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4317 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
4319 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
4357 const FormatToken &Left = *Right.Previous; in mustBreakBefore() local
4362 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4367 Left.is(TT_CSharpNamedArgumentColon)) { in mustBreakBefore()
4379 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
4385 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
4386 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
4392 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
4393 Left.Previous->is(tok::string_literal)) { in mustBreakBefore()
4396 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4397 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
4407 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4416 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
4417 Left.Previous->is(TT_FatArrow)) { in mustBreakBefore()
4425 return !Left.Children.empty(); in mustBreakBefore()
4429 return (Left.NestingLevel == 0 && Line.Level == 0) && in mustBreakBefore()
4430 !Left.Children.empty(); in mustBreakBefore()
4435 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
4436 !Left.Children.empty()) { in mustBreakBefore()
4440 (Left.NestingLevel == 0 && Line.Level == 0 && in mustBreakBefore()
4445 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
4452 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left)) in mustBreakBefore()
4459 if (Left.isStringLiteral() && Right.isStringLiteral()) in mustBreakBefore()
4468 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
4471 if ((Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
4473 Left.is(tok::comma)) { in mustBreakBefore()
4499 if ((Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) || in mustBreakBefore()
4500 (Style.isJavaScript() && Left.is(tok::l_paren))) && in mustBreakBefore()
4501 Left.isNot(BK_Block) && Left.MatchingParen) { in mustBreakBefore()
4502 BeforeClosingBrace = Left.MatchingParen->Previous; in mustBreakBefore()
4508 BeforeClosingBrace = &Left; in mustBreakBefore()
4517 return Left.isNot(BK_BracedInit) && Left.isNot(TT_CtorInitializerColon) && in mustBreakBefore()
4520 if (Left.isTrailingComment()) in mustBreakBefore()
4522 if (Left.IsUnterminatedLiteral) in mustBreakBefore()
4524 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
4538 if (Left.ClosesTemplateDeclaration && Left.MatchingParen && in mustBreakBefore()
4539 Left.MatchingParen->NestingLevel == 0) { in mustBreakBefore()
4547 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { in mustBreakBefore()
4558 (Left.is(TT_CtorInitializerComma) || in mustBreakBefore()
4564 Left.isOneOf(TT_CtorInitializerColon, TT_CtorInitializerComma)) { in mustBreakBefore()
4579 Left.is(TT_InheritanceComma)) { in mustBreakBefore()
4588 if ((Left.is(tok::l_brace) || (Left.is(tok::less) && Left.Previous && in mustBreakBefore()
4589 Left.Previous->is(tok::equal))) && in mustBreakBefore()
4598 if (isAllmanBrace(Left) || isAllmanBrace(Right)) { in mustBreakBefore()
4629 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
4635 if (Left.is(TT_AttributeParen) && Right.is(TT_ObjCDecl)) in mustBreakBefore()
4638 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
4639 if (IsFunctionArgument(Left) && in mustBreakBefore()
4646 (!Left.Children.empty() && in mustBreakBefore()
4653 Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) { in mustBreakBefore()
4659 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
4700 if (Left.is(tok::at)) in mustBreakBefore()
4734 if (Left.ParameterCount == 0) in mustBreakBefore()
4749 if (Left.isOneOf(tok::r_brace, tok::greater, tok::r_square)) in mustBreakBefore()
4758 Left.is(tok::l_paren) && Left.BlockParameterCount > 0 && in mustBreakBefore()
4761 if (Left.BlockParameterCount > 1) in mustBreakBefore()
4765 if (!Left.Role) in mustBreakBefore()
4767 auto Comma = Left.Role->lastComma(); in mustBreakBefore()
4782 const FormatToken &Left = *Right.Previous; in canBreakBefore() local
4785 if (Left.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon) || in canBreakBefore()
4791 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
4796 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
4817 (Left.Tok.getIdentifierInfo() || in canBreakBefore()
4818 Left.isOneOf(tok::r_square, tok::r_paren)) && in canBreakBefore()
4826 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
4828 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
4831 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
4848 if (Left.is(Keywords.kw_in)) in canBreakBefore()
4860 if (Left.is(Keywords.kw_as)) in canBreakBefore()
4862 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
4864 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
4873 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) && in canBreakBefore()
4881 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
4883 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
4887 if (Left.is(tok::at)) in canBreakBefore()
4889 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
4891 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation)) in canBreakBefore()
4903 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
4911 return Left.is(BK_BracedInit) || in canBreakBefore()
4912 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
4915 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
4919 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
4921 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
4926 Left.isNot(TT_SelectorName)) { in canBreakBefore()
4934 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
4977 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. in canBreakBefore()
4979 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
4985 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
4987 if (Left.ClosesRequiresClause) in canBreakBefore()
4993 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
4997 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
4999 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
5000 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
5009 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) || in canBreakBefore()
5010 Left.is(tok::kw_operator)) { in canBreakBefore()
5013 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
5014 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) { in canBreakBefore()
5017 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
5021 if (Left.is(tok::l_paren) && in canBreakBefore()
5022 Left.isOneOf(TT_AttributeParen, TT_TypeDeclarationParen)) { in canBreakBefore()
5025 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
5026 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen))) { in canBreakBefore()
5061 if (Left.is(TT_TrailingAnnotation)) { in canBreakBefore()
5068 return !Left.is(TT_AttributeSquare); in canBreakBefore()
5071 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
5077 if (Left.is(TT_CtorInitializerColon)) { in canBreakBefore()
5083 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
5091 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
5099 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
5101 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
5103 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
5104 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
5107 Left.getPrecedence() == prec::Assignment)) { in canBreakBefore()
5110 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
5111 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
5117 if (isAllmanLambdaBrace(Left)) in canBreakBefore()
5118 return !isItAnEmptyLambdaAllowed(Left, ShortLambdaOption); in canBreakBefore()
5123 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
5128 (Left.is(tok::r_paren) && in canBreakBefore()
5130 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
5131 (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)); in canBreakBefore()