Lines Matching refs:Current
392 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
393 if (Current->is(tok::l_brace) && !Current->is(TT_DictLiteral)) in updateParameterCount()
395 if (Current->is(tok::comma)) { in updateParameterCount()
399 Left->Role->CommaFound(Current); in updateParameterCount()
400 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
832 void modifyContext(const FormatToken &Current) { in modifyContext() argument
833 if (Current.getPrecedence() == prec::Assignment && in modifyContext()
835 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { in modifyContext()
838 for (FormatToken *Previous = Current.Previous; in modifyContext()
855 } else if (Current.is(tok::lessless) && in modifyContext()
856 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
858 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
860 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
862 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
864 } else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration && in modifyContext()
866 (!Current.Previous || in modifyContext()
867 Current.Previous->isNot(tok::kw_decltype))) { in modifyContext()
869 Current.Previous && Current.Previous->is(tok::r_paren) && in modifyContext()
870 Current.Previous->MatchingParen && in modifyContext()
871 Current.Previous->MatchingParen->is(TT_FunctionTypeLParen); in modifyContext()
872 bool IsForOrCatch = Current.Previous && in modifyContext()
873 Current.Previous->isOneOf(tok::kw_for, tok::kw_catch); in modifyContext()
875 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
876 for (FormatToken *Previous = Current.Previous; in modifyContext()
882 } else if (Current.Previous && in modifyContext()
883 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
886 } else if (Current.is(tok::kw_new)) { in modifyContext()
888 } else if (Current.isOneOf(tok::semi, tok::exclaim)) { in modifyContext()
894 void determineTokenType(FormatToken &Current) { in determineTokenType() argument
895 if (!Current.is(TT_Unknown)) in determineTokenType()
902 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
903 Current.Type = TT_BinaryOperator; in determineTokenType()
904 } else if (isStartOfName(Current) && in determineTokenType()
905 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
906 Contexts.back().FirstStartOfName = &Current; in determineTokenType()
907 Current.Type = TT_StartOfName; in determineTokenType()
908 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
910 } else if (Current.is(tok::arrow) && in determineTokenType()
912 Current.Type = TT_LambdaArrow; in determineTokenType()
913 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
914 Current.NestingLevel == 0) { in determineTokenType()
915 Current.Type = TT_TrailingReturnArrow; in determineTokenType()
916 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
917 Current.Type = in determineTokenType()
918 determineStarAmpUsage(Current, Contexts.back().CanBeExpression && in determineTokenType()
921 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
922 Current.Type = determinePlusMinusCaretUsage(Current); in determineTokenType()
923 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
925 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
926 Current.Type = determineIncrementUsage(Current); in determineTokenType()
927 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
928 Current.Type = TT_UnaryOperator; in determineTokenType()
929 } else if (Current.is(tok::question)) { in determineTokenType()
934 Current.Type = TT_JsTypeOptionalQuestion; in determineTokenType()
936 Current.Type = TT_ConditionalExpr; in determineTokenType()
938 } else if (Current.isBinaryOperator() && in determineTokenType()
939 (!Current.Previous || Current.Previous->isNot(tok::l_square))) { in determineTokenType()
940 Current.Type = TT_BinaryOperator; in determineTokenType()
941 } else if (Current.is(tok::comment)) { in determineTokenType()
942 if (Current.TokenText.startswith("/*")) { in determineTokenType()
943 if (Current.TokenText.endswith("*/")) in determineTokenType()
944 Current.Type = TT_BlockComment; in determineTokenType()
948 Current.Tok.setKind(tok::unknown); in determineTokenType()
950 Current.Type = TT_LineComment; in determineTokenType()
952 } else if (Current.is(tok::r_paren)) { in determineTokenType()
953 if (rParenEndsCast(Current)) in determineTokenType()
954 Current.Type = TT_CastRParen; in determineTokenType()
955 if (Current.MatchingParen && Current.Next && in determineTokenType()
956 !Current.Next->isBinaryOperator() && in determineTokenType()
957 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace)) in determineTokenType()
958 if (FormatToken *BeforeParen = Current.MatchingParen->Previous) in determineTokenType()
963 Current.Type = TT_FunctionAnnotationRParen; in determineTokenType()
964 } else if (Current.is(tok::at) && Current.Next) { in determineTokenType()
965 if (Current.Next->isStringLiteral()) { in determineTokenType()
966 Current.Type = TT_ObjCStringLiteral; in determineTokenType()
968 switch (Current.Next->Tok.getObjCKeywordID()) { in determineTokenType()
972 Current.Type = TT_ObjCDecl; in determineTokenType()
975 Current.Type = TT_ObjCProperty; in determineTokenType()
981 } else if (Current.is(tok::period)) { in determineTokenType()
982 FormatToken *PreviousNoComment = Current.getPreviousNonComment(); in determineTokenType()
985 Current.Type = TT_DesignatedInitializerPeriod; in determineTokenType()
986 else if (Style.Language == FormatStyle::LK_Java && Current.Previous && in determineTokenType()
987 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
989 Current.Type = Current.Previous->Type; in determineTokenType()
991 } else if (Current.isOneOf(tok::identifier, tok::kw_const) && in determineTokenType()
992 Current.Previous && in determineTokenType()
993 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
997 Current.Type = TT_TrailingAnnotation; in determineTokenType()
1000 Current.Previous) { in determineTokenType()
1001 if (Current.Previous->is(tok::at) && in determineTokenType()
1002 Current.isNot(Keywords.kw_interface)) { in determineTokenType()
1003 const FormatToken &AtToken = *Current.Previous; in determineTokenType()
1006 Current.Type = TT_LeadingJavaAnnotation; in determineTokenType()
1008 Current.Type = TT_JavaAnnotation; in determineTokenType()
1009 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1010 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1012 Current.Type = Current.Previous->Type; in determineTokenType()
1274 : Style(Style), Keywords(Keywords), Current(Line.First) {} in ExpressionParser()
1280 while (Current && (Current->is(tok::kw_return) || in parse()
1281 (Current->is(tok::colon) && in parse()
1282 Current->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral)))) in parse()
1285 if (!Current || Precedence > PrecedenceArrowAndPeriod) in parse()
1301 FormatToken *Start = Current; in parse()
1305 while (Current) { in parse()
1311 if (Current && Current->is(TT_SelectorName) && in parse()
1315 Start = Current; in parse()
1320 if (!Current || (Current->closesScope() && Current->MatchingParen) || in parse()
1323 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
1328 if (Current->opensScope()) { in parse()
1329 while (Current && !Current->closesScope()) { in parse()
1337 LatestOperator = Current; in parse()
1338 Current->OperatorIndex = OperatorIndex; in parse()
1345 if (LatestOperator && (Current || Precedence > 0)) { in parse()
1360 if (Current) { in getCurrentPrecedence()
1361 const FormatToken *NextNonComment = Current->getNextNonComment(); in getCurrentPrecedence()
1362 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
1367 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
1369 if (Current->is(TT_JsFatArrow)) in getCurrentPrecedence()
1371 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName, in getCurrentPrecedence()
1373 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
1376 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
1380 Current->is(Keywords.kw_instanceof)) in getCurrentPrecedence()
1382 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
1383 return Current->getPrecedence(); in getCurrentPrecedence()
1384 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
1387 Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements, in getCurrentPrecedence()
1398 if (Current) { in addFakeParenthesis()
1399 FormatToken *Previous = Current->Previous; in addFakeParenthesis()
1411 if (!Current || Current->isNot(TT_UnaryOperator)) { in parseUnaryOperator()
1416 FormatToken *Start = Current; in parseUnaryOperator()
1425 while (Current && Current->isTrailingComment()) { in parseConditionalExpr()
1428 FormatToken *Start = Current; in parseConditionalExpr()
1430 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
1434 if (!Current || Current->isNot(TT_ConditionalExpr)) in parseConditionalExpr()
1442 if (Current) in next()
1443 Current = Current->Next; in next()
1444 while (Current && in next()
1445 (Current->NewlinesBefore == 0 || SkipPastLeadingComments) && in next()
1446 Current->isTrailingComment()) in next()
1447 Current = Current->Next; in next()
1452 FormatToken *Current; member in clang::format::__anon33531cb00111::ExpressionParser
1500 static bool isFunctionDeclarationName(const FormatToken &Current) { in isFunctionDeclarationName() argument
1520 const FormatToken *Next = Current.Next; in isFunctionDeclarationName()
1521 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
1522 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
1526 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
1599 FormatToken *Current = Line.First->Next; in calculateFormattingInformation() local
1601 while (Current) { in calculateFormattingInformation()
1602 if (isFunctionDeclarationName(*Current)) in calculateFormattingInformation()
1603 Current->Type = TT_FunctionDeclarationName; in calculateFormattingInformation()
1604 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
1605 if (Current->Previous->BlockKind == BK_BracedInit && in calculateFormattingInformation()
1606 Current->Previous->opensScope()) in calculateFormattingInformation()
1607 Current->SpacesRequiredBefore = Style.Cpp11BracedListStyle ? 0 : 1; in calculateFormattingInformation()
1609 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments; in calculateFormattingInformation()
1618 if (!Current->HasUnescapedNewline) { in calculateFormattingInformation()
1619 for (FormatToken *Parameter = Current->Previous; Parameter; in calculateFormattingInformation()
1631 } else if (Current->SpacesRequiredBefore == 0 && in calculateFormattingInformation()
1632 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
1633 Current->SpacesRequiredBefore = 1; in calculateFormattingInformation()
1636 Current->MustBreakBefore = in calculateFormattingInformation()
1637 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
1639 if (!Current->MustBreakBefore && InFunctionDecl && in calculateFormattingInformation()
1640 Current->is(TT_FunctionDeclarationName)) in calculateFormattingInformation()
1641 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
1643 Current->CanBreakBefore = in calculateFormattingInformation()
1644 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
1646 if (Current->Previous->Children.size() == 1) { in calculateFormattingInformation()
1647 FormatToken &LastOfChild = *Current->Previous->Children[0]->Last; in calculateFormattingInformation()
1651 const FormatToken *Prev = Current->Previous; in calculateFormattingInformation()
1652 if (Current->MustBreakBefore || Prev->Children.size() > 1 || in calculateFormattingInformation()
1655 Current->IsMultiline) in calculateFormattingInformation()
1656 Current->TotalLength = Prev->TotalLength + Style.ColumnLimit; in calculateFormattingInformation()
1658 Current->TotalLength = Prev->TotalLength + Current->ColumnWidth + in calculateFormattingInformation()
1659 ChildSize + Current->SpacesRequiredBefore; in calculateFormattingInformation()
1661 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
1667 Current->SplitPenalty = 20 * Current->BindingStrength + in calculateFormattingInformation()
1668 splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
1670 Current = Current->Next; in calculateFormattingInformation()
1674 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
1675 if (Current->Role) in calculateFormattingInformation()
1676 Current->Role->precomputeFormattingInfos(Current); in calculateFormattingInformation()
1684 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths() local
1685 while (Current) { in calculateUnbreakableTailLengths()
1686 Current->UnbreakableTailLength = UnbreakableTailLength; in calculateUnbreakableTailLengths()
1687 if (Current->CanBreakBefore || in calculateUnbreakableTailLengths()
1688 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
1692 Current->ColumnWidth + Current->SpacesRequiredBefore; in calculateUnbreakableTailLengths()
1694 Current = Current->Previous; in calculateUnbreakableTailLengths()