Lines Matching refs:Current

826   void updateParameterCount(FormatToken *Left, FormatToken *Current) {  in updateParameterCount()  argument
830 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
832 if (Current->is(tok::comma)) { in updateParameterCount()
836 Left->Role->CommaFound(Current); in updateParameterCount()
837 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
1491 void modifyContext(const FormatToken &Current) { in modifyContext() argument
1492 if (Current.getPrecedence() == prec::Assignment && in modifyContext()
1500 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { in modifyContext()
1503 for (FormatToken *Previous = Current.Previous; in modifyContext()
1520 } else if (Current.is(tok::lessless) && in modifyContext()
1521 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1523 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
1525 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1527 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
1529 } else if (Current.Previous && in modifyContext()
1530 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1533 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1535 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
1536 for (FormatToken *Previous = Current.Previous; in modifyContext()
1542 } else if (Current.is(tok::kw_new)) { in modifyContext()
1544 } else if (Current.is(tok::semi) || in modifyContext()
1545 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1546 !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1554 static FormatToken *untilMatchingParen(FormatToken *Current) { in untilMatchingParen() argument
1557 while (Current) { in untilMatchingParen()
1558 if (Current->is(tok::l_paren)) in untilMatchingParen()
1560 if (Current->is(tok::r_paren)) in untilMatchingParen()
1564 Current = Current->Next; in untilMatchingParen()
1566 return Current; in untilMatchingParen()
1569 static bool isDeductionGuide(FormatToken &Current) { in isDeductionGuide() argument
1571 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1572 Current.startsSequence(tok::arrow, tok::identifier, tok::less)) { in isDeductionGuide()
1574 FormatToken *TemplateCloser = Current.Next->Next; in isDeductionGuide()
1594 Current.Previous->MatchingParen) { in isDeductionGuide()
1598 Current.Previous->MatchingParen->Previous; in isDeductionGuide()
1611 LeadingIdentifier->TokenText == Current.Next->TokenText); in isDeductionGuide()
1618 void determineTokenType(FormatToken &Current) { in determineTokenType() argument
1619 if (!Current.is(TT_Unknown)) in determineTokenType()
1624 Current.is(tok::exclaim)) { in determineTokenType()
1625 if (Current.Previous) { in determineTokenType()
1629 *Current.Previous, /* AcceptIdentifierName= */ true) in determineTokenType()
1630 : Current.Previous->is(tok::identifier); in determineTokenType()
1632 Current.Previous->isOneOf( in determineTokenType()
1636 Current.Previous->Tok.isLiteral()) { in determineTokenType()
1637 Current.setType(TT_NonNullAssertion); in determineTokenType()
1641 if (Current.Next && in determineTokenType()
1642 Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) { in determineTokenType()
1643 Current.setType(TT_NonNullAssertion); in determineTokenType()
1651 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
1652 Current.setType(TT_BinaryOperator); in determineTokenType()
1653 } else if (isStartOfName(Current) && in determineTokenType()
1654 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
1655 Contexts.back().FirstStartOfName = &Current; in determineTokenType()
1656 Current.setType(TT_StartOfName); in determineTokenType()
1657 } else if (Current.is(tok::semi)) { in determineTokenType()
1662 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
1664 } else if (Current.is(tok::arrow) && in determineTokenType()
1666 Current.setType(TT_LambdaArrow); in determineTokenType()
1667 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1668 Current.NestingLevel == 0 && in determineTokenType()
1669 !Current.Previous->is(tok::kw_operator)) { in determineTokenType()
1671 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1672 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
1673 Current.Previous->is(tok::r_brace)) { in determineTokenType()
1676 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1677 } else if (isDeductionGuide(Current)) { in determineTokenType()
1679 Current.setType(TT_TrailingReturnArrow); in determineTokenType()
1680 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1681 Current.setType(determineStarAmpUsage( in determineTokenType()
1682 Current, in determineTokenType()
1685 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
1686 Current.setType(determinePlusMinusCaretUsage(Current)); in determineTokenType()
1687 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1689 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1690 Current.setType(determineIncrementUsage(Current)); in determineTokenType()
1691 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1692 Current.setType(TT_UnaryOperator); in determineTokenType()
1693 } else if (Current.is(tok::question)) { in determineTokenType()
1698 Current.setType(TT_JsTypeOptionalQuestion); in determineTokenType()
1700 Current.setType(TT_ConditionalExpr); in determineTokenType()
1702 } else if (Current.isBinaryOperator() && in determineTokenType()
1703 (!Current.Previous || Current.Previous->isNot(tok::l_square)) && in determineTokenType()
1704 (!Current.is(tok::greater) && in determineTokenType()
1706 Current.setType(TT_BinaryOperator); in determineTokenType()
1707 } else if (Current.is(tok::comment)) { in determineTokenType()
1708 if (Current.TokenText.startswith("/*")) { in determineTokenType()
1709 if (Current.TokenText.endswith("*/")) in determineTokenType()
1710 Current.setType(TT_BlockComment); in determineTokenType()
1714 Current.Tok.setKind(tok::unknown); in determineTokenType()
1716 Current.setType(TT_LineComment); in determineTokenType()
1718 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1719 if (rParenEndsCast(Current)) in determineTokenType()
1720 Current.setType(TT_CastRParen); in determineTokenType()
1721 if (Current.MatchingParen && Current.Next && in determineTokenType()
1722 !Current.Next->isBinaryOperator() && in determineTokenType()
1723 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1726 if (FormatToken *AfterParen = Current.MatchingParen->Next) { in determineTokenType()
1729 if (FormatToken *BeforeParen = Current.MatchingParen->Previous) in determineTokenType()
1735 Current.setType(TT_FunctionAnnotationRParen); in determineTokenType()
1738 } else if (Current.is(tok::at) && Current.Next && in determineTokenType()
1743 switch (Current.Next->Tok.getObjCKeywordID()) { in determineTokenType()
1747 Current.setType(TT_ObjCDecl); in determineTokenType()
1750 Current.setType(TT_ObjCProperty); in determineTokenType()
1755 } else if (Current.is(tok::period)) { in determineTokenType()
1756 FormatToken *PreviousNoComment = Current.getPreviousNonComment(); in determineTokenType()
1759 Current.setType(TT_DesignatedInitializerPeriod); in determineTokenType()
1760 else if (Style.Language == FormatStyle::LK_Java && Current.Previous && in determineTokenType()
1761 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1763 Current.setType(Current.Previous->getType()); in determineTokenType()
1765 } else if (canBeObjCSelectorComponent(Current) && in determineTokenType()
1768 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
1769 Current.Previous->MatchingParen && in determineTokenType()
1770 Current.Previous->MatchingParen->Previous && in determineTokenType()
1771 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
1776 Current.setType(TT_SelectorName); in determineTokenType()
1777 } else if (Current.isOneOf(tok::identifier, tok::kw_const, tok::kw_noexcept, in determineTokenType()
1779 Current.Previous && in determineTokenType()
1780 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
1784 Current.setType(TT_TrailingAnnotation); in determineTokenType()
1787 Current.Previous) { in determineTokenType()
1788 if (Current.Previous->is(tok::at) && in determineTokenType()
1789 Current.isNot(Keywords.kw_interface)) { in determineTokenType()
1790 const FormatToken &AtToken = *Current.Previous; in determineTokenType()
1793 Current.setType(TT_LeadingJavaAnnotation); in determineTokenType()
1795 Current.setType(TT_JavaAnnotation); in determineTokenType()
1796 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1797 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1799 Current.setType(Current.Previous->getType()); in determineTokenType()
2127 : Style(Style), Keywords(Keywords), Current(Line.First) {} in ExpressionParser()
2133 while (Current && (Current->is(tok::kw_return) || in parse()
2134 (Current->is(tok::colon) && in parse()
2135 Current->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral)))) in parse()
2138 if (!Current || Precedence > PrecedenceArrowAndPeriod) in parse()
2154 FormatToken *Start = Current; in parse()
2158 while (Current) { in parse()
2164 if (Current && Current->is(TT_SelectorName) && in parse()
2168 Start = Current; in parse()
2173 if (!Current || in parse()
2174 (Current->closesScope() && in parse()
2175 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
2178 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2183 if (Current->opensScope()) { in parse()
2186 while (Current && (!Current->closesScope() || Current->opensScope())) { in parse()
2195 LatestOperator->NextOperator = Current; in parse()
2196 LatestOperator = Current; in parse()
2197 Current->OperatorIndex = OperatorIndex; in parse()
2204 if (LatestOperator && (Current || Precedence > 0)) { in parse()
2219 if (Current) { in getCurrentPrecedence()
2220 const FormatToken *NextNonComment = Current->getNextNonComment(); in getCurrentPrecedence()
2221 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
2223 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
2229 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
2231 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
2233 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
2235 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) || in getCurrentPrecedence()
2236 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2239 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
2243 Current->is(Keywords.kw_instanceof)) in getCurrentPrecedence()
2246 Current->isOneOf(Keywords.kw_in, Keywords.kw_as)) in getCurrentPrecedence()
2248 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2249 return Current->getPrecedence(); in getCurrentPrecedence()
2250 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
2254 Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements, in getCurrentPrecedence()
2265 if (Current) { in addFakeParenthesis()
2266 FormatToken *Previous = Current->Previous; in addFakeParenthesis()
2279 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
2280 Tokens.push_back(Current); in parseUnaryOperator()
2290 while (Current && Current->isTrailingComment()) { in parseConditionalExpr()
2293 FormatToken *Start = Current; in parseConditionalExpr()
2295 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
2299 if (!Current || Current->isNot(TT_ConditionalExpr)) in parseConditionalExpr()
2307 if (Current) in next()
2308 Current = Current->Next; in next()
2309 while (Current && in next()
2310 (Current->NewlinesBefore == 0 || SkipPastLeadingComments) && in next()
2311 Current->isTrailingComment()) in next()
2312 Current = Current->Next; in next()
2317 FormatToken *Current; member in clang::format::__anone3ff8e3d0111::ExpressionParser
2401 static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current, in isFunctionDeclarationName() argument
2438 const FormatToken *Next = Current.Next; in isFunctionDeclarationName()
2439 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
2440 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
2444 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
2545 FormatToken *Current = Line.First->Next; in calculateFormattingInformation() local
2553 while (Current) { in calculateFormattingInformation()
2554 if (isFunctionDeclarationName(Style.isCpp(), *Current, Line)) in calculateFormattingInformation()
2555 Current->setType(TT_FunctionDeclarationName); in calculateFormattingInformation()
2556 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
2557 if (Current->Previous->is(BK_BracedInit) && in calculateFormattingInformation()
2558 Current->Previous->opensScope()) in calculateFormattingInformation()
2559 Current->SpacesRequiredBefore = in calculateFormattingInformation()
2562 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments; in calculateFormattingInformation()
2571 if (!Current->HasUnescapedNewline) { in calculateFormattingInformation()
2572 for (FormatToken *Parameter = Current->Previous; Parameter; in calculateFormattingInformation()
2584 } else if (Current->SpacesRequiredBefore == 0 && in calculateFormattingInformation()
2585 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
2586 Current->SpacesRequiredBefore = 1; in calculateFormattingInformation()
2589 Current->MustBreakBefore = in calculateFormattingInformation()
2590 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
2592 if (!Current->MustBreakBefore && InFunctionDecl && in calculateFormattingInformation()
2593 Current->is(TT_FunctionDeclarationName)) in calculateFormattingInformation()
2594 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
2596 Current->CanBreakBefore = in calculateFormattingInformation()
2597 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
2599 if (Current->Previous->Children.size() == 1) { in calculateFormattingInformation()
2600 FormatToken &LastOfChild = *Current->Previous->Children[0]->Last; in calculateFormattingInformation()
2604 const FormatToken *Prev = Current->Previous; in calculateFormattingInformation()
2605 if (Current->MustBreakBefore || Prev->Children.size() > 1 || in calculateFormattingInformation()
2608 Current->IsMultiline) in calculateFormattingInformation()
2609 Current->TotalLength = Prev->TotalLength + Style.ColumnLimit; in calculateFormattingInformation()
2611 Current->TotalLength = Prev->TotalLength + Current->ColumnWidth + in calculateFormattingInformation()
2612 ChildSize + Current->SpacesRequiredBefore; in calculateFormattingInformation()
2614 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
2626 Current->SplitPenalty = splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
2628 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
2629 if (Current->ParameterIndex == 1) in calculateFormattingInformation()
2630 Current->SplitPenalty += 5 * Current->BindingStrength; in calculateFormattingInformation()
2632 Current->SplitPenalty += 20 * Current->BindingStrength; in calculateFormattingInformation()
2635 Current = Current->Next; in calculateFormattingInformation()
2640 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
2641 if (Current->Role) in calculateFormattingInformation()
2642 Current->Role->precomputeFormattingInfos(Current); in calculateFormattingInformation()
2643 if (Current->MatchingParen && in calculateFormattingInformation()
2644 Current->MatchingParen->opensBlockOrBlockTypeList(Style)) { in calculateFormattingInformation()
2648 Current->IndentLevel = IndentLevel; in calculateFormattingInformation()
2649 if (Current->opensBlockOrBlockTypeList(Style)) in calculateFormattingInformation()
2658 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths() local
2659 while (Current) { in calculateUnbreakableTailLengths()
2660 Current->UnbreakableTailLength = UnbreakableTailLength; in calculateUnbreakableTailLengths()
2661 if (Current->CanBreakBefore || in calculateUnbreakableTailLengths()
2662 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
2666 Current->ColumnWidth + Current->SpacesRequiredBefore; in calculateUnbreakableTailLengths()
2668 Current = Current->Previous; in calculateUnbreakableTailLengths()