Lines Matching refs:Current
894 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
898 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
900 if (Current->is(tok::comma)) { in updateParameterCount()
904 Left->Role->CommaFound(Current); in updateParameterCount()
905 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
1670 void modifyContext(const FormatToken &Current) { in modifyContext() argument
1672 if (Current.getPrecedence() != prec::Assignment) in modifyContext()
1678 assert(Current.Previous); in modifyContext()
1679 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
1716 return !Current.Previous || Current.Previous->isNot(tok::kw_operator); in modifyContext()
1722 for (FormatToken *Previous = Current.Previous; in modifyContext()
1740 } else if (Current.is(tok::lessless) && in modifyContext()
1741 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1743 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
1745 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1747 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
1749 } else if (Current.Previous && in modifyContext()
1750 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1753 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1755 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
1756 for (FormatToken *Previous = Current.Previous; in modifyContext()
1765 } else if (Current.is(tok::kw_new)) { in modifyContext()
1767 } else if (Current.is(tok::semi) || in modifyContext()
1768 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1769 !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1777 static FormatToken *untilMatchingParen(FormatToken *Current) { in untilMatchingParen() argument
1780 while (Current) { in untilMatchingParen()
1781 if (Current->is(tok::l_paren)) in untilMatchingParen()
1783 if (Current->is(tok::r_paren)) in untilMatchingParen()
1787 Current = Current->Next; in untilMatchingParen()
1789 return Current; in untilMatchingParen()
1792 static bool isDeductionGuide(FormatToken &Current) { in isDeductionGuide() argument
1794 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1795 Current.startsSequence(tok::arrow, tok::identifier, tok::less)) { in isDeductionGuide()
1797 FormatToken *TemplateCloser = Current.Next->Next; in isDeductionGuide()
1819 Current.Previous->MatchingParen) { in isDeductionGuide()
1823 Current.Previous->MatchingParen->Previous; in isDeductionGuide()
1826 LeadingIdentifier->TokenText == Current.Next->TokenText; in isDeductionGuide()
1832 void determineTokenType(FormatToken &Current) { in determineTokenType() argument
1833 if (!Current.is(TT_Unknown)) { in determineTokenType()
1839 Current.is(tok::exclaim)) { in determineTokenType()
1840 if (Current.Previous) { in determineTokenType()
1844 *Current.Previous, /* AcceptIdentifierName= */ true) in determineTokenType()
1845 : Current.Previous->is(tok::identifier); in determineTokenType()
1847 Current.Previous->isOneOf( in determineTokenType()
1851 Current.Previous->Tok.isLiteral()) { in determineTokenType()
1852 Current.setType(TT_NonNullAssertion); in determineTokenType()
1856 if (Current.Next && in determineTokenType()
1857 Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) { in determineTokenType()
1858 Current.setType(TT_NonNullAssertion); in determineTokenType()
1866 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
1867 Current.setType(TT_BinaryOperator); in determineTokenType()
1868 } else if (isStartOfName(Current) && in determineTokenType()
1869 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
1870 Contexts.back().FirstStartOfName = &Current; in determineTokenType()
1871 Current.setType(TT_StartOfName); in determineTokenType()
1872 } else if (Current.is(tok::semi)) { in determineTokenType()
1877 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
1879 } else if (Current.is(tok::arrow) && in determineTokenType()
1881 Current.setType(TT_LambdaArrow); in determineTokenType()
1882 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1883 Current.NestingLevel == 0 && in determineTokenType()
1884 !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) { in determineTokenType()
1886 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1887 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
1888 Current.Previous->is(tok::r_brace)) { in determineTokenType()
1891 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1892 } else if (isDeductionGuide(Current)) { in determineTokenType()
1894 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1895 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1896 Current.setType(determineStarAmpUsage( in determineTokenType()
1897 Current, in determineTokenType()
1900 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret) || in determineTokenType()
1901 (Style.isVerilog() && Current.is(tok::pipe))) { in determineTokenType()
1902 Current.setType(determinePlusMinusCaretUsage(Current)); in determineTokenType()
1903 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1905 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1906 Current.setType(determineIncrementUsage(Current)); in determineTokenType()
1907 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1908 Current.setType(TT_UnaryOperator); in determineTokenType()
1909 } else if (Current.is(tok::question)) { in determineTokenType()
1914 Current.setType(TT_JsTypeOptionalQuestion); in determineTokenType()
1916 Current.setType(TT_ConditionalExpr); in determineTokenType()
1918 } else if (Current.isBinaryOperator() && in determineTokenType()
1919 (!Current.Previous || Current.Previous->isNot(tok::l_square)) && in determineTokenType()
1920 (!Current.is(tok::greater) && in determineTokenType()
1922 Current.setType(TT_BinaryOperator); in determineTokenType()
1923 } else if (Current.is(tok::comment)) { in determineTokenType()
1924 if (Current.TokenText.startswith("/*")) { in determineTokenType()
1925 if (Current.TokenText.endswith("*/")) { in determineTokenType()
1926 Current.setType(TT_BlockComment); in determineTokenType()
1930 Current.Tok.setKind(tok::unknown); in determineTokenType()
1933 Current.setType(TT_LineComment); in determineTokenType()
1935 } else if (Current.is(tok::l_paren)) { in determineTokenType()
1936 if (lParenStartsCppCast(Current)) in determineTokenType()
1937 Current.setType(TT_CppCastLParen); in determineTokenType()
1938 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1939 if (rParenEndsCast(Current)) in determineTokenType()
1940 Current.setType(TT_CastRParen); in determineTokenType()
1941 if (Current.MatchingParen && Current.Next && in determineTokenType()
1942 !Current.Next->isBinaryOperator() && in determineTokenType()
1943 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1946 if (FormatToken *AfterParen = Current.MatchingParen->Next) { in determineTokenType()
1949 if (FormatToken *BeforeParen = Current.MatchingParen->Previous) { in determineTokenType()
1955 Current.setType(TT_FunctionAnnotationRParen); in determineTokenType()
1961 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
1965 switch (Current.Next->Tok.getObjCKeywordID()) { in determineTokenType()
1969 Current.setType(TT_ObjCDecl); in determineTokenType()
1972 Current.setType(TT_ObjCProperty); in determineTokenType()
1977 } else if (Current.is(tok::period)) { in determineTokenType()
1978 FormatToken *PreviousNoComment = Current.getPreviousNonComment(); in determineTokenType()
1981 Current.setType(TT_DesignatedInitializerPeriod); in determineTokenType()
1982 } else if (Style.Language == FormatStyle::LK_Java && Current.Previous && in determineTokenType()
1983 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1985 Current.setType(Current.Previous->getType()); in determineTokenType()
1987 } else if (canBeObjCSelectorComponent(Current) && in determineTokenType()
1990 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
1991 Current.Previous->MatchingParen && in determineTokenType()
1992 Current.Previous->MatchingParen->Previous && in determineTokenType()
1993 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
1998 Current.setType(TT_SelectorName); in determineTokenType()
1999 } else if (Current.isOneOf(tok::identifier, tok::kw_const, tok::kw_noexcept, in determineTokenType()
2001 Current.Previous && in determineTokenType()
2002 !Current.Previous->isOneOf(tok::equal, tok::at, in determineTokenType()
2008 Current.setType(TT_TrailingAnnotation); in determineTokenType()
2011 Current.Previous) { in determineTokenType()
2012 if (Current.Previous->is(tok::at) && in determineTokenType()
2013 Current.isNot(Keywords.kw_interface)) { in determineTokenType()
2014 const FormatToken &AtToken = *Current.Previous; in determineTokenType()
2017 Current.setType(TT_LeadingJavaAnnotation); in determineTokenType()
2019 Current.setType(TT_JavaAnnotation); in determineTokenType()
2020 } else if (Current.Previous->is(tok::period) && in determineTokenType()
2021 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
2023 Current.setType(Current.Previous->getType()); in determineTokenType()
2495 : Style(Style), Keywords(Keywords), Line(Line), Current(Line.First) {} in ExpressionParser()
2501 while (Current && (Current->is(tok::kw_return) || in parse()
2502 (Current->is(tok::colon) && in parse()
2503 Current->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral)))) { in parse()
2507 if (!Current || Precedence > PrecedenceArrowAndPeriod) in parse()
2523 FormatToken *Start = Current; in parse()
2527 while (Current) { in parse()
2533 if (Precedence == CurrentPrecedence && Current && in parse()
2534 Current->is(TT_SelectorName)) { in parse()
2537 Start = Current; in parse()
2542 if (!Current || in parse()
2543 (Current->closesScope() && in parse()
2544 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
2547 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2554 if (Current->opensScope() || in parse()
2555 Current->isOneOf(TT_RequiresClause, in parse()
2559 while (Current && (!Current->closesScope() || Current->opensScope())) { in parse()
2568 LatestOperator->NextOperator = Current; in parse()
2569 LatestOperator = Current; in parse()
2570 Current->OperatorIndex = OperatorIndex; in parse()
2577 if (LatestOperator && (Current || Precedence > 0)) { in parse()
2586 auto Ret = Current ? Current : Line.Last; in parse()
2606 if (Current) { in getCurrentPrecedence()
2607 const FormatToken *NextNonComment = Current->getNextNonComment(); in getCurrentPrecedence()
2608 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
2610 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
2617 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
2619 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
2621 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
2623 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) || in getCurrentPrecedence()
2624 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2628 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
2631 Current->is(Keywords.kw_instanceof)) { in getCurrentPrecedence()
2635 Current->isOneOf(Keywords.kw_in, Keywords.kw_as)) { in getCurrentPrecedence()
2638 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2639 return Current->getPrecedence(); in getCurrentPrecedence()
2640 if (Current->isOneOf(tok::period, tok::arrow) && in getCurrentPrecedence()
2641 Current->isNot(TT_TrailingReturnArrow)) { in getCurrentPrecedence()
2645 Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements, in getCurrentPrecedence()
2651 if (Style.isVerilog() && Current->is(tok::colon)) in getCurrentPrecedence()
2662 if (!End && Current) in addFakeParenthesis()
2663 End = Current->getPreviousNonComment(); in addFakeParenthesis()
2675 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
2676 Tokens.push_back(Current); in parseUnaryOperator()
2687 while (Current && Current->isTrailingComment()) in parseConditionalExpr()
2689 FormatToken *Start = Current; in parseConditionalExpr()
2691 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
2695 if (!Current || Current->isNot(TT_ConditionalExpr)) in parseConditionalExpr()
2703 if (Current) in next()
2704 Current = Current->Next; in next()
2705 while (Current && in next()
2706 (Current->NewlinesBefore == 0 || SkipPastLeadingComments) && in next()
2707 Current->isTrailingComment()) { in next()
2708 Current = Current->Next; in next()
2715 FormatToken *Current; member in clang::format::__anon192501e00111::ExpressionParser
2792 static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current, in isFunctionDeclarationName() argument
2830 const FormatToken *Next = Current.Next; in isFunctionDeclarationName()
2831 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
2832 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
2836 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
2955 FormatToken *Current = Line.First->Next; in calculateFormattingInformation() local
2963 for (FormatToken *Tok = Current, *AfterLastAttribute = nullptr; Tok; in calculateFormattingInformation()
2978 while (Current) { in calculateFormattingInformation()
2979 const FormatToken *Prev = Current->Previous; in calculateFormattingInformation()
2980 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
2982 Current->SpacesRequiredBefore = in calculateFormattingInformation()
2985 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments; in calculateFormattingInformation()
2995 if (!Current->HasUnescapedNewline) { in calculateFormattingInformation()
2996 for (FormatToken *Parameter = Current->Previous; Parameter; in calculateFormattingInformation()
3009 } else if (Current->SpacesRequiredBefore == 0 && in calculateFormattingInformation()
3010 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
3011 Current->SpacesRequiredBefore = 1; in calculateFormattingInformation()
3016 Current->MustBreakBefore = true; in calculateFormattingInformation()
3018 Current->MustBreakBefore = in calculateFormattingInformation()
3019 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
3020 if (!Current->MustBreakBefore && InFunctionDecl && in calculateFormattingInformation()
3021 Current->is(TT_FunctionDeclarationName)) { in calculateFormattingInformation()
3022 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
3026 Current->CanBreakBefore = in calculateFormattingInformation()
3027 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
3034 if (Current->MustBreakBefore || Prev->Children.size() > 1 || in calculateFormattingInformation()
3037 Current->IsMultiline) { in calculateFormattingInformation()
3038 Current->TotalLength = Prev->TotalLength + Style.ColumnLimit; in calculateFormattingInformation()
3040 Current->TotalLength = Prev->TotalLength + Current->ColumnWidth + in calculateFormattingInformation()
3041 ChildSize + Current->SpacesRequiredBefore; in calculateFormattingInformation()
3044 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
3056 Current->SplitPenalty = splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
3058 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
3059 if (Current->ParameterIndex == 1) in calculateFormattingInformation()
3060 Current->SplitPenalty += 5 * Current->BindingStrength; in calculateFormattingInformation()
3062 Current->SplitPenalty += 20 * Current->BindingStrength; in calculateFormattingInformation()
3065 Current = Current->Next; in calculateFormattingInformation()
3070 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
3071 if (Current->Role) in calculateFormattingInformation()
3072 Current->Role->precomputeFormattingInfos(Current); in calculateFormattingInformation()
3073 if (Current->MatchingParen && in calculateFormattingInformation()
3074 Current->MatchingParen->opensBlockOrBlockTypeList(Style) && in calculateFormattingInformation()
3078 Current->IndentLevel = IndentLevel; in calculateFormattingInformation()
3079 if (Current->opensBlockOrBlockTypeList(Style)) in calculateFormattingInformation()
3089 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths() local
3090 while (Current) { in calculateUnbreakableTailLengths()
3091 Current->UnbreakableTailLength = UnbreakableTailLength; in calculateUnbreakableTailLengths()
3092 if (Current->CanBreakBefore || in calculateUnbreakableTailLengths()
3093 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
3097 Current->ColumnWidth + Current->SpacesRequiredBefore; in calculateUnbreakableTailLengths()
3099 Current = Current->Previous; in calculateUnbreakableTailLengths()