Lines Matching refs:Left
46 static bool isLambdaParameterList(const FormatToken *Left) { in isLambdaParameterList() argument
48 if (Left->Previous && Left->Previous->is(tok::greater) && in isLambdaParameterList()
49 Left->Previous->MatchingParen && in isLambdaParameterList()
50 Left->Previous->MatchingParen->is(TT_TemplateOpener)) in isLambdaParameterList()
51 Left = Left->Previous->MatchingParen; in isLambdaParameterList()
54 return Left->Previous && Left->Previous->is(tok::r_square) && in isLambdaParameterList()
55 Left->Previous->MatchingParen && in isLambdaParameterList()
56 Left->Previous->MatchingParen->is(TT_LambdaLSquare); in isLambdaParameterList()
98 FormatToken *Left = CurrentToken->Previous; in parseAngle() local
99 Left->ParentBracket = Contexts.back().ContextKind; in parseAngle()
110 Left->Previous && Left->Previous->Tok.isNot(tok::kw_template); in parseAngle()
125 Left->ParentBracket != tok::less && in parseAngle()
131 Left->MatchingParen = CurrentToken; in parseAngle()
132 CurrentToken->MatchingParen = Left; in parseAngle()
139 (Style.Language == FormatStyle::LK_Proto && Left->Previous && in parseAngle()
140 Left->Previous->isOneOf(TT_SelectorName, TT_DictLiteral))) in parseAngle()
168 updateParameterCount(Left, CurrentToken); in parseAngle()
207 FormatToken *Left = CurrentToken->Previous; in parseParens() local
208 assert(Left && "Unknown previous token"); in parseParens()
209 FormatToken *PrevNonComment = Left->getPreviousNonComment(); in parseParens()
210 Left->ParentBracket = Contexts.back().ContextKind; in parseParens()
217 if (Left->Previous && Left->Previous->is(TT_UntouchableMacroFunc)) { in parseParens()
218 Left->Finalized = true; in parseParens()
223 if (FormatToken *MaybeSel = Left->Previous) { in parseParens()
231 if (Left->is(TT_OverloadedOperatorLParen)) { in parseParens()
233 FormatToken *Prev = Left; in parseParens()
252 } else if (Left->Previous && in parseParens()
253 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_while, in parseParens()
255 Left->Previous->isIf() || in parseParens()
256 Left->Previous->is(TT_BinaryOperator))) { in parseParens()
259 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseParens()
260 (Left->Previous->is(Keywords.kw_function) || in parseParens()
261 (Left->Previous->endsSequence(tok::identifier, in parseParens()
265 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseParens()
266 Left->Previous->is(TT_JsTypeColon)) { in parseParens()
269 } else if (isLambdaParameterList(Left)) { in parseParens()
273 (!Left->Previous || !Left->Previous->is(tok::identifier))) { in parseParens()
278 } else if (Left->Previous && Left->Previous->is(TT_ForEachMacro)) { in parseParens()
282 } else if (Left->Previous && Left->Previous->MatchingParen && in parseParens()
283 Left->Previous->MatchingParen->is(TT_ObjCBlockLParen)) { in parseParens()
287 Left->Previous && Left->Previous->isOneOf(tok::kw_for, tok::kw_catch); in parseParens()
293 if (PrevNonComment && Left->is(TT_Unknown)) { in parseParens()
295 Left->setType(TT_AttributeParen); in parseParens()
299 Left->setType(TT_TypeDeclarationParen); in parseParens()
308 Left->setType(TT_ObjCMethodExpr); in parseParens()
324 Left->Previous && Left->Previous->is(tok::kw_for); in parseParens()
357 Left->setType(Left->Next->is(tok::caret) ? TT_ObjCBlockLParen in parseParens()
359 Left->MatchingParen = CurrentToken; in parseParens()
360 CurrentToken->MatchingParen = Left; in parseParens()
363 Left->Previous && Left->Previous->is(tok::l_paren)) { in parseParens()
367 for (FormatToken *Tok = Left; Tok != CurrentToken; Tok = Tok->Next) { in parseParens()
382 if (Left->is(TT_AttributeParen)) in parseParens()
384 if (Left->is(TT_TypeDeclarationParen)) in parseParens()
386 if (Left->Previous && Left->Previous->is(TT_JavaAnnotation)) in parseParens()
388 if (Left->Previous && Left->Previous->is(TT_LeadingJavaAnnotation)) in parseParens()
390 if (Left->Previous && Left->Previous->is(TT_AttributeSquare)) in parseParens()
394 Left->setPackingKind(PPK_Inconclusive); in parseParens()
396 Left->setPackingKind(PPK_BinPacked); in parseParens()
398 Left->setPackingKind(PPK_OnePerLine); in parseParens()
407 Left->setType(TT_Unknown); // Not TT_ObjCBlockLParen in parseParens()
439 updateParameterCount(Left, Tok); in parseParens()
536 FormatToken *Left = CurrentToken->Previous; in parseSquare() local
537 Left->ParentBracket = Contexts.back().ContextKind; in parseSquare()
538 FormatToken *Parent = Left->getPreviousNonComment(); in parseSquare()
548 bool IsCpp11AttributeSpecifier = isCpp11AttributeSpecifier(*Left) || in parseSquare()
553 isCSharpAttributeSpecifier(*Left) || in parseSquare()
557 bool IsCppStructuredBinding = Left->isCppStructuredBinding(Style); in parseSquare()
562 Left->isNot(TT_LambdaLSquare) && in parseSquare()
576 Left->setType(TT_StructuredBindingLSquare); in parseSquare()
577 } else if (Left->is(TT_Unknown)) { in parseSquare()
579 Left->setType(TT_ObjCMethodExpr); in parseSquare()
581 Left->setType(TT_InlineASMSymbolicNameLSquare); in parseSquare()
583 Left->setType(TT_AttributeSquare); in parseSquare()
587 Left->setType(TT_JsComputedPropertyName); in parseSquare()
590 Left->setType(TT_DesignatedInitializerLSquare); in parseSquare()
592 Left->setType(TT_AttributeSquare); in parseSquare()
595 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
624 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
625 if (!Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
627 !Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
629 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) { in parseSquare()
630 Left->setType(TT_ProtoExtensionLSquare); in parseSquare()
639 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
642 Left->setType(TT_ArraySubscriptLSquare); in parseSquare()
665 CurrentToken->Previous->Previous == Left)) && in parseSquare()
666 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
672 Left->setType(TT_Unknown); in parseSquare()
674 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) { in parseSquare()
692 Left->MatchingParen = CurrentToken; in parseSquare()
693 CurrentToken->MatchingParen = Left; in parseSquare()
705 Left->ParameterCount = in parseSquare()
711 if (Left->BlockParameterCount > 1) in parseSquare()
726 } else if (Left->isOneOf(TT_ArraySubscriptLSquare, in parseSquare()
728 Left->setType(TT_ObjCMethodExpr); in parseSquare()
737 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
739 Left->setType(TT_ArrayInitializerLSquare); in parseSquare()
743 updateParameterCount(Left, Tok); in parseSquare()
765 FormatToken *Left = CurrentToken->Previous; in parseBrace() local
766 Left->ParentBracket = Contexts.back().ContextKind; in parseBrace()
769 Left->setType(TT_ObjCBlockLBrace); in parseBrace()
774 if (Left->is(BK_BracedInit)) in parseBrace()
776 if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseBrace()
777 Left->Previous->is(TT_JsTypeColon)) in parseBrace()
783 Left->MatchingParen = CurrentToken; in parseBrace()
784 CurrentToken->MatchingParen = Left; in parseBrace()
786 if (Left->ParentBracket == tok::l_brace && in parseBrace()
796 updateParameterCount(Left, CurrentToken); in parseBrace()
805 Left->setType(TT_DictLiteral); in parseBrace()
812 Left->setType(TT_DictLiteral); in parseBrace()
816 Left->setType(TT_DictLiteral); in parseBrace()
826 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
831 ++Left->BlockParameterCount; in updateParameterCount()
833 ++Left->ParameterCount; in updateParameterCount()
834 if (!Left->Role) in updateParameterCount()
835 Left->Role.reset(new CommaSeparatedList(Style)); in updateParameterCount()
836 Left->Role->CommaFound(Current); in updateParameterCount()
837 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
838 Left->ParameterCount = 1; in updateParameterCount()
2714 const FormatToken &Left = *Tok.Previous; in splitPenalty() local
2717 if (Left.is(tok::semi)) in splitPenalty()
2725 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
2728 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
2730 if (Left.is(TT_JsTypeColon)) in splitPenalty()
2732 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in splitPenalty()
2736 if (Left.opensScope() && Right.closesScope()) in splitPenalty()
2745 if (Left.is(tok::r_square)) in splitPenalty()
2748 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
2756 if (Left.is(tok::coloncolon) || in splitPenalty()
2763 if (Left.is(TT_StartOfName)) in splitPenalty()
2773 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
2775 if (Left.is(TT_CastRParen)) in splitPenalty()
2777 if (Left.isOneOf(tok::kw_class, tok::kw_struct)) in splitPenalty()
2779 if (Left.is(tok::comment)) in splitPenalty()
2782 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon, in splitPenalty()
2823 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
2827 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
2834 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
2840 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
2841 Left.Previous->isOneOf(tok::identifier, tok::greater)) in splitPenalty()
2844 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
2847 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
2848 (Left.Previous->is(tok::kw_for) || Left.Previous->isIf())) in splitPenalty()
2850 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
2854 if (Left.is(TT_TemplateOpener)) in splitPenalty()
2856 if (Left.opensScope()) { in splitPenalty()
2861 (Left.ParameterCount <= 1 || Style.AllowAllArgumentsOnNextLine)) in splitPenalty()
2863 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
2865 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter in splitPenalty()
2868 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
2871 if (Left.is(TT_UnaryOperator)) in splitPenalty()
2873 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && in splitPenalty()
2874 Left.Previous->isLabelString() && in splitPenalty()
2875 (Left.NextOperator || Left.OperatorIndex != 0)) in splitPenalty()
2877 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
2880 if (Left.is(tok::comma)) in splitPenalty()
2882 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
2887 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) in splitPenalty()
2892 if (Left.ClosesTemplateDeclaration) in splitPenalty()
2894 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
2896 prec::Level Level = Left.getPrecedence(); in splitPenalty()
2914 const FormatToken &Left, in spaceRequiredBetween() argument
2916 if (Left.is(tok::kw_return) && Right.isNot(tok::semi)) in spaceRequiredBetween()
2918 if (Style.isJson() && Left.is(tok::string_literal) && Right.is(tok::colon)) in spaceRequiredBetween()
2920 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
2923 Left.Tok.getObjCKeywordID() == tok::objc_property) in spaceRequiredBetween()
2926 return Left.is(tok::hash); in spaceRequiredBetween()
2927 if (Left.isOneOf(tok::hashhash, tok::hash)) in spaceRequiredBetween()
2929 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
2930 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
2934 if (Left.is(tok::l_paren) && Left.Previous && in spaceRequiredBetween()
2935 isKeywordWithCondition(*Left.Previous)) in spaceRequiredBetween()
2944 if (Right.is(tok::l_paren) && Left.is(tok::kw_requires)) in spaceRequiredBetween()
2947 if (Left.is(TT_ConstraintJunctions) && Right.is(tok::identifier)) in spaceRequiredBetween()
2950 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) in spaceRequiredBetween()
2952 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
2963 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
2965 if (Left.isOneOf(tok::exclaim, tok::tilde)) in spaceRequiredBetween()
2967 if (Left.is(tok::at) && in spaceRequiredBetween()
2972 if (Left.is(tok::colon)) in spaceRequiredBetween()
2973 return !Left.is(TT_ObjCMethodExpr); in spaceRequiredBetween()
2974 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
2976 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
2979 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
2981 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
2988 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
2989 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
2990 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
2993 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
2994 if (!Left.MatchingParen) in spaceRequiredBetween()
2997 Left.MatchingParen->getPreviousNonComment(); in spaceRequiredBetween()
2998 if (!TokenBeforeMatchingParen || !Left.is(TT_TypeDeclarationParen)) in spaceRequiredBetween()
3006 (Left.is(TT_AttributeParen) || Left.canBePointerOrReferenceQualifier())) in spaceRequiredBetween()
3009 Left.Tok.isLiteral() || in spaceRequiredBetween()
3010 (!Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
3013 (Left.NestingLevel == 0 || in spaceRequiredBetween()
3014 (Left.NestingLevel == 1 && Line.First->is(tok::kw_for))))))); in spaceRequiredBetween()
3016 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
3017 (!Left.is(TT_PointerOrReference) || in spaceRequiredBetween()
3018 (getTokenPointerOrReferenceAlignment(Left) != FormatStyle::PAS_Right && in spaceRequiredBetween()
3021 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
3034 (getTokenPointerOrReferenceAlignment(Left) != in spaceRequiredBetween()
3037 Left.Previous && in spaceRequiredBetween()
3038 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon, in spaceRequiredBetween()
3042 if (Left.is(tok::ellipsis) && Left.Previous && in spaceRequiredBetween()
3043 Left.Previous->isOneOf(tok::star, tok::amp, tok::ampamp)) in spaceRequiredBetween()
3046 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
3048 if (Left.is(tok::star) && Right.isOneOf(tok::star, tok::amp, tok::ampamp)) in spaceRequiredBetween()
3051 const FormatToken *Previous = &Left; in spaceRequiredBetween()
3098 if (Left.is(tok::l_square)) in spaceRequiredBetween()
3099 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
3100 SpaceRequiredForArrayInitializerLSquare(Left, Style)) || in spaceRequiredBetween()
3101 (Left.isOneOf(TT_ArraySubscriptLSquare, TT_StructuredBindingLSquare, in spaceRequiredBetween()
3118 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral) && in spaceRequiredBetween()
3119 !(!Left.is(tok::r_square) && Style.SpaceBeforeSquareBrackets && in spaceRequiredBetween()
3122 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
3123 return !Left.Children.empty(); // No spaces in "{}". in spaceRequiredBetween()
3124 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
3128 if (Left.is(TT_BlockComment)) in spaceRequiredBetween()
3131 !Left.TokenText.endswith("=*/"); in spaceRequiredBetween()
3135 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
3138 if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || in spaceRequiredBetween()
3139 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) in spaceRequiredBetween()
3143 Left.is(TT_ForEachMacro)) in spaceRequiredBetween()
3147 Left.is(TT_IfMacro)) in spaceRequiredBetween()
3149 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || in spaceRequiredBetween()
3151 (Left.isOneOf(tok::pp_elif, tok::kw_for, tok::kw_while, in spaceRequiredBetween()
3154 Left.isIf(Line.Type != LT_PreprocessorDirective) || in spaceRequiredBetween()
3155 (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch, in spaceRequiredBetween()
3157 (!Left.Previous || Left.Previous->isNot(tok::period))))) || in spaceRequiredBetween()
3159 (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() || in spaceRequiredBetween()
3160 Left.is(tok::r_paren) || Left.isSimpleTypeSpecifier() || in spaceRequiredBetween()
3161 (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
3162 Left.MatchingParen->is(TT_LambdaLSquare))) && in spaceRequiredBetween()
3165 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
3168 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) && in spaceRequiredBetween()
3169 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr)); in spaceRequiredBetween()
3170 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square, in spaceRequiredBetween()
3172 Left.isSimpleTypeSpecifier()) && in spaceRequiredBetween()
3176 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
3178 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L") in spaceRequiredBetween()
3180 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
3181 Left.MatchingParen->Previous && in spaceRequiredBetween()
3182 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
3183 Left.MatchingParen->Previous->is(tok::coloncolon))) in spaceRequiredBetween()
3188 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
3190 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) in spaceRequiredBetween()
3199 Left.isOneOf(tok::kw_const, tok::kw_volatile) && in spaceRequiredBetween()
3210 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore() local
3214 if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
3217 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
3220 !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) in spaceRequiredBefore()
3225 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required, in spaceRequiredBefore()
3229 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) in spaceRequiredBefore()
3231 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
3234 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
3236 if (Left.MatchingParen && in spaceRequiredBefore()
3237 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
3241 if (Left.is(tok::percent)) in spaceRequiredBefore()
3245 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
3256 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
3260 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3268 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
3271 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
3275 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
3279 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
3283 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
3287 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
3299 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
3303 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3308 if (Left.isOneOf(tok::kw_using, Keywords.kw_async, Keywords.kw_when, in spaceRequiredBefore()
3315 if (Left.isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, in spaceRequiredBefore()
3323 if (Left.is(TT_FatArrow)) in spaceRequiredBefore()
3326 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
3327 Left.Previous->is(tok::kw_for)) in spaceRequiredBefore()
3329 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
3337 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in spaceRequiredBefore()
3342 if (Keywords.IsJavaScriptIdentifier(Left, in spaceRequiredBefore()
3347 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) in spaceRequiredBefore()
3350 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield, in spaceRequiredBefore()
3355 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
3359 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
3360 Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
3363 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, in spaceRequiredBefore()
3368 if (Left.endsSequence(tok::kw_const, Keywords.kw_as)) { in spaceRequiredBefore()
3371 if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, in spaceRequiredBefore()
3376 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
3377 (Left.Previous->Tok.is(tok::identifier) || in spaceRequiredBefore()
3378 Left.Previous->isOneOf(tok::r_square, tok::r_brace)))) && in spaceRequiredBefore()
3379 (!Left.Previous || !Left.Previous->is(tok::period))) in spaceRequiredBefore()
3381 if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous && in spaceRequiredBefore()
3382 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3384 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
3387 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
3388 Left.Previous->is(tok::kw_export)) in spaceRequiredBefore()
3390 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3394 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
3396 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
3399 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
3401 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
3410 if (Left.is(TT_NonNullAssertion) && in spaceRequiredBefore()
3414 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3416 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3418 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, in spaceRequiredBefore()
3420 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract, in spaceRequiredBefore()
3425 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
3428 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
3430 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) in spaceRequiredBefore()
3437 (Right.is(tok::equal) || Left.is(tok::equal))) in spaceRequiredBefore()
3441 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) in spaceRequiredBefore()
3445 if (Left.is(tok::comma)) in spaceRequiredBefore()
3458 if (Left.is(TT_BitFieldColon)) in spaceRequiredBefore()
3468 if (Left.is(tok::question)) in spaceRequiredBefore()
3470 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
3484 if ((Left.isOneOf(tok::minus, tok::minusminus) && in spaceRequiredBefore()
3486 (Left.isOneOf(tok::plus, tok::plusplus) && in spaceRequiredBefore()
3489 if (Left.is(TT_UnaryOperator)) { in spaceRequiredBefore()
3494 if (Left.is(tok::exclaim) && Left.TokenText == "not") in spaceRequiredBefore()
3496 if (Left.is(tok::tilde) && Left.TokenText == "compl") in spaceRequiredBefore()
3500 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
3503 return (Style.SpaceAfterLogicalNot && Left.is(tok::exclaim)) || in spaceRequiredBefore()
3509 if (Left.is(TT_CastRParen)) in spaceRequiredBefore()
3521 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
3523 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) in spaceRequiredBefore()
3525 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
3530 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
3533 if (!Style.SpaceBeforeAssignmentOperators && Left.isNot(TT_TemplateCloser) && in spaceRequiredBefore()
3537 (Left.is(tok::identifier) || Left.is(tok::kw_this))) in spaceRequiredBefore()
3539 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) in spaceRequiredBefore()
3545 !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren)) in spaceRequiredBefore()
3547 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
3550 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, in spaceRequiredBefore()
3553 (Left.is(tok::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
3554 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
3558 return !Left.isOneOf(tok::amp, tok::ampamp) || in spaceRequiredBefore()
3559 getTokenReferenceAlignment(Left) != FormatStyle::PAS_Right; in spaceRequiredBefore()
3564 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
3565 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && in spaceRequiredBefore()
3568 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) && in spaceRequiredBefore()
3571 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
3572 Left.MatchingParen && Left.MatchingParen->is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
3574 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
3579 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
3581 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
3609 const FormatToken &Left = *Right.Previous; in mustBreakBefore() local
3615 Left.is(TT_CSharpNamedArgumentColon)) in mustBreakBefore()
3621 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
3626 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
3627 Left.is(tok::r_square) && Right.is(tok::l_square)) in mustBreakBefore()
3632 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
3633 Left.Previous->is(tok::string_literal)) in mustBreakBefore()
3635 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
3636 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
3645 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
3653 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
3654 Left.Previous->is(TT_FatArrow)) { in mustBreakBefore()
3662 return !Left.Children.empty(); in mustBreakBefore()
3666 return (Left.NestingLevel == 0 && Line.Level == 0) && in mustBreakBefore()
3667 !Left.Children.empty(); in mustBreakBefore()
3672 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
3673 !Left.Children.empty()) in mustBreakBefore()
3677 (Left.NestingLevel == 0 && Line.Level == 0 && in mustBreakBefore()
3681 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
3689 if (Left.isStringLiteral() && Right.isStringLiteral()) in mustBreakBefore()
3698 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
3703 if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
3709 if (Left.is(tok::comma)) in mustBreakBefore()
3719 if ((Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) || in mustBreakBefore()
3721 Left.is(tok::l_paren))) && in mustBreakBefore()
3722 Left.isNot(BK_Block) && Left.MatchingParen) in mustBreakBefore()
3723 BeforeClosingBrace = Left.MatchingParen->Previous; in mustBreakBefore()
3729 BeforeClosingBrace = &Left; in mustBreakBefore()
3736 return Left.isNot(BK_BracedInit) && Left.isNot(TT_CtorInitializerColon) && in mustBreakBefore()
3738 if (Left.isTrailingComment()) in mustBreakBefore()
3770 Left.is(TT_InheritanceComma)) in mustBreakBefore()
3788 if (isAllmanBrace(Left) || isAllmanBrace(Right)) in mustBreakBefore()
3794 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
3798 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
3799 if (IsFunctionArgument(Left) && in mustBreakBefore()
3805 (!Left.Children.empty() && in mustBreakBefore()
3811 Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) { in mustBreakBefore()
3818 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
3892 if (Left.ParameterCount == 0) in mustBreakBefore()
3907 if (Left.isOneOf(tok::r_brace, tok::greater, tok::r_square)) in mustBreakBefore()
3916 Left.is(tok::l_paren) && Left.BlockParameterCount > 0 && in mustBreakBefore()
3919 if (Left.BlockParameterCount > 1) in mustBreakBefore()
3923 if (!Left.Role) in mustBreakBefore()
3925 auto Comma = Left.Role->lastComma(); in mustBreakBefore()
3940 const FormatToken &Left = *Right.Previous; in canBreakBefore() local
3943 if (Left.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon) || in canBreakBefore()
3948 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
3954 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
3971 (Left.Tok.getIdentifierInfo() || in canBreakBefore()
3972 Left.isOneOf(tok::r_square, tok::r_paren)) && in canBreakBefore()
3978 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
3980 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
3983 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
4000 if (Left.is(Keywords.kw_in)) in canBreakBefore()
4012 if (Left.is(Keywords.kw_as)) in canBreakBefore()
4014 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
4016 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
4024 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) && in canBreakBefore()
4031 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) { in canBreakBefore()
4034 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
4038 if (Left.is(tok::at)) in canBreakBefore()
4040 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
4042 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation)) in canBreakBefore()
4052 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
4060 return Left.is(BK_BracedInit) || in canBreakBefore()
4061 (Left.is(TT_CtorInitializerColon) && in canBreakBefore()
4063 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
4067 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
4069 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
4074 Left.isNot(TT_SelectorName)) in canBreakBefore()
4080 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
4121 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. in canBreakBefore()
4122 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
4124 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
4129 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
4133 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
4135 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) || in canBreakBefore()
4136 Left.is(tok::kw_operator)) in canBreakBefore()
4138 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
4139 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) in canBreakBefore()
4141 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
4144 if (Left.is(tok::l_paren) && in canBreakBefore()
4145 Left.isOneOf(TT_AttributeParen, TT_TypeDeclarationParen)) in canBreakBefore()
4147 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
4148 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen))) in canBreakBefore()
4166 if (Left.is(TT_TrailingAnnotation)) in canBreakBefore()
4172 return !Left.is(TT_AttributeSquare); in canBreakBefore()
4174 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
4180 if (Left.is(TT_CtorInitializerColon)) in canBreakBefore()
4184 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
4190 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
4196 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
4197 (Left.is(tok::less) && Right.is(tok::less))) in canBreakBefore()
4204 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
4206 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
4208 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
4209 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
4212 Left.getPrecedence() == prec::Assignment)) in canBreakBefore()
4214 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
4215 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) in canBreakBefore()
4220 if (isAllmanLambdaBrace(Left)) in canBreakBefore()
4221 return !isItAnEmptyLambdaAllowed(Left, ShortLambdaOption); in canBreakBefore()
4226 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
4231 (Left.is(tok::r_paren) && in canBreakBefore()
4233 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
4234 (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)); in canBreakBefore()