Lines Matching refs:Current

629   void updateParameterCount(FormatToken *Left, FormatToken *Current) {  in updateParameterCount()  argument
633 if (Current->is(tok::l_brace) && Current->BlockKind == BK_Block) in updateParameterCount()
635 if (Current->is(tok::comma)) { in updateParameterCount()
639 Left->Role->CommaFound(Current); in updateParameterCount()
640 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
1203 void modifyContext(const FormatToken &Current) { in modifyContext() argument
1204 if (Current.getPrecedence() == prec::Assignment && in modifyContext()
1212 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { in modifyContext()
1215 for (FormatToken *Previous = Current.Previous; in modifyContext()
1232 } else if (Current.is(tok::lessless) && in modifyContext()
1233 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1235 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
1237 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1239 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
1241 } else if (Current.Previous && in modifyContext()
1242 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1245 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1247 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
1248 for (FormatToken *Previous = Current.Previous; in modifyContext()
1254 } else if (Current.is(tok::kw_new)) { in modifyContext()
1256 } else if (Current.isOneOf(tok::semi, tok::exclaim)) { in modifyContext()
1262 void determineTokenType(FormatToken &Current) { in determineTokenType() argument
1263 if (!Current.is(TT_Unknown)) in determineTokenType()
1268 if (Current.is(tok::exclaim)) { in determineTokenType()
1269 if (Current.Previous && in determineTokenType()
1270 (Current.Previous->isOneOf(tok::identifier, tok::kw_namespace, in determineTokenType()
1273 Current.Previous->Tok.isLiteral())) { in determineTokenType()
1274 Current.Type = TT_JsNonNullAssertion; in determineTokenType()
1277 if (Current.Next && in determineTokenType()
1278 Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) { in determineTokenType()
1279 Current.Type = TT_JsNonNullAssertion; in determineTokenType()
1288 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
1289 Current.Type = TT_BinaryOperator; in determineTokenType()
1290 } else if (isStartOfName(Current) && in determineTokenType()
1291 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
1292 Contexts.back().FirstStartOfName = &Current; in determineTokenType()
1293 Current.Type = TT_StartOfName; in determineTokenType()
1294 } else if (Current.is(tok::semi)) { in determineTokenType()
1299 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
1301 } else if (Current.is(tok::arrow) && in determineTokenType()
1303 Current.Type = TT_LambdaArrow; in determineTokenType()
1304 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1305 Current.NestingLevel == 0) { in determineTokenType()
1306 Current.Type = TT_TrailingReturnArrow; in determineTokenType()
1307 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1308 Current.Type = determineStarAmpUsage(Current, in determineTokenType()
1312 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
1313 Current.Type = determinePlusMinusCaretUsage(Current); in determineTokenType()
1314 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1316 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1317 Current.Type = determineIncrementUsage(Current); in determineTokenType()
1318 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1319 Current.Type = TT_UnaryOperator; in determineTokenType()
1320 } else if (Current.is(tok::question)) { in determineTokenType()
1325 Current.Type = TT_JsTypeOptionalQuestion; in determineTokenType()
1327 Current.Type = TT_ConditionalExpr; in determineTokenType()
1329 } else if (Current.isBinaryOperator() && in determineTokenType()
1330 (!Current.Previous || Current.Previous->isNot(tok::l_square)) && in determineTokenType()
1331 (!Current.is(tok::greater) && in determineTokenType()
1333 Current.Type = TT_BinaryOperator; in determineTokenType()
1334 } else if (Current.is(tok::comment)) { in determineTokenType()
1335 if (Current.TokenText.startswith("/*")) { in determineTokenType()
1336 if (Current.TokenText.endswith("*/")) in determineTokenType()
1337 Current.Type = TT_BlockComment; in determineTokenType()
1341 Current.Tok.setKind(tok::unknown); in determineTokenType()
1343 Current.Type = TT_LineComment; in determineTokenType()
1345 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1346 if (rParenEndsCast(Current)) in determineTokenType()
1347 Current.Type = TT_CastRParen; in determineTokenType()
1348 if (Current.MatchingParen && Current.Next && in determineTokenType()
1349 !Current.Next->isBinaryOperator() && in determineTokenType()
1350 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1353 if (FormatToken *AfterParen = Current.MatchingParen->Next) { in determineTokenType()
1356 if (FormatToken *BeforeParen = Current.MatchingParen->Previous) in determineTokenType()
1361 Current.Type = TT_FunctionAnnotationRParen; in determineTokenType()
1364 } else if (Current.is(tok::at) && Current.Next && in determineTokenType()
1369 switch (Current.Next->Tok.getObjCKeywordID()) { in determineTokenType()
1373 Current.Type = TT_ObjCDecl; in determineTokenType()
1376 Current.Type = TT_ObjCProperty; in determineTokenType()
1381 } else if (Current.is(tok::period)) { in determineTokenType()
1382 FormatToken *PreviousNoComment = Current.getPreviousNonComment(); in determineTokenType()
1385 Current.Type = TT_DesignatedInitializerPeriod; in determineTokenType()
1386 else if (Style.Language == FormatStyle::LK_Java && Current.Previous && in determineTokenType()
1387 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1389 Current.Type = Current.Previous->Type; in determineTokenType()
1391 } else if (canBeObjCSelectorComponent(Current) && in determineTokenType()
1393 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
1394 Current.Previous->MatchingParen && in determineTokenType()
1395 Current.Previous->MatchingParen->Previous && in determineTokenType()
1396 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
1401 Current.Type = TT_SelectorName; in determineTokenType()
1402 } else if (Current.isOneOf(tok::identifier, tok::kw_const) && in determineTokenType()
1403 Current.Previous && in determineTokenType()
1404 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
1408 Current.Type = TT_TrailingAnnotation; in determineTokenType()
1411 Current.Previous) { in determineTokenType()
1412 if (Current.Previous->is(tok::at) && in determineTokenType()
1413 Current.isNot(Keywords.kw_interface)) { in determineTokenType()
1414 const FormatToken &AtToken = *Current.Previous; in determineTokenType()
1417 Current.Type = TT_LeadingJavaAnnotation; in determineTokenType()
1419 Current.Type = TT_JavaAnnotation; in determineTokenType()
1420 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1421 Current.Previous->isOneOf(TT_JavaAnnotation, in determineTokenType()
1423 Current.Type = Current.Previous->Type; in determineTokenType()
1700 : Style(Style), Keywords(Keywords), Current(Line.First) {} in ExpressionParser()
1706 while (Current && (Current->is(tok::kw_return) || in parse()
1707 (Current->is(tok::colon) && in parse()
1708 Current->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral)))) in parse()
1711 if (!Current || Precedence > PrecedenceArrowAndPeriod) in parse()
1727 FormatToken *Start = Current; in parse()
1731 while (Current) { in parse()
1737 if (Current && Current->is(TT_SelectorName) && in parse()
1741 Start = Current; in parse()
1746 if (!Current || in parse()
1747 (Current->closesScope() && in parse()
1748 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
1751 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
1756 if (Current->opensScope()) { in parse()
1759 while (Current && (!Current->closesScope() || Current->opensScope())) { in parse()
1768 LatestOperator->NextOperator = Current; in parse()
1769 LatestOperator = Current; in parse()
1770 Current->OperatorIndex = OperatorIndex; in parse()
1777 if (LatestOperator && (Current || Precedence > 0)) { in parse()
1792 if (Current) { in getCurrentPrecedence()
1793 const FormatToken *NextNonComment = Current->getNextNonComment(); in getCurrentPrecedence()
1794 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
1796 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
1802 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
1804 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
1806 if (Current->is(TT_JsFatArrow)) in getCurrentPrecedence()
1808 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) || in getCurrentPrecedence()
1809 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
1812 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
1816 Current->is(Keywords.kw_instanceof)) in getCurrentPrecedence()
1819 Current->isOneOf(Keywords.kw_in, Keywords.kw_as)) in getCurrentPrecedence()
1821 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
1822 return Current->getPrecedence(); in getCurrentPrecedence()
1823 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
1827 Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements, in getCurrentPrecedence()
1838 if (Current) { in addFakeParenthesis()
1839 FormatToken *Previous = Current->Previous; in addFakeParenthesis()
1852 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
1853 Tokens.push_back(Current); in parseUnaryOperator()
1863 while (Current && Current->isTrailingComment()) { in parseConditionalExpr()
1866 FormatToken *Start = Current; in parseConditionalExpr()
1868 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
1872 if (!Current || Current->isNot(TT_ConditionalExpr)) in parseConditionalExpr()
1880 if (Current) in next()
1881 Current = Current->Next; in next()
1882 while (Current && in next()
1883 (Current->NewlinesBefore == 0 || SkipPastLeadingComments) && in next()
1884 Current->isTrailingComment()) in next()
1885 Current = Current->Next; in next()
1890 FormatToken *Current; member in clang::format::__anon963563180111::ExpressionParser
1971 static bool isFunctionDeclarationName(const FormatToken &Current, in isFunctionDeclarationName() argument
1993 const FormatToken *Next = Current.Next; in isFunctionDeclarationName()
1994 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
1995 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
1999 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
2083 FormatToken *Current = Line.First->Next; in calculateFormattingInformation() local
2085 while (Current) { in calculateFormattingInformation()
2086 if (isFunctionDeclarationName(*Current, Line)) in calculateFormattingInformation()
2087 Current->Type = TT_FunctionDeclarationName; in calculateFormattingInformation()
2088 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
2089 if (Current->Previous->BlockKind == BK_BracedInit && in calculateFormattingInformation()
2090 Current->Previous->opensScope()) in calculateFormattingInformation()
2091 Current->SpacesRequiredBefore = Style.Cpp11BracedListStyle ? 0 : 1; in calculateFormattingInformation()
2093 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments; in calculateFormattingInformation()
2102 if (!Current->HasUnescapedNewline) { in calculateFormattingInformation()
2103 for (FormatToken *Parameter = Current->Previous; Parameter; in calculateFormattingInformation()
2115 } else if (Current->SpacesRequiredBefore == 0 && in calculateFormattingInformation()
2116 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
2117 Current->SpacesRequiredBefore = 1; in calculateFormattingInformation()
2120 Current->MustBreakBefore = in calculateFormattingInformation()
2121 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
2123 if (!Current->MustBreakBefore && InFunctionDecl && in calculateFormattingInformation()
2124 Current->is(TT_FunctionDeclarationName)) in calculateFormattingInformation()
2125 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
2127 Current->CanBreakBefore = in calculateFormattingInformation()
2128 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
2130 if (Current->Previous->Children.size() == 1) { in calculateFormattingInformation()
2131 FormatToken &LastOfChild = *Current->Previous->Children[0]->Last; in calculateFormattingInformation()
2135 const FormatToken *Prev = Current->Previous; in calculateFormattingInformation()
2136 if (Current->MustBreakBefore || Prev->Children.size() > 1 || in calculateFormattingInformation()
2139 Current->IsMultiline) in calculateFormattingInformation()
2140 Current->TotalLength = Prev->TotalLength + Style.ColumnLimit; in calculateFormattingInformation()
2142 Current->TotalLength = Prev->TotalLength + Current->ColumnWidth + in calculateFormattingInformation()
2143 ChildSize + Current->SpacesRequiredBefore; in calculateFormattingInformation()
2145 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
2157 Current->SplitPenalty = splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
2159 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
2160 if (Current->ParameterIndex == 1) in calculateFormattingInformation()
2161 Current->SplitPenalty += 5 * Current->BindingStrength; in calculateFormattingInformation()
2163 Current->SplitPenalty += 20 * Current->BindingStrength; in calculateFormattingInformation()
2166 Current = Current->Next; in calculateFormattingInformation()
2171 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
2172 if (Current->Role) in calculateFormattingInformation()
2173 Current->Role->precomputeFormattingInfos(Current); in calculateFormattingInformation()
2174 if (Current->MatchingParen && in calculateFormattingInformation()
2175 Current->MatchingParen->opensBlockOrBlockTypeList(Style)) { in calculateFormattingInformation()
2179 Current->IndentLevel = IndentLevel; in calculateFormattingInformation()
2180 if (Current->opensBlockOrBlockTypeList(Style)) in calculateFormattingInformation()
2189 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths() local
2190 while (Current) { in calculateUnbreakableTailLengths()
2191 Current->UnbreakableTailLength = UnbreakableTailLength; in calculateUnbreakableTailLengths()
2192 if (Current->CanBreakBefore || in calculateUnbreakableTailLengths()
2193 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
2197 Current->ColumnWidth + Current->SpacesRequiredBefore; in calculateUnbreakableTailLengths()
2199 Current = Current->Previous; in calculateUnbreakableTailLengths()