Lines Matching full:right

199           // tokens to prevent splitting right shift operators and potentially
2753 // If there is an identifier (or with a few exceptions a keyword) right
2761 // Certain other tokens right before the parentheses are also signals that
3026 // After right braces, star tokens are likely to be pointers to struct,
3060 // Thus, having an identifier on the right-hand side indicates a binary
3295 // intervene so that the fake right paren is inserted correctly.
4219 const FormatToken &Right = Tok;
4226 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_throws))
4228 if (Right.is(Keywords.kw_implements))
4233 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma))
4238 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) {
4242 if (Left.opensScope() && Right.closesScope())
4245 if (Right.is(tok::l_square))
4247 if (Right.is(tok::period))
4251 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral))
4253 if (Right.is(tok::l_square)) {
4257 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
4259 if (!Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare,
4268 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
4269 Right.is(tok::kw_operator)) {
4270 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
4274 if (InFunctionDecl && Right.NestingLevel == 0)
4278 if (Right.is(TT_PointerOrReference))
4280 if (Right.is(TT_LambdaArrow))
4282 if (Left.is(tok::equal) && Right.is(tok::l_brace))
4296 if (Right.isMemberAccess()) {
4316 const auto *NextOperator = Right.NextOperator;
4323 if (Right.is(TT_TrailingAnnotation) &&
4324 (!Right.Next || Right.Next->isNot(tok::l_paren))) {
4334 bool is_short_annotation = Right.TokenText.size() < 10;
4344 if (Right.is(TT_SelectorName))
4370 if (Right.is(tok::r_brace))
4397 if (Right.is(tok::plus) && Left.isLabelString() &&
4398 (Right.NextOperator || Right.OperatorIndex != 0)) {
4403 if (Right.is(tok::lessless) && Left.isLabelString() &&
4404 (Right.NextOperator || Right.OperatorIndex != 1)) {
4407 if (Right.is(tok::lessless)) {
4409 if (Left.isNot(tok::r_paren) || Right.OperatorIndex > 0) {
4423 Level = Right.getPrecedence();
4432 bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const {
4435 if (Right.is(TT_OverloadedOperatorLParen) &&
4440 Right.ParameterCount > 0) {
4448 const FormatToken &Right) const {
4450 !Right.isOneOf(tok::semi, tok::r_paren, tok::hashhash)) {
4453 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen &&
4454 Right.MatchingParen->is(TT_CastRParen)) {
4463 if (Right.is(tok::hashhash))
4466 return Right.is(tok::hash);
4467 if (Left.is(BK_Block) && Right.is(tok::r_brace) &&
4468 Right.MatchingParen == &Left && Line.Children.empty()) {
4472 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) ||
4474 Right.is(tok::r_brace) && Right.isNot(BK_Block))) {
4478 Left.is(tok::r_paren) && Right.is(tok::r_paren)) {
4480 if (InnerLParen && InnerLParen->Previous == Right.MatchingParen) {
4488 else if (Right.is(tok::r_paren) && Right.MatchingParen)
4489 LeftParen = Right.MatchingParen;
4498 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace,
4505 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace))
4511 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && BeforeLeft &&
4517 !Right.isOneOf(tok::semi, tok::r_paren)) {
4521 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
4522 return (Right.is(TT_CastRParen) ||
4527 if (Right.isOneOf(tok::semi, tok::comma))
4529 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
4530 bool IsLightweightGeneric = Right.MatchingParen &&
4531 Right.MatchingParen->Next &&
4532 Right.MatchingParen->Next->is(tok::colon);
4535 if (Right.is(tok::less) && Left.is(tok::kw_template))
4540 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant,
4549 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) {
4552 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) {
4554 if (Left.is(tok::less) && Right.is(tok::greater))
4559 if (Right.isNot(TT_OverloadedOperatorLParen))
4562 if (Right.is(tok::ellipsis)) {
4566 if (Left.is(tok::l_square) && Right.is(tok::amp))
4568 if (Right.is(TT_PointerOrReference)) {
4589 if (Left.isTypeOrIdentifier(LangOpts) && Right.Next && Right.Next->Next &&
4590 Right.Next->Next->is(TT_RangeBasedForLoopColon)) {
4591 return getTokenPointerOrReferenceAlignment(Right) !=
4595 (getTokenPointerOrReferenceAlignment(Right) !=
4601 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
4612 Right.canBePointerOrReferenceQualifier()) {
4616 if (Right.Tok.isLiteral())
4619 if (Right.is(TT_BlockComment))
4623 if (Right.isOneOf(Keywords.kw_override, Keywords.kw_final, tok::kw_noexcept,
4625 Right.isNot(TT_StartOfName)) {
4629 if (Right.is(tok::l_brace) && Right.is(BK_Block))
4632 if (BeforeLeft && BeforeLeft->isTypeOrIdentifier(LangOpts) && Right.Next &&
4633 Right.Next->is(TT_RangeBasedForLoopColon)) {
4637 if (Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
4661 if (!Right.startsSequence(tok::identifier, tok::r_paren))
4663 assert(Right.Next);
4664 const auto *LParen = Right.Next->MatchingParen;
4669 // Ensure right pointer alignment with ellipsis e.g. int *...P
4675 if (Right.is(tok::star) && Left.is(tok::l_paren))
4677 if (Left.is(tok::star) && Right.isPointerOrReference())
4679 if (Right.isPointerOrReference()) {
4719 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square))
4729 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) &&
4733 Style.SpacesInSquareBrackets && Right.isNot(tok::r_square));
4735 if (Right.is(tok::r_square)) {
4736 return Right.MatchingParen &&
4737 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) &&
4738 SpaceRequiredForArrayInitializerLSquare(*Right.MatchingParen,
4741 Right.MatchingParen->isOneOf(TT_ArraySubscriptLSquare,
4745 if (Right.is(tok::l_square) &&
4746 !Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare,
4751 Right.is(TT_ArraySubscriptLSquare))) {
4754 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
4757 (Right.is(tok::r_brace) && Right.MatchingParen &&
4758 Right.MatchingParen->isNot(BK_Block))) {
4768 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare))
4771 if (Right.is(tok::l_paren)) {
4772 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen))
4773 return spaceRequiredBeforeParens(Right);
4777 spaceRequiredBeforeParens(Right);
4781 spaceRequiredBeforeParens(Right);
4789 spaceRequiredBeforeParens(Right);
4793 spaceRequiredBeforeParens(Right);
4797 Right.isNot(TT_OverloadedOperatorLParen) &&
4799 const auto *RParen = Right.MatchingParen;
4810 Right.is(TT_ConditionLParen)) {
4812 spaceRequiredBeforeParens(Right);
4817 if (Right.is(TT_OverloadedOperatorLParen))
4818 return spaceRequiredBeforeParens(Right);
4820 if (Line.MightBeFunctionDecl && Right.is(TT_FunctionDeclarationLParen)) {
4821 if (spaceRequiredBeforeParens(Right))
4832 spaceRequiredBeforeParens(Right);
4837 spaceRequiredBeforeParens(Right);
4842 spaceRequiredBeforeParens(Right);
4849 spaceRequiredBeforeParens(Right);
4855 return spaceRequiredBeforeParens(Right);
4859 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
4861 if (Right.is(TT_UnaryOperator)) {
4873 Right.is(tok::l_brace) && Right.getNextNonComment() &&
4874 Right.isNot(BK_Block)) {
4877 if (Left.is(tok::period) || Right.is(tok::period))
4881 if (Right.is(tok::hash) && Left.is(tok::identifier) &&
4897 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
4903 if (Right.is(tok::r_brace) && Right.MatchingParen &&
4904 Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) {
4908 if (Right.is(TT_TrailingAnnotation) && Right.isOneOf(tok::amp, tok::ampamp) &&
4910 (!Right.Next || Right.Next->is(tok::semi))) {
4914 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left;
4921 const FormatToken &Right) const {
4922 const FormatToken &Left = *Right.Previous;
4927 return Right.hasWhitespaceBefore();
4933 if (Keywords.isWordLike(Right, IsVerilog) &&
4940 if (Left.is(tok::star) && Right.is(tok::comment))
4947 Right.isOneOf(TT_TemplateOpener, TT_TemplateCloser)) {
4951 if (Right.is(tok::period) && Left.is(tok::numeric_constant))
4955 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis))
4959 Right.is(TT_ModulePartitionColon)) {
4963 if (Right.is(TT_AfterPPDirective))
4967 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon))
4971 Right.isOneOf(tok::identifier, tok::kw_private)) {
4974 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) &&
4980 Right.is(tok::coloncolon)) {
4985 return Right.is(tok::coloncolon);
4986 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) &&
4991 Right.is(TT_TemplateOpener)) {
4995 if (Left.is(tok::identifier) && Right.is(tok::numeric_constant))
4996 return Right.TokenText[0] != '.';
4998 if (Left.Tok.getIdentifierInfo() && Right.Tok.isLiteral())
5001 if (Right.is(tok::period) && !(BeforeLeft && BeforeLeft->is(tok::period)) &&
5006 if (Right.is(tok::l_paren) &&
5010 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName))
5013 if (Left.is(tok::slash) || Right.is(tok::slash))
5017 Right.isOneOf(tok::l_brace, tok::less)) {
5025 if (Left.is(tok::numeric_constant) && Right.is(tok::percent))
5026 return Right.hasWhitespaceBefore();
5028 if (Right.is(tok::colon) && Left.is(tok::string_literal))
5036 if (Left.is(tok::kw_this) && Right.is(tok::l_square))
5040 if (Left.is(tok::kw_new) && Right.is(tok::l_paren))
5044 if (Right.is(tok::l_brace))
5048 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace))
5051 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace))
5055 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow))
5059 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon))
5063 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName))
5067 if (Left.is(tok::l_square) || Right.is(tok::r_square))
5071 if (Right.is(TT_CSharpNullable))
5075 if (Right.is(TT_NonNullAssertion))
5079 if (Left.is(tok::comma) && Right.is(tok::comma))
5083 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren))
5087 if (Right.is(tok::l_paren)) {
5091 spaceRequiredBeforeParens(Right);
5102 Right.is(tok::l_paren)) {
5109 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && BeforeLeft &&
5113 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) &&
5114 Right.MatchingParen) {
5115 const FormatToken *Next = Right.MatchingParen->getNextNonComment();
5122 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) {
5129 Right.is(TT_TemplateString)) {
5132 if (Right.is(tok::star) &&
5136 if (Right.isOneOf(tok::l_brace, tok::l_square) &&
5141 if (Right.is(tok::l_paren)) {
5172 BeforeLeft->is(tok::period) && Right.is(tok::l_paren)) {
5176 Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren)) {
5183 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace))
5185 if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion))
5187 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator))
5189 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) &&
5196 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square,
5203 if (Right.is(TT_NonNullAssertion))
5206 Right.isOneOf(Keywords.kw_as, Keywords.kw_in)) {
5210 if (Left.is(TT_CaseLabelArrow) || Right.is(TT_CaseLabelArrow))
5212 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
5215 if (Left.is(tok::l_square) || Right.is(tok::r_square))
5218 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) {
5220 spaceRequiredBeforeParens(Right);
5225 Right.is(TT_TemplateOpener)) {
5235 !Right.isOneOf(tok::r_paren, tok::semi)) ||
5236 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) {
5237 const FormatToken *Next = Right.getNextNonComment();
5246 if (Right.isNot(tok::semi) &&
5257 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) {
5261 if (Left.is(tok::arrow) || Right.is(tok::arrow))
5266 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at))
5269 if (Right.is(tok::l_square) &&
5274 if (Right.isOneOf(tok::period, Keywords.kw_apostrophe) &&
5282 if ((Right.is(Keywords.kw_apostrophe) ||
5283 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) &&
5292 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) ||
5293 (Left.is(tok::star) && Right.is(tok::semi))) {
5297 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier))
5300 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength))
5304 Right.isOneOf(tok::lessless, tok::greatergreater)) ||
5311 if (Left.is(tok::l_square) && Right.is(tok::l_brace))
5313 if (Left.is(tok::r_brace) && Right.is(tok::r_square))
5316 if (Right.isOneOf(TT_TableGenDAGArgListColon,
5322 if (Right.is(TT_TableGenCondOperatorColon))
5326 Right.isNot(TT_TableGenDAGArgCloser)) {
5330 if (Right.isOneOf(tok::l_paren, tok::less) &&
5337 Right.isOneOf(tok::l_brace, tok::colon)) {
5341 if (Left.is(tok::hash) || Right.is(tok::hash))
5349 return Right.hasWhitespaceBefore();
5354 canBeObjCSelectorComponent(Right)) {
5362 (Right.is(tok::equal) || Left.is(tok::equal))) {
5366 if (Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow) ||
5370 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
5376 if (Right.is(tok::comma))
5378 if (Right.is(TT_ObjCBlockLParen))
5380 if (Right.is(TT_CtorInitializerColon))
5382 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon)
5384 if (Right.is(TT_RangeBasedForLoopColon) &&
5392 if (Right.is(tok::colon)) {
5393 if (Right.is(TT_CaseLabelColon))
5395 if (Right.is(TT_GotoLabelColon))
5398 if (!Right.getNextNonComment())
5400 if (Right.is(TT_ObjCMethodExpr))
5404 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon))
5406 if (Right.is(TT_DictLiteral))
5408 if (Right.is(TT_AttributeColon))
5410 if (Right.is(TT_CSharpNamedArgumentColon))
5412 if (Right.is(TT_GenericSelectionColon))
5414 if (Right.is(TT_BitFieldColon)) {
5422 Right.isOneOf(tok::minus, tok::minusminus)) ||
5424 Right.isOneOf(tok::plus, tok::plusplus))) {
5430 if (Left.is(tok::amp) && Right.is(tok::r_square))
5439 Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
5442 auto ShouldAddSpacesInAngles = [this, &Right]() {
5446 return Right.hasWhitespaceBefore();
5450 if (Left.is(tok::greater) && Right.is(tok::greater)) {
5455 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
5459 if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) ||
5461 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) {
5465 Right.getPrecedence() == prec::Assignment) {
5468 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) &&
5472 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) {
5476 return Right.hasWhitespaceBefore();
5478 if (Right.is(tok::coloncolon) &&
5489 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
5492 Right.is(TT_PointerOrReference) && Right.isOneOf(tok::amp, tok::ampamp)) {
5496 if (Right.is(TT_StructuredBindingLSquare)) {
5501 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) &&
5502 Right.isOneOf(tok::amp, tok::ampamp)) {
5503 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left;
5505 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) ||
5507 Right.isNot(tok::r_paren))) {
5510 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
5515 if (Right.is(tok::less) && Left.isNot(tok::l_paren) &&
5519 if (Right.is(TT_TrailingUnaryOperator))
5523 return spaceRequiredBetween(Line, Left, Right);
5550 const FormatToken &Right) const {
5551 const FormatToken &Left = *Right.Previous;
5552 if (Right.NewlinesBefore > 1 && Style.MaxEmptyLinesToKeep > 0 &&
5553 (!Style.RemoveEmptyLinesInUnwrappedLines || &Right == Line.First)) {
5567 startsNextParameter(Right, Style)) {
5572 const auto *AfterRight = Right.Next;
5575 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) &&
5579 if (Right.is(TT_CSharpNamedArgumentColon) ||
5583 if (Right.is(TT_CSharpGenericTypeConstraint))
5586 (Right.is(tok::numeric_constant) ||
5587 (Right.is(tok::identifier) && Right.TokenText == "_"))) {
5593 (Right.isAccessSpecifier(/*ColonRequired=*/false) ||
5594 Right.is(Keywords.kw_internal))) {
5598 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) &&
5599 Left.is(tok::r_square) && Right.is(tok::l_square)) {
5604 if (Right.is(tok::string_literal) && Left.is(tok::plus) && BeforeLeft &&
5628 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && BeforeLeft &&
5647 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) &&
5657 if (Right.is(tok::plus) && Left.is(tok::string_literal) && AfterRight &&
5672 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) &&
5679 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left))
5684 if (Left.isStringLiteral() && Right.isStringLiteral())
5697 Right.isNot(tok::r_square)) ||
5699 if (Right.is(tok::l_brace))
5701 // scan to the right if an we see an object or an array inside
5703 for (const auto *Tok = &Right; Tok; Tok = Tok->Next) {
5718 Right.isNot(TT_TableGenDAGArgCloser)) {
5723 if (Right.is(TT_TableGenDAGArgCloser) && Right.MatchingParen &&
5724 Right.MatchingParen->is(TT_TableGenDAGArgOpenerToBreak) &&
5725 &Left != Right.MatchingParen->Next) {
5731 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) &&
5746 } else if (Right.MatchingParen &&
5747 (Right.MatchingParen->isOneOf(tok::l_brace,
5750 Right.MatchingParen->is(tok::l_paren)))) {
5759 if (Right.is(tok::comment)) {
5761 (Right.NewlinesBefore > 0 && Right.HasUnescapedNewline);
5769 Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
5771 return Right.NewlinesBefore > 0;
5774 if (Right.is(TT_RequiresClause)) {
5790 if (Right.is(tok::kw_concept))
5794 Right.NewlinesBefore > 0);
5800 return Right.isNot(tok::semi);
5802 return !Right.isOneOf(tok::semi, tok::l_brace);
5810 Right.is(TT_CtorInitializerColon))) {
5821 Right.isOneOf(TT_CtorInitializerComma, TT_CtorInitializerColon)) {
5827 Right.is(TT_CtorInitializerColon)) {
5838 Right.is(TT_InheritanceComma)) {
5845 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) {
5849 return Right.IsMultiline && Right.NewlinesBefore > 0;
5853 Right.NestingLevel == 1 && Style.Language == FormatStyle::LK_Proto) {
5858 if (Right.is(TT_InlineASMBrace))
5859 return Right.HasUnescapedNewline;
5861 if (isAllmanBrace(Left) || isAllmanBrace(Right)) {
5888 if (Right.isNot(TT_FunctionLBrace)) {
5903 Right.is(TT_ObjCDecl)) {
5921 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) &&
5929 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) &&
5934 if (Right.is(TT_ProtoExtensionLSquare))
5964 if (Style.isProto() && Right.is(TT_SelectorName) &&
5965 Right.isNot(tok::r_square) && AfterRight) {
6012 // left---. .---right
6025 const FormatToken &Right) const {
6026 const FormatToken &Left = *Right.Previous;
6030 Right.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon)) {
6037 if (Right.is(TT_CSharpNullable))
6044 if (Right.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
6049 const FormatToken *NonComment = Right.getPreviousNonComment();
6060 if (Right.NestingLevel == 0 &&
6063 Right.isOneOf(tok::l_square, tok::l_paren)) {
6070 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace))
6075 if (Left.is(tok::exclaim) && Right.is(tok::colon))
6080 if (Right.is(Keywords.kw_is)) {
6081 const FormatToken *Next = Right.getNextNonComment();
6094 if (Right.is(Keywords.kw_in))
6096 if (Right.is(Keywords.kw_as))
6098 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_infer)) {
6109 Right.isOneOf(Keywords.kw_module, tok::kw_namespace,
6118 Right.isOneOf(tok::identifier, tok::string_literal)) {
6121 if (Right.is(TT_TemplateString) && Right.closesScope())
6125 if (Left.is(tok::identifier) && Right.is(TT_TemplateString))
6134 if (Right.is(tok::l_paren)) {
6142 if (Left.is(tok::hash) || Right.is(tok::hash))
6151 if (Right.is(tok::r_brace)) {
6152 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) ||
6153 (Right.isBlockIndentedInitRBrace(Style)));
6157 if (Right.is(tok::r_paren)) {
6159 !Right.MatchingParen) {
6162 auto Next = Right.Next;
6167 const FormatToken *Previous = Right.MatchingParen->Previous;
6172 Right.is(TT_TrailingAnnotation) &&
6182 return Right.isNot(tok::l_paren);
6183 if (Right.is(TT_PointerOrReference)) {
6185 (getTokenPointerOrReferenceAlignment(Right) ==
6187 (!Right.Next || Right.Next->isNot(TT_FunctionDeclarationName)));
6189 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
6190 Right.is(tok::kw_operator)) {
6195 if (Right.isTrailingComment()) {
6202 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 &&
6205 if (Left.is(tok::question) && Right.is(tok::colon))
6207 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question))
6213 if (Right.is(TT_InheritanceColon))
6215 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) &&
6220 if (Right.is(tok::colon) &&
6221 !Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) {
6226 if (!Style.AlwaysBreakBeforeMultilineStrings && Right.isStringLiteral())
6252 if (((Right.is(tok::l_brace) || Right.is(tok::less)) &&
6253 Right.is(TT_DictLiteral)) ||
6254 Right.is(TT_ArrayInitializerLSquare)) {
6260 if (Right.is(tok::r_square) && Right.MatchingParen &&
6261 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) {
6264 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next &&
6265 Right.Next->is(TT_ObjCMethodExpr))) {
6270 if (Right.is(tok::kw_concept))
6272 if (Right.is(TT_RequiresClause))
6276 Right.NewlinesBefore > 0;
6282 if (Right.isOneOf(TT_RangeBasedForLoopColon, TT_OverloadedOperatorLParen,
6288 if (Right.is(TT_RangeBasedForLoopColon))
6290 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener))
6292 if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
6293 (Left.is(tok::less) && Right.is(tok::less))) {
6296 if (Right.is(TT_BinaryOperator) &&
6299 Right.getPrecedence() != prec::Assignment)) {
6306 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
6310 if (Left.is(tok::equal) && Right.is(tok::l_brace) &&
6322 if (Right.is(TT_ImplicitStringLiteral))
6325 if (Right.is(TT_TemplateCloser))
6327 if (Right.is(tok::r_square) && Right.MatchingParen &&
6328 Right.MatchingParen->is(TT_LambdaLSquare)) {
6335 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren,
6339 if (Right.isAttribute())
6342 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare))
6345 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
6348 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral))
6353 (!Right.isTrailingComment() || Right.NewlinesBefore > 0);
6355 if (Right.is(TT_CtorInitializerColon))
6361 if (Right.is(TT_CtorInitializerComma) &&
6369 if (Right.is(TT_InheritanceComma) &&
6375 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
6384 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) ||
6385 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) {
6390 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) {
6393 if (isAllmanLambdaBrace(Right))
6394 return !isItAnEmptyLambdaAllowed(Right, ShortLambdaOption);
6397 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) {
6404 return Right.Next && Right.Next->is(tok::l_paren);
6410 Right.isMemberAccess() ||
6411 Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
6414 Right.isOneOf(tok::identifier, tok::kw_const)) ||
6415 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) ||
6416 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser));