Lines Matching refs:Current

872   void updateParameterCount(FormatToken *Left, FormatToken *Current) {  in updateParameterCount()  argument
876 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
878 if (Current->is(tok::comma)) { in updateParameterCount()
882 Left->Role->CommaFound(Current); in updateParameterCount()
883 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
1602 void modifyContext(const FormatToken &Current) { in modifyContext() argument
1604 if (Current.getPrecedence() != prec::Assignment) in modifyContext()
1610 assert(Current.Previous); in modifyContext()
1611 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
1648 return !Current.Previous || Current.Previous->isNot(tok::kw_operator); in modifyContext()
1654 for (FormatToken *Previous = Current.Previous; in modifyContext()
1672 } else if (Current.is(tok::lessless) && in modifyContext()
1673 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1675 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
1677 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1679 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
1681 } else if (Current.Previous && in modifyContext()
1682 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1685 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1687 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
1688 for (FormatToken *Previous = Current.Previous; in modifyContext()
1697 } else if (Current.is(tok::kw_new)) { in modifyContext()
1699 } else if (Current.is(tok::semi) || in modifyContext()
1700 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1701 !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1709 static FormatToken *untilMatchingParen(FormatToken *Current) { in untilMatchingParen() argument
1712 while (Current) { in untilMatchingParen()
1713 if (Current->is(tok::l_paren)) in untilMatchingParen()
1715 if (Current->is(tok::r_paren)) in untilMatchingParen()
1719 Current = Current->Next; in untilMatchingParen()
1721 return Current; in untilMatchingParen()
1724 static bool isDeductionGuide(FormatToken &Current) { in isDeductionGuide() argument
1726 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1727 Current.startsSequence(tok::arrow, tok::identifier, tok::less)) { in isDeductionGuide()
1729 FormatToken *TemplateCloser = Current.Next->Next; in isDeductionGuide()
1751 Current.Previous->MatchingParen) { in isDeductionGuide()
1755 Current.Previous->MatchingParen->Previous; in isDeductionGuide()
1770 LeadingIdentifier->TokenText == Current.Next->TokenText; in isDeductionGuide()
1777 void determineTokenType(FormatToken &Current) { in determineTokenType() argument
1778 if (!Current.is(TT_Unknown)) { in determineTokenType()
1784 Current.is(tok::exclaim)) { in determineTokenType()
1785 if (Current.Previous) { in determineTokenType()
1789 *Current.Previous, /* AcceptIdentifierName= */ true) in determineTokenType()
1790 : Current.Previous->is(tok::identifier); in determineTokenType()
1792 Current.Previous->isOneOf( in determineTokenType()
1796 Current.Previous->Tok.isLiteral()) { in determineTokenType()
1797 Current.setType(TT_NonNullAssertion); in determineTokenType()
1801 if (Current.Next && in determineTokenType()
1802 Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) { in determineTokenType()
1803 Current.setType(TT_NonNullAssertion); in determineTokenType()
1811 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
1812 Current.setType(TT_BinaryOperator); in determineTokenType()
1813 } else if (isStartOfName(Current) && in determineTokenType()
1814 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
1815 Contexts.back().FirstStartOfName = &Current; in determineTokenType()
1816 Current.setType(TT_StartOfName); in determineTokenType()
1817 } else if (Current.is(tok::semi)) { in determineTokenType()
1822 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
1824 } else if (Current.is(tok::arrow) && in determineTokenType()
1826 Current.setType(TT_LambdaArrow); in determineTokenType()
1827 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1828 Current.NestingLevel == 0 && in determineTokenType()
1829 !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) { in determineTokenType()
1831 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1832 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
1833 Current.Previous->is(tok::r_brace)) { in determineTokenType()
1836 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1837 } else if (isDeductionGuide(Current)) { in determineTokenType()
1839 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1840 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1841 Current.setType(determineStarAmpUsage( in determineTokenType()
1842 Current, in determineTokenType()
1845 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
1846 Current.setType(determinePlusMinusCaretUsage(Current)); in determineTokenType()
1847 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1849 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1850 Current.setType(determineIncrementUsage(Current)); in determineTokenType()
1851 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1852 Current.setType(TT_UnaryOperator); in determineTokenType()
1853 } else if (Current.is(tok::question)) { in determineTokenType()
1858 Current.setType(TT_JsTypeOptionalQuestion); in determineTokenType()
1860 Current.setType(TT_ConditionalExpr); in determineTokenType()
1862 } else if (Current.isBinaryOperator() && in determineTokenType()
1863 (!Current.Previous || Current.Previous->isNot(tok::l_square)) && in determineTokenType()
1864 (!Current.is(tok::greater) && in determineTokenType()
1866 Current.setType(TT_BinaryOperator); in determineTokenType()
1867 } else if (Current.is(tok::comment)) { in determineTokenType()
1868 if (Current.TokenText.startswith("/*")) { in determineTokenType()
1869 if (Current.TokenText.endswith("*/")) { in determineTokenType()
1870 Current.setType(TT_BlockComment); in determineTokenType()
1874 Current.Tok.setKind(tok::unknown); in determineTokenType()
1877 Current.setType(TT_LineComment); in determineTokenType()
1879 } else if (Current.is(tok::l_paren)) { in determineTokenType()
1880 if (lParenStartsCppCast(Current)) in determineTokenType()
1881 Current.setType(TT_CppCastLParen); in determineTokenType()
1882 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1883 if (rParenEndsCast(Current)) in determineTokenType()
1884 Current.setType(TT_CastRParen); in determineTokenType()
1885 if (Current.MatchingParen && Current.Next && in determineTokenType()
1886 !Current.Next->isBinaryOperator() && in determineTokenType()
1887 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1890 if (FormatToken *AfterParen = Current.MatchingParen->Next) { in determineTokenType()
1893 if (FormatToken *BeforeParen = Current.MatchingParen->Previous) { in determineTokenType()
1899 Current.setType(TT_FunctionAnnotationRParen); in determineTokenType()
1905 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
1909 switch (Current.Next->Tok.getObjCKeywordID()) { in determineTokenType()
1913 Current.setType(TT_ObjCDecl); in determineTokenType()
1916 Current.setType(TT_ObjCProperty); in determineTokenType()
1921 } else if (Current.is(tok::period)) { in determineTokenType()
1922 FormatToken *PreviousNoComment = Current.getPreviousNonComment(); in determineTokenType()
1925 Current.setType(TT_DesignatedInitializerPeriod); in determineTokenType()
1926 } else if (Style.Language == FormatStyle::LK_Java && Current.Previous && in determineTokenType()
1927 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1929 Current.setType(Current.Previous->getType()); in determineTokenType()
1931 } else if (canBeObjCSelectorComponent(Current) && in determineTokenType()
1934 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
1935 Current.Previous->MatchingParen && in determineTokenType()
1936 Current.Previous->MatchingParen->Previous && in determineTokenType()
1937 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
1942 Current.setType(TT_SelectorName); in determineTokenType()
1943 } else if (Current.isOneOf(tok::identifier, tok::kw_const, tok::kw_noexcept, in determineTokenType()
1945 Current.Previous && in determineTokenType()
1946 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
1950 Current.setType(TT_TrailingAnnotation); in determineTokenType()
1953 Current.Previous) { in determineTokenType()
1954 if (Current.Previous->is(tok::at) && in determineTokenType()
1955 Current.isNot(Keywords.kw_interface)) { in determineTokenType()
1956 const FormatToken &AtToken = *Current.Previous; in determineTokenType()
1959 Current.setType(TT_LeadingJavaAnnotation); in determineTokenType()
1961 Current.setType(TT_JavaAnnotation); in determineTokenType()
1962 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1963 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1965 Current.setType(Current.Previous->getType()); in determineTokenType()
2423 : Style(Style), Keywords(Keywords), Line(Line), Current(Line.First) {} in ExpressionParser()
2429 while (Current && (Current->is(tok::kw_return) || in parse()
2430 (Current->is(tok::colon) && in parse()
2431 Current->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral)))) { in parse()
2435 if (!Current || Precedence > PrecedenceArrowAndPeriod) in parse()
2451 FormatToken *Start = Current; in parse()
2455 while (Current) { in parse()
2461 if (Precedence == CurrentPrecedence && Current && in parse()
2462 Current->is(TT_SelectorName)) { in parse()
2465 Start = Current; in parse()
2470 if (!Current || in parse()
2471 (Current->closesScope() && in parse()
2472 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
2475 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2482 if (Current->opensScope() || in parse()
2483 Current->isOneOf(TT_RequiresClause, in parse()
2487 while (Current && (!Current->closesScope() || Current->opensScope())) { in parse()
2496 LatestOperator->NextOperator = Current; in parse()
2497 LatestOperator = Current; in parse()
2498 Current->OperatorIndex = OperatorIndex; in parse()
2505 if (LatestOperator && (Current || Precedence > 0)) { in parse()
2514 auto Ret = Current ? Current : Line.Last; in parse()
2534 if (Current) { in getCurrentPrecedence()
2535 const FormatToken *NextNonComment = Current->getNextNonComment(); in getCurrentPrecedence()
2536 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
2538 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
2545 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
2547 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
2549 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
2551 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) || in getCurrentPrecedence()
2552 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2556 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
2559 Current->is(Keywords.kw_instanceof)) { in getCurrentPrecedence()
2563 Current->isOneOf(Keywords.kw_in, Keywords.kw_as)) { in getCurrentPrecedence()
2566 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2567 return Current->getPrecedence(); in getCurrentPrecedence()
2568 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
2571 Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements, in getCurrentPrecedence()
2584 if (!End && Current) in addFakeParenthesis()
2585 End = Current->getPreviousNonComment(); in addFakeParenthesis()
2597 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
2598 Tokens.push_back(Current); in parseUnaryOperator()
2609 while (Current && Current->isTrailingComment()) in parseConditionalExpr()
2611 FormatToken *Start = Current; in parseConditionalExpr()
2613 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
2617 if (!Current || Current->isNot(TT_ConditionalExpr)) in parseConditionalExpr()
2625 if (Current) in next()
2626 Current = Current->Next; in next()
2627 while (Current && in next()
2628 (Current->NewlinesBefore == 0 || SkipPastLeadingComments) && in next()
2629 Current->isTrailingComment()) { in next()
2630 Current = Current->Next; in next()
2637 FormatToken *Current; member in clang::format::__anon095ba8b90111::ExpressionParser
2711 static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current, in isFunctionDeclarationName() argument
2749 const FormatToken *Next = Current.Next; in isFunctionDeclarationName()
2750 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
2751 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
2755 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
2858 FormatToken *Current = Line.First->Next; in calculateFormattingInformation() local
2866 while (Current) { in calculateFormattingInformation()
2867 if (isFunctionDeclarationName(Style.isCpp(), *Current, Line)) in calculateFormattingInformation()
2868 Current->setType(TT_FunctionDeclarationName); in calculateFormattingInformation()
2869 const FormatToken *Prev = Current->Previous; in calculateFormattingInformation()
2870 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
2872 Current->SpacesRequiredBefore = in calculateFormattingInformation()
2875 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments; in calculateFormattingInformation()
2885 if (!Current->HasUnescapedNewline) { in calculateFormattingInformation()
2886 for (FormatToken *Parameter = Current->Previous; Parameter; in calculateFormattingInformation()
2899 } else if (Current->SpacesRequiredBefore == 0 && in calculateFormattingInformation()
2900 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
2901 Current->SpacesRequiredBefore = 1; in calculateFormattingInformation()
2906 Current->MustBreakBefore = true; in calculateFormattingInformation()
2908 Current->MustBreakBefore = in calculateFormattingInformation()
2909 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
2910 if (!Current->MustBreakBefore && InFunctionDecl && in calculateFormattingInformation()
2911 Current->is(TT_FunctionDeclarationName)) { in calculateFormattingInformation()
2912 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
2916 Current->CanBreakBefore = in calculateFormattingInformation()
2917 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
2924 if (Current->MustBreakBefore || Prev->Children.size() > 1 || in calculateFormattingInformation()
2927 Current->IsMultiline) { in calculateFormattingInformation()
2928 Current->TotalLength = Prev->TotalLength + Style.ColumnLimit; in calculateFormattingInformation()
2930 Current->TotalLength = Prev->TotalLength + Current->ColumnWidth + in calculateFormattingInformation()
2931 ChildSize + Current->SpacesRequiredBefore; in calculateFormattingInformation()
2934 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
2946 Current->SplitPenalty = splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
2948 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
2949 if (Current->ParameterIndex == 1) in calculateFormattingInformation()
2950 Current->SplitPenalty += 5 * Current->BindingStrength; in calculateFormattingInformation()
2952 Current->SplitPenalty += 20 * Current->BindingStrength; in calculateFormattingInformation()
2955 Current = Current->Next; in calculateFormattingInformation()
2960 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
2961 if (Current->Role) in calculateFormattingInformation()
2962 Current->Role->precomputeFormattingInfos(Current); in calculateFormattingInformation()
2963 if (Current->MatchingParen && in calculateFormattingInformation()
2964 Current->MatchingParen->opensBlockOrBlockTypeList(Style) && in calculateFormattingInformation()
2968 Current->IndentLevel = IndentLevel; in calculateFormattingInformation()
2969 if (Current->opensBlockOrBlockTypeList(Style)) in calculateFormattingInformation()
2979 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths() local
2980 while (Current) { in calculateUnbreakableTailLengths()
2981 Current->UnbreakableTailLength = UnbreakableTailLength; in calculateUnbreakableTailLengths()
2982 if (Current->CanBreakBefore || in calculateUnbreakableTailLengths()
2983 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
2987 Current->ColumnWidth + Current->SpacesRequiredBefore; in calculateUnbreakableTailLengths()
2989 Current = Current->Previous; in calculateUnbreakableTailLengths()