Lines Matching full:right

199           // tokens to prevent splitting right shift operators and potentially
476 // categorize it as an unary operator, so set the right type here.
2741 // If there is an identifier (or with a few exceptions a keyword) right
2749 // Certain other tokens right before the parentheses are also signals that
2995 // After right braces, star tokens are likely to be pointers to struct,
3029 // Thus, having an identifier on the right-hand side indicates a binary
3250 // intervene so that the fake right paren is inserted correctly.
4145 const FormatToken &Right = Tok;
4152 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_throws))
4154 if (Right.is(Keywords.kw_implements))
4159 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma))
4164 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) {
4168 if (Left.opensScope() && Right.closesScope())
4171 if (Right.is(tok::l_square))
4173 if (Right.is(tok::period))
4177 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral))
4179 if (Right.is(tok::l_square)) {
4183 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
4185 if (!Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare,
4194 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
4195 Right.is(tok::kw_operator)) {
4196 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
4200 if (InFunctionDecl && Right.NestingLevel == 0)
4204 if (Right.is(TT_PointerOrReference))
4206 if (Right.is(TT_LambdaArrow))
4208 if (Left.is(tok::equal) && Right.is(tok::l_brace))
4222 if (Right.isMemberAccess()) {
4242 return !Right.NextOperator || !Right.NextOperator->Previous->closesScope()
4247 if (Right.is(TT_TrailingAnnotation) &&
4248 (!Right.Next || Right.Next->isNot(tok::l_paren))) {
4258 bool is_short_annotation = Right.TokenText.size() < 10;
4268 if (Right.is(TT_SelectorName))
4294 if (Right.is(tok::r_brace))
4321 if (Right.is(tok::plus) && Left.isLabelString() &&
4322 (Right.NextOperator || Right.OperatorIndex != 0)) {
4327 if (Right.is(tok::lessless) && Left.isLabelString() &&
4328 (Right.NextOperator || Right.OperatorIndex != 1)) {
4331 if (Right.is(tok::lessless)) {
4333 if (Left.isNot(tok::r_paren) || Right.OperatorIndex > 0) {
4347 Level = Right.getPrecedence();
4356 bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const {
4359 if (Right.is(TT_OverloadedOperatorLParen) &&
4364 Right.ParameterCount > 0) {
4372 const FormatToken &Right) const {
4374 !Right.isOneOf(tok::semi, tok::r_paren, tok::hashhash)) {
4377 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen &&
4378 Right.MatchingParen->is(TT_CastRParen)) {
4387 if (Right.is(tok::hashhash))
4390 return Right.is(tok::hash);
4391 if (Left.is(BK_Block) && Right.is(tok::r_brace) &&
4392 Right.MatchingParen == &Left && Line.Children.empty()) {
4395 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) ||
4397 Right.is(tok::r_brace) && Right.isNot(BK_Block))) {
4402 Left.is(tok::r_paren) && Right.is(tok::r_paren)) {
4404 if (InnerLParen && InnerLParen->Previous == Right.MatchingParen) {
4413 else if (Right.is(tok::r_paren) && Right.MatchingParen)
4414 LeftParen = Right.MatchingParen;
4424 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace,
4431 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace))
4437 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && BeforeLeft &&
4443 !Right.isOneOf(tok::semi, tok::r_paren)) {
4447 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
4448 return (Right.is(TT_CastRParen) ||
4453 if (Right.isOneOf(tok::semi, tok::comma))
4455 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
4456 bool IsLightweightGeneric = Right.MatchingParen &&
4457 Right.MatchingParen->Next &&
4458 Right.MatchingParen->Next->is(tok::colon);
4461 if (Right.is(tok::less) && Left.is(tok::kw_template))
4466 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant,
4475 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) {
4478 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) {
4480 if (Left.is(tok::less) && Right.is(tok::greater))
4485 if (Right.isNot(TT_OverloadedOperatorLParen))
4488 if (Right.is(tok::ellipsis)) {
4492 if (Left.is(tok::l_square) && Right.is(tok::amp))
4494 if (Right.is(TT_PointerOrReference)) {
4515 if (Left.isTypeOrIdentifier(LangOpts) && Right.Next && Right.Next->Next &&
4516 Right.Next->Next->is(TT_RangeBasedForLoopColon)) {
4517 return getTokenPointerOrReferenceAlignment(Right) !=
4521 (getTokenPointerOrReferenceAlignment(Right) !=
4527 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
4538 Right.canBePointerOrReferenceQualifier()) {
4542 if (Right.Tok.isLiteral())
4545 if (Right.is(TT_BlockComment))
4549 if (Right.isOneOf(Keywords.kw_override, Keywords.kw_final, tok::kw_noexcept,
4551 Right.isNot(TT_StartOfName)) {
4555 if (Right.is(tok::l_brace) && Right.is(BK_Block))
4558 if (BeforeLeft && BeforeLeft->isTypeOrIdentifier(LangOpts) && Right.Next &&
4559 Right.Next->is(TT_RangeBasedForLoopColon)) {
4563 if (Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
4587 if (!Right.startsSequence(tok::identifier, tok::r_paren))
4589 assert(Right.Next);
4590 const auto *LParen = Right.Next->MatchingParen;
4595 // Ensure right pointer alignment with ellipsis e.g. int *...P
4601 if (Right.is(tok::star) && Left.is(tok::l_paren))
4603 if (Left.is(tok::star) && Right.isPointerOrReference())
4605 if (Right.isPointerOrReference()) {
4645 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square))
4655 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) &&
4659 Style.SpacesInSquareBrackets && Right.isNot(tok::r_square));
4661 if (Right.is(tok::r_square)) {
4662 return Right.MatchingParen &&
4663 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) &&
4664 SpaceRequiredForArrayInitializerLSquare(*Right.MatchingParen,
4667 Right.MatchingParen->isOneOf(TT_ArraySubscriptLSquare,
4671 if (Right.is(tok::l_square) &&
4672 !Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare,
4677 Right.is(TT_ArraySubscriptLSquare))) {
4680 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
4683 (Right.is(tok::r_brace) && Right.MatchingParen &&
4684 Right.MatchingParen->isNot(BK_Block))) {
4694 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare))
4697 if (Right.is(tok::l_paren)) {
4698 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen))
4699 return spaceRequiredBeforeParens(Right);
4703 spaceRequiredBeforeParens(Right);
4707 spaceRequiredBeforeParens(Right);
4715 spaceRequiredBeforeParens(Right);
4719 spaceRequiredBeforeParens(Right);
4723 Right.isNot(TT_OverloadedOperatorLParen) &&
4734 Right.is(TT_ConditionLParen)) {
4736 spaceRequiredBeforeParens(Right);
4741 if (Right.is(TT_OverloadedOperatorLParen))
4742 return spaceRequiredBeforeParens(Right);
4744 if (Line.MightBeFunctionDecl && Right.is(TT_FunctionDeclarationLParen)) {
4745 if (spaceRequiredBeforeParens(Right))
4756 spaceRequiredBeforeParens(Right);
4761 spaceRequiredBeforeParens(Right);
4766 spaceRequiredBeforeParens(Right);
4773 spaceRequiredBeforeParens(Right);
4779 return spaceRequiredBeforeParens(Right);
4783 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
4785 if (Right.is(TT_UnaryOperator)) {
4797 Right.is(tok::l_brace) && Right.getNextNonComment() &&
4798 Right.isNot(BK_Block)) {
4801 if (Left.is(tok::period) || Right.is(tok::period))
4805 if (Right.is(tok::hash) && Left.is(tok::identifier) &&
4821 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
4827 if (Right.is(tok::r_brace) && Right.MatchingParen &&
4828 Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) {
4832 if (Right.is(TT_TrailingAnnotation) && Right.isOneOf(tok::amp, tok::ampamp) &&
4834 (!Right.Next || Right.Next->is(tok::semi))) {
4838 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left;
4845 const FormatToken &Right) const {
4846 const FormatToken &Left = *Right.Previous;
4851 return Right.hasWhitespaceBefore();
4857 if (Keywords.isWordLike(Right, IsVerilog) &&
4864 if (Left.is(tok::star) && Right.is(tok::comment))
4869 Right.isOneOf(TT_TemplateOpener, TT_TemplateCloser)) {
4873 if (Right.is(tok::period) && Left.is(tok::numeric_constant))
4877 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis))
4881 Right.is(TT_ModulePartitionColon)) {
4885 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon))
4889 Right.isOneOf(tok::identifier, tok::kw_private)) {
4892 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) &&
4898 Right.is(tok::coloncolon)) {
4903 return Right.is(tok::coloncolon);
4904 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) &&
4909 Right.is(TT_TemplateOpener)) {
4913 if (Left.is(tok::identifier) && Right.is(tok::numeric_constant))
4914 return Right.TokenText[0] != '.';
4916 if (Left.Tok.getIdentifierInfo() && Right.Tok.isLiteral())
4919 if (Right.is(tok::period) &&
4924 if (Right.is(tok::l_paren) &&
4928 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName))
4931 if (Left.is(tok::slash) || Right.is(tok::slash))
4935 Right.isOneOf(tok::l_brace, tok::less)) {
4943 if (Left.is(tok::numeric_constant) && Right.is(tok::percent))
4944 return Right.hasWhitespaceBefore();
4946 if (Right.is(tok::colon) && Left.is(tok::string_literal))
4954 if (Left.is(tok::kw_this) && Right.is(tok::l_square))
4958 if (Left.is(tok::kw_new) && Right.is(tok::l_paren))
4962 if (Right.is(tok::l_brace))
4966 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace))
4969 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace))
4973 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow))
4977 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon))
4981 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName))
4985 if (Left.is(tok::l_square) || Right.is(tok::r_square))
4989 if (Right.is(TT_CSharpNullable))
4993 if (Right.is(TT_NonNullAssertion))
4997 if (Left.is(tok::comma) && Right.is(tok::comma))
5001 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren))
5005 if (Right.is(tok::l_paren)) {
5009 spaceRequiredBeforeParens(Right);
5020 Right.is(tok::l_paren)) {
5027 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous &&
5031 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) &&
5032 Right.MatchingParen) {
5033 const FormatToken *Next = Right.MatchingParen->getNextNonComment();
5040 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) {
5047 Right.is(TT_TemplateString)) {
5050 if (Right.is(tok::star) &&
5054 if (Right.isOneOf(tok::l_brace, tok::l_square) &&
5059 if (Right.is(tok::l_paren)) {
5090 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) {
5094 Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren)) {
5101 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace))
5103 if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion))
5105 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator))
5107 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) &&
5114 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square,
5121 if (Right.is(TT_NonNullAssertion))
5124 Right.isOneOf(Keywords.kw_as, Keywords.kw_in)) {
5128 if (Left.is(TT_CaseLabelArrow) || Right.is(TT_CaseLabelArrow))
5130 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
5133 if (Left.is(tok::l_square) || Right.is(tok::r_square))
5136 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) {
5138 spaceRequiredBeforeParens(Right);
5143 Right.is(TT_TemplateOpener)) {
5153 !Right.isOneOf(tok::r_paren, tok::semi)) ||
5154 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) {
5155 const FormatToken *Next = Right.getNextNonComment();
5164 if (Right.isNot(tok::semi) &&
5175 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) {
5179 if (Left.is(tok::arrow) || Right.is(tok::arrow))
5184 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at))
5187 if (Right.is(tok::l_square) &&
5192 if (Right.isOneOf(tok::period, Keywords.kw_apostrophe) &&
5200 if ((Right.is(Keywords.kw_apostrophe) ||
5201 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) &&
5210 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) ||
5211 (Left.is(tok::star) && Right.is(tok::semi))) {
5215 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier))
5218 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength))
5222 Right.isOneOf(tok::lessless, tok::greatergreater)) ||
5229 if (Left.is(tok::l_square) && Right.is(tok::l_brace))
5231 if (Left.is(tok::r_brace) && Right.is(tok::r_square))
5234 if (Right.isOneOf(TT_TableGenDAGArgListColon,
5240 if (Right.is(TT_TableGenCondOperatorColon))
5244 Right.isNot(TT_TableGenDAGArgCloser)) {
5248 if (Right.isOneOf(tok::l_paren, tok::less) &&
5255 Right.isOneOf(tok::l_brace, tok::colon)) {
5259 if (Left.is(tok::hash) || Right.is(tok::hash))
5267 return Right.hasWhitespaceBefore();
5272 canBeObjCSelectorComponent(Right)) {
5280 (Right.is(tok::equal) || Left.is(tok::equal))) {
5284 if (Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow) ||
5288 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
5294 if (Right.is(tok::comma))
5296 if (Right.is(TT_ObjCBlockLParen))
5298 if (Right.is(TT_CtorInitializerColon))
5300 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon)
5302 if (Right.is(TT_RangeBasedForLoopColon) &&
5310 if (Right.is(tok::colon)) {
5311 if (Right.is(TT_CaseLabelColon))
5313 if (Right.is(TT_GotoLabelColon))
5316 if (!Right.getNextNonComment())
5318 if (Right.is(TT_ObjCMethodExpr))
5322 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon))
5324 if (Right.is(TT_DictLiteral))
5326 if (Right.is(TT_AttributeColon))
5328 if (Right.is(TT_CSharpNamedArgumentColon))
5330 if (Right.is(TT_GenericSelectionColon))
5332 if (Right.is(TT_BitFieldColon)) {
5340 Right.isOneOf(tok::minus, tok::minusminus)) ||
5342 Right.isOneOf(tok::plus, tok::plusplus))) {
5348 if (Left.is(tok::amp) && Right.is(tok::r_square))
5357 Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
5360 auto ShouldAddSpacesInAngles = [this, &Right]() {
5364 return Right.hasWhitespaceBefore();
5368 if (Left.is(tok::greater) && Right.is(tok::greater)) {
5373 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
5377 if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) ||
5379 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) {
5383 Right.getPrecedence() == prec::Assignment) {
5386 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) &&
5390 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) {
5394 return Right.hasWhitespaceBefore();
5396 if (Right.is(tok::coloncolon) &&
5407 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
5410 if (Right.is(TT_StructuredBindingLSquare)) {
5415 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) &&
5416 Right.isOneOf(tok::amp, tok::ampamp)) {
5417 return getTokenReferenceAlignment(Right) != FormatStyle::PAS_Left;
5419 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) ||
5421 Right.isNot(tok::r_paren))) {
5424 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
5429 if (Right.is(tok::less) && Left.isNot(tok::l_paren) &&
5433 if (Right.is(TT_TrailingUnaryOperator))
5437 return spaceRequiredBetween(Line, Left, Right);
5464 const FormatToken &Right) const {
5465 const FormatToken &Left = *Right.Previous;
5466 if (Right.NewlinesBefore > 1 && Style.MaxEmptyLinesToKeep > 0)
5476 const auto *AfterRight = Right.Next;
5479 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) &&
5483 if (Right.is(TT_CSharpNamedArgumentColon) ||
5487 if (Right.is(TT_CSharpGenericTypeConstraint))
5490 (Right.is(tok::numeric_constant) ||
5491 (Right.is(tok::identifier) && Right.TokenText == "_"))) {
5497 (Right.isAccessSpecifier(/*ColonRequired=*/false) ||
5498 Right.is(Keywords.kw_internal))) {
5502 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) &&
5503 Left.is(tok::r_square) && Right.is(tok::l_square)) {
5508 if (Right.is(tok::string_literal) && Left.is(tok::plus) && BeforeLeft &&
5532 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && BeforeLeft &&
5551 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) &&
5561 if (Right.is(tok::plus) && Left.is(tok::string_literal) && AfterRight &&
5576 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) &&
5583 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left))
5588 if (Left.isStringLiteral() && Right.isStringLiteral())
5601 Right.isNot(tok::r_square)) ||
5603 if (Right.is(tok::l_brace))
5605 // scan to the right if an we see an object or an array inside
5607 for (const auto *Tok = &Right; Tok; Tok = Tok->Next) {
5622 Right.isNot(TT_TableGenDAGArgCloser)) {
5627 if (Right.is(TT_TableGenDAGArgCloser) && Right.MatchingParen &&
5628 Right.MatchingParen->is(TT_TableGenDAGArgOpenerToBreak) &&
5629 &Left != Right.MatchingParen->Next) {
5635 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) &&
5650 } else if (Right.MatchingParen &&
5651 (Right.MatchingParen->isOneOf(tok::l_brace,
5654 Right.MatchingParen->is(tok::l_paren)))) {
5663 if (Right.is(tok::comment)) {
5665 (Right.NewlinesBefore > 0 && Right.HasUnescapedNewline);
5673 Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
5675 return Right.NewlinesBefore > 0;
5678 if (Right.is(TT_RequiresClause)) {
5693 if (Right.is(tok::kw_concept))
5697 Right.NewlinesBefore > 0);
5699 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) {
5711 Right.is(TT_CtorInitializerColon))) {
5722 Right.isOneOf(TT_CtorInitializerComma, TT_CtorInitializerColon)) {
5728 Right.is(TT_CtorInitializerColon)) {
5739 Right.is(TT_InheritanceComma)) {
5746 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) {
5750 return Right.IsMultiline && Right.NewlinesBefore > 0;
5754 Right.NestingLevel == 1 && Style.Language == FormatStyle::LK_Proto) {
5759 if (Right.is(TT_InlineASMBrace))
5760 return Right.HasUnescapedNewline;
5762 if (isAllmanBrace(Left) || isAllmanBrace(Right)) {
5789 if (Right.isNot(TT_FunctionLBrace)) {
5804 Right.is(TT_ObjCDecl)) {
5822 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) &&
5830 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) &&
5835 if (Right.is(TT_ProtoExtensionLSquare))
5865 if (Style.isProto() && Right.is(TT_SelectorName) &&
5866 Right.isNot(tok::r_square) && AfterRight) {
5913 // left---. .---right
5926 const FormatToken &Right) const {
5927 const FormatToken &Left = *Right.Previous;
5931 Right.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon)) {
5938 if (Right.is(TT_CSharpNullable))
5945 if (Right.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
5950 const FormatToken *NonComment = Right.getPreviousNonComment();
5961 if (Right.NestingLevel == 0 &&
5964 Right.isOneOf(tok::l_square, tok::l_paren)) {
5971 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace))
5976 if (Left.is(tok::exclaim) && Right.is(tok::colon))
5981 if (Right.is(Keywords.kw_is)) {
5982 const FormatToken *Next = Right.getNextNonComment();
5995 if (Right.is(Keywords.kw_in))
5997 if (Right.is(Keywords.kw_as))
5999 if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_infer)) {
6010 Right.isOneOf(Keywords.kw_module, tok::kw_namespace,
6019 Right.isOneOf(tok::identifier, tok::string_literal)) {
6022 if (Right.is(TT_TemplateString) && Right.closesScope())
6026 if (Left.is(tok::identifier) && Right.is(TT_TemplateString))
6035 if (Right.is(tok::l_paren)) {
6043 if (Left.is(tok::hash) || Right.is(tok::hash))
6054 return Right.isNot(tok::l_paren);
6055 if (Right.is(TT_PointerOrReference)) {
6057 (getTokenPointerOrReferenceAlignment(Right) ==
6059 (!Right.Next || Right.Next->isNot(TT_FunctionDeclarationName)));
6061 if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
6062 Right.is(tok::kw_operator)) {
6067 if (Right.isTrailingComment()) {
6074 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 &&
6077 if (Left.is(tok::question) && Right.is(tok::colon))
6079 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question))
6085 if (Right.is(TT_InheritanceColon))
6087 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) &&
6092 if (Right.is(tok::colon) &&
6093 !Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) {
6098 if (!Style.AlwaysBreakBeforeMultilineStrings && Right.isStringLiteral())
6124 if (((Right.is(tok::l_brace) || Right.is(tok::less)) &&
6125 Right.is(TT_DictLiteral)) ||
6126 Right.is(TT_ArrayInitializerLSquare)) {
6132 if (Right.is(tok::r_square) && Right.MatchingParen &&
6133 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) {
6136 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next &&
6137 Right.Next->is(TT_ObjCMethodExpr))) {
6142 if (Right.is(tok::kw_concept))
6144 if (Right.is(TT_RequiresClause))
6148 Right.NewlinesBefore > 0;
6154 if (Right.isOneOf(TT_RangeBasedForLoopColon, TT_OverloadedOperatorLParen,
6160 if (Right.is(TT_RangeBasedForLoopColon))
6162 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener))
6164 if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
6165 (Left.is(tok::less) && Right.is(tok::less))) {
6168 if (Right.is(TT_BinaryOperator) &&
6171 Right.getPrecedence() != prec::Assignment)) {
6178 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
6182 if (Left.is(tok::equal) && Right.is(tok::l_brace) &&
6194 if (Right.is(TT_ImplicitStringLiteral))
6197 if (Right.is(TT_TemplateCloser))
6199 if (Right.is(tok::r_square) && Right.MatchingParen &&
6200 Right.MatchingParen->is(TT_LambdaLSquare)) {
6206 if (Right.is(tok::r_brace)) {
6207 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) ||
6208 (Right.isBlockIndentedInitRBrace(Style)));
6212 if (Right.is(tok::r_paren)) {
6214 !Right.MatchingParen) {
6217 auto Next = Right.Next;
6222 const FormatToken *Previous = Right.MatchingParen->Previous;
6229 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren,
6233 if (Right.isAttribute())
6236 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare))
6239 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
6242 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral))
6247 (!Right.isTrailingComment() || Right.NewlinesBefore > 0);
6249 if (Right.is(TT_CtorInitializerColon))
6255 if (Right.is(TT_CtorInitializerComma) &&
6263 if (Right.is(TT_InheritanceComma) &&
6269 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
6278 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) ||
6279 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) {
6284 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) {
6287 if (isAllmanLambdaBrace(Right))
6288 return !isItAnEmptyLambdaAllowed(Right, ShortLambdaOption);
6291 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) {
6298 return Right.Next && Right.Next->is(tok::l_paren);
6304 Right.isMemberAccess() ||
6305 Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
6308 Right.isOneOf(tok::identifier, tok::kw_const)) ||
6309 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) ||
6310 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser));