Lines Matching refs:tok

89   return FormatTok.is(tok::comment) && !FormatTok.TokenText.startswith("/*");  in isLineComment()
115 FakeEOF.Tok.setKind(tok::eof); in ScopedMacroState()
248 if (Position >= 0 && Tokens[Position]->is(tok::eof)) { in getNextToken()
286 bool isEOF() override { return Tokens[Position]->is(tok::eof); } in isEOF()
421 case tok::l_brace: in parseCSharpGenericTypeConstraint()
440 case tok::r_square: in parseCSharpAttribute()
448 case tok::l_square: in parseCSharpAttribute()
464 return Previous && Previous->is(tok::comment) && in precededByCommentOrPPDirective()
498 tok::TokenKind kind = FormatTok->Tok.getKind(); in parseLevel()
500 kind = tok::l_brace; in parseLevel()
502 kind = tok::r_brace; in parseLevel()
514 case tok::comment: in parseLevel()
518 case tok::l_brace: in parseLevel()
540 case tok::r_brace: in parseLevel()
546 if (FormatTok->isNot(tok::r_brace) || StatementCount != 1 || HasLabel || in parseLevel()
552 if (Next->is(tok::comment) && Next->NewlinesBefore == 0) in parseLevel()
561 case tok::kw_default: { in parseLevel()
567 } while (Next->is(tok::comment)); in parseLevel()
569 if (Next->isNot(tok::colon)) { in parseLevel()
578 case tok::kw_case: in parseLevel()
592 case tok::l_square: in parseLevel()
622 assert(Tok->is(tok::l_brace)); in calculateBraceTypes()
628 } while (NextTok->is(tok::comment)); in calculateBraceTypes()
631 case tok::l_brace: in calculateBraceTypes()
633 if (PrevTok->isOneOf(tok::colon, tok::less)) { in calculateBraceTypes()
644 } else if (PrevTok->is(tok::r_paren)) { in calculateBraceTypes()
653 case tok::r_brace: in calculateBraceTypes()
659 ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::r_square); in calculateBraceTypes()
664 while (NextTok->is(tok::hash)) { in calculateBraceTypes()
668 } while (NextTok->isNot(tok::eof)); in calculateBraceTypes()
673 bool NextIsObjCMethod = NextTok->isOneOf(tok::plus, tok::minus) && in calculateBraceTypes()
691 (Style.isCpp() && NextTok->is(tok::l_paren)); in calculateBraceTypes()
699 NextTok->isOneOf(tok::comma, tok::period, tok::colon, in calculateBraceTypes()
700 tok::r_paren, tok::r_square, tok::l_brace, in calculateBraceTypes()
701 tok::ellipsis); in calculateBraceTypes()
705 (NextTok->is(tok::identifier) && in calculateBraceTypes()
706 !PrevTok->isOneOf(tok::semi, tok::r_brace, tok::l_brace)); in calculateBraceTypes()
709 (NextTok->is(tok::semi) && in calculateBraceTypes()
716 if (!Style.isCSharp() && NextTok->is(tok::l_square)) { in calculateBraceTypes()
720 ProbablyBracedList = NextTok->isNot(tok::l_square); in calculateBraceTypes()
733 case tok::identifier: in calculateBraceTypes()
737 case tok::at: in calculateBraceTypes()
738 case tok::semi: in calculateBraceTypes()
739 case tok::kw_if: in calculateBraceTypes()
740 case tok::kw_while: in calculateBraceTypes()
741 case tok::kw_for: in calculateBraceTypes()
742 case tok::kw_switch: in calculateBraceTypes()
743 case tok::kw_try: in calculateBraceTypes()
744 case tok::kw___try: in calculateBraceTypes()
753 } while (Tok->isNot(tok::eof) && !LBraceStack.empty()); in calculateBraceTypes()
835 if (Style.isVerilog() && FormatTok->is(tok::colon)) { in parseBlock()
842 assert((FormatTok->isOneOf(tok::l_brace, TT_MacroBlockBegin) || in parseBlock()
846 const bool FollowedByComment = Tokens->peekNextToken()->is(tok::comment); in parseBlock()
866 if (MacroBlock && FormatTok->is(tok::l_paren)) in parseBlock()
896 : !FormatTok->is(tok::r_brace)) { in parseBlock()
906 assert(FormatTok->is(tok::r_brace)); in parseBlock()
916 if (Previous->is(tok::r_brace) && !Previous->Optional) in parseBlock()
943 if (MacroBlock && FormatTok->is(tok::l_paren)) in parseBlock()
946 if (FormatTok->is(tok::kw_noexcept)) { in parseBlock()
951 if (FormatTok->is(tok::arrow)) { in parseBlock()
958 if (MunchSemi && FormatTok->is(tok::semi)) in parseBlock()
984 if (I->Tok->isNot(tok::period)) in isGoogScope()
990 return I->Tok->is(tok::l_paren); in isGoogScope()
1002 if (I->Tok->isNot(tok::l_paren)) in isIIFE()
1008 return I->Tok->is(tok::l_paren); in isIIFE()
1013 tok::TokenKind Kind = InitialToken.Tok.getKind(); in ShouldBreakBeforeBrace()
1015 Kind = tok::kw_namespace; in ShouldBreakBeforeBrace()
1018 case tok::kw_namespace: in ShouldBreakBeforeBrace()
1020 case tok::kw_class: in ShouldBreakBeforeBrace()
1022 case tok::kw_union: in ShouldBreakBeforeBrace()
1024 case tok::kw_struct: in ShouldBreakBeforeBrace()
1026 case tok::kw_enum: in ShouldBreakBeforeBrace()
1035 assert(FormatTok->is(tok::l_brace)); in parseChildBlock()
1054 assert(FormatTok->is(tok::hash) && "'#' expected"); in parsePPDirective()
1065 case tok::pp_define: in parsePPDirective()
1068 case tok::pp_if: in parsePPDirective()
1071 case tok::pp_ifdef: in parsePPDirective()
1072 case tok::pp_ifndef: in parsePPDirective()
1075 case tok::pp_else: in parsePPDirective()
1078 case tok::pp_elifdef: in parsePPDirective()
1079 case tok::pp_elifndef: in parsePPDirective()
1080 case tok::pp_elif: in parsePPDirective()
1083 case tok::pp_endif: in parsePPDirective()
1144 bool IfNDef = FormatTok->is(tok::pp_ifndef); in parsePPIf()
1147 if (!IfDef && (FormatTok->is(tok::kw_false) || FormatTok->TokenText == "0")) in parsePPIf()
1158 if (!Line.Tokens.front().Tok->is(tok::comment)) { in parsePPIf()
1213 if (!Line.Tokens.front().Tok->isOneOf(tok::comment, tok::hash)) { in parsePPDefine()
1225 FormatTok->Tok.setKind(tok::identifier); in parsePPDefine()
1228 if (FormatTok->Tok.getKind() == tok::l_paren && in parsePPDefine()
1260 return Tok.isNot(tok::semi) && Tok.isNot(tok::l_brace) && in tokenCanStartNewLine()
1264 Tok.isNot(tok::period) && Tok.isNot(tok::periodstar) && in tokenCanStartNewLine()
1265 Tok.isNot(tok::arrow) && Tok.isNot(tok::arrowstar) && in tokenCanStartNewLine()
1266 Tok.isNot(tok::less) && Tok.isNot(tok::greater) && in tokenCanStartNewLine()
1267 Tok.isNot(tok::slash) && Tok.isNot(tok::percent) && in tokenCanStartNewLine()
1268 Tok.isNot(tok::lessless) && Tok.isNot(tok::greatergreater) && in tokenCanStartNewLine()
1269 Tok.isNot(tok::equal) && Tok.isNot(tok::plusequal) && in tokenCanStartNewLine()
1270 Tok.isNot(tok::minusequal) && Tok.isNot(tok::starequal) && in tokenCanStartNewLine()
1271 Tok.isNot(tok::slashequal) && Tok.isNot(tok::percentequal) && in tokenCanStartNewLine()
1272 Tok.isNot(tok::ampequal) && Tok.isNot(tok::pipeequal) && in tokenCanStartNewLine()
1273 Tok.isNot(tok::caretequal) && Tok.isNot(tok::greatergreaterequal) && in tokenCanStartNewLine()
1274 Tok.isNot(tok::lesslessequal) && in tokenCanStartNewLine()
1278 Tok.isNot(tok::colon) && in tokenCanStartNewLine()
1280 Tok.isNot(tok::kw_noexcept); in tokenCanStartNewLine()
1286 return FormatTok->is(tok::identifier) && in mustBeJSIdent()
1292 Keywords.kw_let, Keywords.kw_var, tok::kw_const, in mustBeJSIdent()
1301 FormatTok->isOneOf(tok::kw_true, tok::kw_false) || in mustBeJSIdentOrValue()
1310 tok::kw_return, Keywords.kw_yield, in isJSDeclOrStmt()
1312 tok::kw_if, tok::kw_else, in isJSDeclOrStmt()
1314 tok::kw_for, tok::kw_while, tok::kw_do, tok::kw_continue, tok::kw_break, in isJSDeclOrStmt()
1316 tok::kw_switch, tok::kw_case, in isJSDeclOrStmt()
1318 tok::kw_throw, tok::kw_try, tok::kw_catch, Keywords.kw_finally, in isJSDeclOrStmt()
1320 tok::kw_const, tok::kw_class, Keywords.kw_var, Keywords.kw_let, in isJSDeclOrStmt()
1323 Keywords.kw_import, tok::kw_export); in isJSDeclOrStmt()
1328 return Tok.isOneOf(tok::kw_char, tok::kw_short, tok::kw_int, tok::kw_long, in isC78Type()
1329 tok::kw_unsigned, tok::kw_float, tok::kw_double, in isC78Type()
1330 tok::identifier); in isC78Type()
1346 if (FuncName->isNot(tok::identifier)) in isC78ParameterDecl()
1350 if (!Prev || (Prev->isNot(tok::star) && !isC78Type(*Prev))) in isC78ParameterDecl()
1354 !Tok->isOneOf(tok::kw_register, tok::kw_struct, tok::kw_union)) { in isC78ParameterDecl()
1358 if (Next->isNot(tok::star) && !Next->Tok.getIdentifierInfo()) in isC78ParameterDecl()
1362 if (!Tok || Tok->isNot(tok::r_paren)) in isC78ParameterDecl()
1366 if (!Tok || Tok->isNot(tok::identifier)) in isC78ParameterDecl()
1369 return Tok->Previous && Tok->Previous->isOneOf(tok::l_paren, tok::comma); in isC78ParameterDecl()
1375 if (FormatTok->is(tok::colon)) { in parseModuleImport()
1379 else if (FormatTok->is(tok::less)) { in parseModuleImport()
1381 while (!FormatTok->isOneOf(tok::semi, tok::greater, tok::eof)) { in parseModuleImport()
1384 if (FormatTok->isNot(tok::comment) && in parseModuleImport()
1391 if (FormatTok->is(tok::semi)) { in parseModuleImport()
1423 if (PreviousMustBeValue || Previous->is(tok::r_paren)) { in readTokenWithJavaScriptASI()
1427 return LineNode.Tok->is(tok::at); in readTokenWithJavaScriptASI()
1432 if (Next->is(tok::exclaim) && PreviousMustBeValue) in readTokenWithJavaScriptASI()
1439 Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus, in readTokenWithJavaScriptASI()
1440 tok::minusminus))) { in readTokenWithJavaScriptASI()
1443 if ((PreviousMustBeValue || Previous->is(tok::r_paren)) && in readTokenWithJavaScriptASI()
1453 FormatTok->is(tok::pp_include)) { in parseStructuralElement()
1455 if (FormatTok->is(tok::string_literal)) in parseStructuralElement()
1461 case tok::kw_asm: in parseStructuralElement()
1463 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1466 while (FormatTok && FormatTok->isNot(tok::eof)) { in parseStructuralElement()
1467 if (FormatTok->is(tok::r_brace)) { in parseStructuralElement()
1478 case tok::kw_namespace: in parseStructuralElement()
1481 case tok::kw_public: in parseStructuralElement()
1482 case tok::kw_protected: in parseStructuralElement()
1483 case tok::kw_private: in parseStructuralElement()
1491 case tok::kw_if: { in parseStructuralElement()
1501 case tok::kw_for: in parseStructuralElement()
1502 case tok::kw_while: in parseStructuralElement()
1509 case tok::kw_do: in parseStructuralElement()
1518 case tok::kw_switch: in parseStructuralElement()
1525 case tok::kw_default: in parseStructuralElement()
1531 if (FormatTok->is(tok::colon)) { in parseStructuralElement()
1537 case tok::kw_case: in parseStructuralElement()
1545 case tok::kw_try: in parseStructuralElement()
1546 case tok::kw___try: in parseStructuralElement()
1553 case tok::kw_extern: in parseStructuralElement()
1555 if (FormatTok->is(tok::string_literal)) { in parseStructuralElement()
1557 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1575 case tok::kw_export: in parseStructuralElement()
1584 case tok::kw_inline: in parseStructuralElement()
1586 if (FormatTok->is(tok::kw_namespace)) { in parseStructuralElement()
1591 case tok::identifier: in parseStructuralElement()
1608 if (FormatTok->is(tok::kw_public)) in parseStructuralElement()
1610 if (!FormatTok->is(tok::string_literal)) in parseStructuralElement()
1613 if (FormatTok->is(tok::semi)) in parseStructuralElement()
1627 if (FormatTok->is(tok::colon)) { in parseStructuralElement()
1649 case tok::at: in parseStructuralElement()
1651 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1661 case tok::objc_public: in parseStructuralElement()
1662 case tok::objc_protected: in parseStructuralElement()
1663 case tok::objc_package: in parseStructuralElement()
1664 case tok::objc_private: in parseStructuralElement()
1666 case tok::objc_interface: in parseStructuralElement()
1667 case tok::objc_implementation: in parseStructuralElement()
1669 case tok::objc_protocol: in parseStructuralElement()
1673 case tok::objc_end: in parseStructuralElement()
1675 case tok::objc_optional: in parseStructuralElement()
1676 case tok::objc_required: in parseStructuralElement()
1680 case tok::objc_autoreleasepool: in parseStructuralElement()
1682 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1691 case tok::objc_synchronized: in parseStructuralElement()
1693 if (FormatTok->is(tok::l_paren)) { in parseStructuralElement()
1697 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1706 case tok::objc_try: in parseStructuralElement()
1715 case tok::kw_concept: in parseStructuralElement()
1718 case tok::kw_requires: { in parseStructuralElement()
1728 case tok::kw_enum: in parseStructuralElement()
1730 if (Previous && Previous->is(tok::less)) { in parseStructuralElement()
1745 case tok::kw_typedef: in parseStructuralElement()
1754 case tok::kw_struct: in parseStructuralElement()
1755 case tok::kw_union: in parseStructuralElement()
1756 case tok::kw_class: in parseStructuralElement()
1760 case tok::period: in parseStructuralElement()
1764 FormatTok->is(tok::kw_class)) { in parseStructuralElement()
1774 case tok::semi: in parseStructuralElement()
1778 case tok::r_brace: in parseStructuralElement()
1781 case tok::l_paren: { in parseStructuralElement()
1785 if (!IsTopLevel || !Style.isCpp() || !Previous || FormatTok->is(tok::eof)) in parseStructuralElement()
1793 case tok::kw_operator: in parseStructuralElement()
1798 case tok::caret: in parseStructuralElement()
1804 if (FormatTok->is(tok::l_paren)) in parseStructuralElement()
1806 if (FormatTok->is(tok::l_brace)) in parseStructuralElement()
1809 case tok::l_brace: in parseStructuralElement()
1837 case tok::kw_try: in parseStructuralElement()
1848 case tok::identifier: { in parseStructuralElement()
1915 while (I != E && I->Tok->is(tok::comment)) in parseStructuralElement()
1917 while (I != E && Style.isVerilog() && I->Tok->is(tok::hash)) in parseStructuralElement()
1922 if (FormatTok->is(tok::colon) && !Line->MustBeDeclaration) { in parseStructuralElement()
1931 bool FunctionLike = FormatTok->is(tok::l_paren); in parseStructuralElement()
1949 case tok::equal: in parseStructuralElement()
1957 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
1966 FormatTok->is(tok::less)) { in parseStructuralElement()
1969 /*ClosingBraceKind=*/tok::greater); in parseStructuralElement()
1972 case tok::l_square: in parseStructuralElement()
1975 case tok::kw_new: in parseStructuralElement()
1978 case tok::kw_case: in parseStructuralElement()
1994 assert(FormatTok->is(tok::l_brace)); in tryToParsePropertyAccessor()
1998 if (FormatTok->Previous->isNot(tok::identifier)) in tryToParsePropertyAccessor()
2015 if (Tok->isOneOf(tok::semi, tok::kw_public, tok::kw_private, in tryToParsePropertyAccessor()
2016 tok::kw_protected, Keywords.kw_internal, Keywords.kw_get, in tryToParsePropertyAccessor()
2023 if (Tok->isNot(tok::r_brace)) in tryToParsePropertyAccessor()
2041 case tok::r_brace: in tryToParsePropertyAccessor()
2043 if (FormatTok->is(tok::equal)) { in tryToParsePropertyAccessor()
2044 while (!eof() && FormatTok->isNot(tok::semi)) in tryToParsePropertyAccessor()
2050 case tok::l_brace: in tryToParsePropertyAccessor()
2056 case tok::equal: in tryToParsePropertyAccessor()
2061 } while (!eof() && FormatTok->isNot(tok::semi)); in tryToParsePropertyAccessor()
2085 assert(FormatTok->is(tok::l_square)); in tryToParseLambda()
2097 while (FormatTok->isNot(tok::l_brace)) { in tryToParseLambda()
2103 case tok::l_brace: in tryToParseLambda()
2105 case tok::l_paren: in tryToParseLambda()
2108 case tok::l_square: in tryToParseLambda()
2111 case tok::kw_class: in tryToParseLambda()
2112 case tok::kw_template: in tryToParseLambda()
2113 case tok::kw_typename: in tryToParseLambda()
2115 if (FormatTok->Previous->is(tok::less)) in tryToParseLambda()
2119 case tok::amp: in tryToParseLambda()
2120 case tok::star: in tryToParseLambda()
2121 case tok::kw_const: in tryToParseLambda()
2122 case tok::kw_constexpr: in tryToParseLambda()
2123 case tok::comma: in tryToParseLambda()
2124 case tok::less: in tryToParseLambda()
2125 case tok::greater: in tryToParseLambda()
2126 case tok::identifier: in tryToParseLambda()
2127 case tok::numeric_constant: in tryToParseLambda()
2128 case tok::coloncolon: in tryToParseLambda()
2129 case tok::kw_mutable: in tryToParseLambda()
2130 case tok::kw_noexcept: in tryToParseLambda()
2147 case tok::plus: in tryToParseLambda()
2148 case tok::minus: in tryToParseLambda()
2149 case tok::exclaim: in tryToParseLambda()
2150 case tok::tilde: in tryToParseLambda()
2151 case tok::slash: in tryToParseLambda()
2152 case tok::percent: in tryToParseLambda()
2153 case tok::lessless: in tryToParseLambda()
2154 case tok::pipe: in tryToParseLambda()
2155 case tok::pipepipe: in tryToParseLambda()
2156 case tok::ampamp: in tryToParseLambda()
2157 case tok::caret: in tryToParseLambda()
2158 case tok::equalequal: in tryToParseLambda()
2159 case tok::exclaimequal: in tryToParseLambda()
2160 case tok::greaterequal: in tryToParseLambda()
2161 case tok::lessequal: in tryToParseLambda()
2162 case tok::question: in tryToParseLambda()
2163 case tok::colon: in tryToParseLambda()
2164 case tok::ellipsis: in tryToParseLambda()
2165 case tok::kw_true: in tryToParseLambda()
2166 case tok::kw_false: in tryToParseLambda()
2172 case tok::arrow: in tryToParseLambda()
2195 (Previous->isOneOf(tok::identifier, tok::kw_operator, tok::kw_new, in tryToParseLambdaIntroducer()
2196 tok::kw_delete, tok::l_square) || in tryToParseLambdaIntroducer()
2201 if (FormatTok->is(tok::l_square)) in tryToParseLambdaIntroducer()
2203 if (FormatTok->is(tok::r_square)) { in tryToParseLambdaIntroducer()
2205 if (Next->is(tok::greater)) in tryToParseLambdaIntroducer()
2221 if (FormatTok->is(tok::star)) { in tryToParseJSFunction()
2227 if (FormatTok->is(tok::identifier)) in tryToParseJSFunction()
2230 if (FormatTok->isNot(tok::l_paren)) in tryToParseJSFunction()
2236 if (FormatTok->is(tok::colon)) { in tryToParseJSFunction()
2242 if (FormatTok->is(tok::l_brace)) in tryToParseJSFunction()
2245 while (!FormatTok->isOneOf(tok::l_brace, tok::semi) && !eof()) in tryToParseJSFunction()
2249 if (FormatTok->is(tok::semi)) in tryToParseJSFunction()
2273 if (FormatTok->isNot(tok::l_brace)) in tryToParseChildBlock()
2281 tok::TokenKind ClosingBraceKind) { in parseBracedList()
2297 if (FormatTok->is(tok::l_brace)) { in parseBracedList()
2311 case tok::l_square: in parseBracedList()
2317 case tok::l_paren: in parseBracedList()
2322 if (FormatTok->is(tok::l_brace)) in parseBracedList()
2327 case tok::l_brace: in parseBracedList()
2334 case tok::less: in parseBracedList()
2336 ClosingBraceKind == tok::greater) { in parseBracedList()
2339 /*ClosingBraceKind=*/tok::greater); in parseBracedList()
2344 case tok::semi: in parseBracedList()
2358 case tok::comma: in parseBracedList()
2375 assert(FormatTok->is(tok::l_paren) && "'(' expected."); in parseParens()
2379 case tok::l_paren: in parseParens()
2381 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_brace)) in parseParens()
2384 case tok::r_paren: in parseParens()
2387 case tok::r_brace: in parseParens()
2390 case tok::l_square: in parseParens()
2393 case tok::l_brace: in parseParens()
2397 case tok::at: in parseParens()
2399 if (FormatTok->is(tok::l_brace)) { in parseParens()
2404 case tok::equal: in parseParens()
2410 case tok::kw_class: in parseParens()
2416 case tok::identifier: in parseParens()
2426 case tok::kw_requires: { in parseParens()
2432 case tok::ampamp: in parseParens()
2445 assert(FormatTok->is(tok::l_square) && "'[' expected."); in parseSquare()
2451 case tok::l_paren: in parseSquare()
2454 case tok::r_square: in parseSquare()
2457 case tok::r_brace: in parseSquare()
2460 case tok::l_square: in parseSquare()
2463 case tok::l_brace: { in parseSquare()
2468 case tok::at: in parseSquare()
2470 if (FormatTok->is(tok::l_brace)) { in parseSquare()
2495 if (Token.Tok->isNot(tok::comment)) in getLastNonComment()
2533 if (CheckEOF && FormatTok->is(tok::eof)) in parseUnbracedBody()
2543 assert(LeftBrace->is(tok::l_brace)); in markOptionalBraces()
2551 assert(RightBrace->is(tok::r_brace)); in markOptionalBraces()
2568 if (FormatTok->is(tok::l_square) && tryToParseSimpleAttribute()) { in handleCppAttributes()
2577 assert(FormatTok->is(tok::kw_if) && "'if' expected"); in parseIfThenElse()
2579 if (FormatTok->is(tok::exclaim)) in parseIfThenElse()
2583 if (FormatTok->is(tok::kw_consteval)) { in parseIfThenElse()
2587 if (FormatTok->isOneOf(tok::kw_constexpr, tok::identifier)) in parseIfThenElse()
2589 if (FormatTok->is(tok::l_paren)) in parseIfThenElse()
2626 if (FormatTok->is(tok::kw_else)) { in parseIfThenElse()
2634 const bool FollowedByIf = Tokens->peekNextToken()->is(tok::kw_if); in parseIfThenElse()
2642 if (FormatTok->is(tok::kw_else)) { in parseIfThenElse()
2652 } else if (FormatTok->is(tok::kw_if)) { in parseIfThenElse()
2655 const bool IsPrecededByComment = Previous->is(tok::comment); in parseIfThenElse()
2710 assert(FormatTok->isOneOf(tok::kw_try, tok::kw___try) && "'try' expected"); in parseTryCatch()
2713 if (FormatTok->is(tok::colon)) { in parseTryCatch()
2719 while (FormatTok->is(tok::comma)) in parseTryCatch()
2722 while (FormatTok->is(tok::identifier)) { in parseTryCatch()
2724 if (FormatTok->is(tok::l_paren)) in parseTryCatch()
2726 if (FormatTok->Previous && FormatTok->Previous->is(tok::identifier) && in parseTryCatch()
2727 FormatTok->is(tok::l_brace)) { in parseTryCatch()
2730 } while (!FormatTok->is(tok::r_brace)); in parseTryCatch()
2736 while (FormatTok->is(tok::comma)) in parseTryCatch()
2741 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_paren)) in parseTryCatch()
2746 if (FormatTok->is(tok::l_brace)) { in parseTryCatch()
2753 } else if (!FormatTok->is(tok::kw_catch)) { in parseTryCatch()
2763 if (FormatTok->is(tok::at)) in parseTryCatch()
2765 if (!(FormatTok->isOneOf(tok::kw_catch, Keywords.kw___except, in parseTryCatch()
2766 tok::kw___finally) || in parseTryCatch()
2769 (FormatTok->isObjCAtKeyword(tok::objc_catch) || in parseTryCatch()
2770 FormatTok->isObjCAtKeyword(tok::objc_finally)))) { in parseTryCatch()
2774 while (FormatTok->isNot(tok::l_brace)) { in parseTryCatch()
2775 if (FormatTok->is(tok::l_paren)) { in parseTryCatch()
2779 if (FormatTok->isOneOf(tok::semi, tok::r_brace, tok::eof)) { in parseTryCatch()
2804 assert(FormatTok->isOneOf(tok::kw_namespace, TT_NamespaceMacro) && in parseNamespace()
2812 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::kw_inline, in parseNamespace()
2813 tok::l_square, tok::period, tok::l_paren) || in parseNamespace()
2814 (Style.isCSharp() && FormatTok->is(tok::kw_union))) { in parseNamespace()
2815 if (FormatTok->is(tok::l_square)) in parseNamespace()
2817 else if (FormatTok->is(tok::l_paren)) in parseNamespace()
2823 if (FormatTok->is(tok::l_brace)) { in parseNamespace()
2848 if (FormatTok->is(tok::semi)) in parseNamespace()
2860 assert(FormatTok->is(tok::kw_new) && "'new' expected"); in parseNew()
2865 if (FormatTok->is(tok::l_brace)) in parseNew()
2868 if (FormatTok->isOneOf(tok::semi, tok::comma)) in parseNew()
2881 if (FormatTok->isOneOf(tok::semi, tok::l_brace, tok::r_brace)) in parseNew()
2885 if (FormatTok->is(tok::l_paren)) { in parseNew()
2889 if (FormatTok->is(tok::l_brace)) in parseNew()
2923 assert(FormatTok->isOneOf(tok::kw_for, tok::kw_while, TT_ForEachMacro) && in parseForOrWhileLoop()
2926 !FormatTok->isOneOf(tok::kw_for, tok::kw_while); in parseForOrWhileLoop()
2932 if (Style.isCpp() && FormatTok->is(tok::kw_co_await)) in parseForOrWhileLoop()
2934 if (FormatTok->is(tok::l_paren)) in parseForOrWhileLoop()
2942 assert(FormatTok->is(tok::kw_do) && "'do' expected"); in parseDoWhile()
2948 if (!FormatTok->is(tok::kw_while)) { in parseDoWhile()
2971 FormatTok->is(tok::l_brace)) { in parseLabel()
2977 if (FormatTok->is(tok::kw_break)) { in parseLabel()
2990 if (FormatTok->is(tok::semi)) in parseLabel()
2995 if (FormatTok->isNot(tok::l_brace)) { in parseLabel()
3002 assert(FormatTok->is(tok::kw_case) && "'case' expected"); in parseCaseLabel()
3007 } while (!eof() && !FormatTok->is(tok::colon)); in parseCaseLabel()
3012 assert(FormatTok->is(tok::kw_switch) && "'switch' expected"); in parseSwitch()
3014 if (FormatTok->is(tok::l_paren)) in parseSwitch()
3019 if (FormatTok->is(tok::l_brace)) { in parseSwitch()
3035 static bool isCOperatorFollowingVar(tok::TokenKind kind) { in isCOperatorFollowingVar()
3037 case tok::ampamp: in isCOperatorFollowingVar()
3038 case tok::ampequal: in isCOperatorFollowingVar()
3039 case tok::arrow: in isCOperatorFollowingVar()
3040 case tok::caret: in isCOperatorFollowingVar()
3041 case tok::caretequal: in isCOperatorFollowingVar()
3042 case tok::comma: in isCOperatorFollowingVar()
3043 case tok::ellipsis: in isCOperatorFollowingVar()
3044 case tok::equal: in isCOperatorFollowingVar()
3045 case tok::equalequal: in isCOperatorFollowingVar()
3046 case tok::exclaim: in isCOperatorFollowingVar()
3047 case tok::exclaimequal: in isCOperatorFollowingVar()
3048 case tok::greater: in isCOperatorFollowingVar()
3049 case tok::greaterequal: in isCOperatorFollowingVar()
3050 case tok::greatergreater: in isCOperatorFollowingVar()
3051 case tok::greatergreaterequal: in isCOperatorFollowingVar()
3052 case tok::l_paren: in isCOperatorFollowingVar()
3053 case tok::l_square: in isCOperatorFollowingVar()
3054 case tok::less: in isCOperatorFollowingVar()
3055 case tok::lessequal: in isCOperatorFollowingVar()
3056 case tok::lessless: in isCOperatorFollowingVar()
3057 case tok::lesslessequal: in isCOperatorFollowingVar()
3058 case tok::minus: in isCOperatorFollowingVar()
3059 case tok::minusequal: in isCOperatorFollowingVar()
3060 case tok::minusminus: in isCOperatorFollowingVar()
3061 case tok::percent: in isCOperatorFollowingVar()
3062 case tok::percentequal: in isCOperatorFollowingVar()
3063 case tok::period: in isCOperatorFollowingVar()
3064 case tok::pipe: in isCOperatorFollowingVar()
3065 case tok::pipeequal: in isCOperatorFollowingVar()
3066 case tok::pipepipe: in isCOperatorFollowingVar()
3067 case tok::plus: in isCOperatorFollowingVar()
3068 case tok::plusequal: in isCOperatorFollowingVar()
3069 case tok::plusplus: in isCOperatorFollowingVar()
3070 case tok::question: in isCOperatorFollowingVar()
3071 case tok::r_brace: in isCOperatorFollowingVar()
3072 case tok::r_paren: in isCOperatorFollowingVar()
3073 case tok::r_square: in isCOperatorFollowingVar()
3074 case tok::semi: in isCOperatorFollowingVar()
3075 case tok::slash: in isCOperatorFollowingVar()
3076 case tok::slashequal: in isCOperatorFollowingVar()
3077 case tok::star: in isCOperatorFollowingVar()
3078 case tok::starequal: in isCOperatorFollowingVar()
3092 if (FormatTok->is(tok::colon)) { in parseAccessSpecifier()
3095 } else if (!FormatTok->is(tok::coloncolon) && in parseAccessSpecifier()
3101 AccessSpecifierCandidate->Tok.setKind(tok::identifier); in parseAccessSpecifier()
3111 assert(FormatTok->is(tok::kw_concept) && "'concept' expected"); in parseConcept()
3113 if (!FormatTok->is(tok::identifier)) in parseConcept()
3116 if (!FormatTok->is(tok::equal)) in parseConcept()
3120 if (FormatTok->is(tok::semi)) in parseConcept()
3129 assert(FormatTok->is(tok::kw_requires) && "'requires' expected"); in parseRequires()
3137 case tok::l_brace: in parseRequires()
3141 case tok::l_paren: in parseRequires()
3168 case tok::greater: in parseRequires()
3169 case tok::r_paren: in parseRequires()
3170 case tok::kw_noexcept: in parseRequires()
3171 case tok::kw_const: in parseRequires()
3175 case tok::amp: in parseRequires()
3176 case tok::ampamp: { in parseRequires()
3184 if (PrevPrev && PrevPrev->is(tok::kw_const)) { in parseRequires()
3220 case tok::kw_volatile: in parseRequires()
3221 case tok::kw_const: in parseRequires()
3222 case tok::comma: in parseRequires()
3225 case tok::r_paren: in parseRequires()
3226 case tok::pipepipe: in parseRequires()
3229 case tok::eof: in parseRequires()
3233 case tok::coloncolon: in parseRequires()
3236 case tok::identifier: in parseRequires()
3244 case tok::less: in parseRequires()
3247 case tok::greater: in parseRequires()
3273 assert(RequiresToken->is(tok::kw_requires) && "'requires' expected"); in parseRequiresClause()
3301 assert(RequiresToken->is(tok::kw_requires) && "'requires' expected"); in parseRequiresExpression()
3305 if (FormatTok->is(tok::l_paren)) { in parseRequiresExpression()
3310 if (FormatTok->is(tok::l_brace)) { in parseRequiresExpression()
3334 case tok::kw_requires: { in parseConstraintExpression()
3341 case tok::l_paren: in parseConstraintExpression()
3345 case tok::l_square: in parseConstraintExpression()
3350 case tok::kw_const: in parseConstraintExpression()
3351 case tok::semi: in parseConstraintExpression()
3352 case tok::kw_class: in parseConstraintExpression()
3353 case tok::kw_struct: in parseConstraintExpression()
3354 case tok::kw_union: in parseConstraintExpression()
3357 case tok::l_brace: in parseConstraintExpression()
3361 case tok::ampamp: in parseConstraintExpression()
3362 case tok::pipepipe: in parseConstraintExpression()
3368 case tok::comma: in parseConstraintExpression()
3369 case tok::comment: in parseConstraintExpression()
3374 case tok::kw_sizeof: in parseConstraintExpression()
3375 case tok::greater: in parseConstraintExpression()
3376 case tok::greaterequal: in parseConstraintExpression()
3377 case tok::greatergreater: in parseConstraintExpression()
3378 case tok::less: in parseConstraintExpression()
3379 case tok::lessequal: in parseConstraintExpression()
3380 case tok::lessless: in parseConstraintExpression()
3381 case tok::equalequal: in parseConstraintExpression()
3382 case tok::exclaim: in parseConstraintExpression()
3383 case tok::exclaimequal: in parseConstraintExpression()
3384 case tok::plus: in parseConstraintExpression()
3385 case tok::minus: in parseConstraintExpression()
3386 case tok::star: in parseConstraintExpression()
3387 case tok::slash: in parseConstraintExpression()
3388 case tok::kw_decltype: in parseConstraintExpression()
3394 case tok::numeric_constant: in parseConstraintExpression()
3395 case tok::coloncolon: in parseConstraintExpression()
3396 case tok::kw_true: in parseConstraintExpression()
3397 case tok::kw_false: in parseConstraintExpression()
3402 case tok::kw_static_cast: in parseConstraintExpression()
3403 case tok::kw_const_cast: in parseConstraintExpression()
3404 case tok::kw_reinterpret_cast: in parseConstraintExpression()
3405 case tok::kw_dynamic_cast: in parseConstraintExpression()
3407 if (!FormatTok->is(tok::less)) in parseConstraintExpression()
3412 /*ClosingBraceKind=*/tok::greater); in parseConstraintExpression()
3415 case tok::kw_bool: in parseConstraintExpression()
3421 if (FormatTok->isNot(tok::l_paren)) in parseConstraintExpression()
3439 case tok::coloncolon: // Nested identifier. in parseConstraintExpression()
3440 case tok::ampamp: // Start of a function or variable for the in parseConstraintExpression()
3441 case tok::pipepipe: // constraint expression. in parseConstraintExpression()
3442 case tok::kw_requires: // Initial identifier of a requires clause. in parseConstraintExpression()
3443 case tok::equal: // Initial identifier of a concept declaration. in parseConstraintExpression()
3451 if (FormatTok->is(tok::less)) { in parseConstraintExpression()
3454 /*ClosingBraceKind=*/tok::greater); in parseConstraintExpression()
3465 if (FormatTok->is(tok::kw_enum)) in parseEnum()
3471 if (Style.isJavaScript() && FormatTok->isOneOf(tok::colon, tok::question)) in parseEnum()
3475 if (Style.Language == FormatStyle::LK_Proto && FormatTok->is(tok::equal)) in parseEnum()
3479 if (FormatTok->isOneOf(tok::kw_class, tok::kw_struct)) in parseEnum()
3483 FormatTok->isOneOf(tok::colon, tok::coloncolon, tok::less, in parseEnum()
3484 tok::greater, tok::comma, tok::question, in parseEnum()
3485 tok::l_square, tok::r_square)) { in parseEnum()
3488 if (FormatTok->is(tok::l_paren)) in parseEnum()
3496 if (FormatTok->is(tok::identifier)) { in parseEnum()
3500 if (Style.isCpp() && FormatTok->is(tok::identifier)) in parseEnum()
3506 if (FormatTok->isNot(tok::l_brace)) in parseEnum()
3536 if (FormatTok->is(tok::semi)) in parseEnum()
3554 if (FormatTok->is(tok::semi)) in parseStructLike()
3585 if (!Tok->is(tok::l_square)) in tryToParseSimpleAttribute()
3589 while (Tok->isNot(tok::eof)) { in tryToParseSimpleAttribute()
3590 if (Tok->is(tok::r_square)) in tryToParseSimpleAttribute()
3594 if (Tok->is(tok::eof)) in tryToParseSimpleAttribute()
3597 if (!Tok->is(tok::r_square)) in tryToParseSimpleAttribute()
3600 if (Tok->is(tok::semi)) in tryToParseSimpleAttribute()
3606 assert(FormatTok->is(tok::l_brace)); in parseJavaEnumBody()
3615 while (!Tok->is(tok::eof)) { in parseJavaEnumBody()
3616 if (Tok->is(tok::r_brace)) in parseJavaEnumBody()
3618 if (Tok->isOneOf(tok::l_brace, tok::semi)) { in parseJavaEnumBody()
3642 while (FormatTok->isNot(tok::eof)) { in parseJavaEnumBody()
3643 if (FormatTok->is(tok::l_brace)) { in parseJavaEnumBody()
3647 } else if (FormatTok->is(tok::l_paren)) { in parseJavaEnumBody()
3649 } else if (FormatTok->is(tok::comma)) { in parseJavaEnumBody()
3652 } else if (FormatTok->is(tok::semi)) { in parseJavaEnumBody()
3656 } else if (FormatTok->is(tok::r_brace)) { in parseJavaEnumBody()
3678 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::hashhash, in parseRecord()
3679 tok::kw___attribute, tok::kw___declspec, in parseRecord()
3680 tok::kw_alignas, tok::l_square, tok::r_square) || in parseRecord()
3682 FormatTok->isOneOf(tok::period, tok::comma))) { in parseRecord()
3689 if (FormatTok->is(tok::l_brace)) { in parseRecord()
3695 FormatTok->is(tok::identifier) && in parseRecord()
3700 if (FormatTok->is(tok::l_paren)) { in parseRecord()
3721 if (FormatTok->isOneOf(tok::colon, tok::less)) { in parseRecord()
3723 if (FormatTok->is(tok::l_brace)) { in parseRecord()
3728 if (FormatTok->is(tok::l_square)) { in parseRecord()
3731 !(Previous->is(tok::r_paren) || Previous->isTypeOrIdentifier())) { in parseRecord()
3741 if (FormatTok->is(tok::semi)) in parseRecord()
3755 case tok::kw_class: in parseRecord()
3757 case tok::kw_struct: in parseRecord()
3759 case tok::kw_union: in parseRecord()
3766 if (FormatTok->is(tok::l_brace)) { in parseRecord()
3784 assert(FormatTok->isOneOf(tok::l_paren, tok::identifier) && in parseObjCMethod()
3787 if (FormatTok->is(tok::semi)) { in parseObjCMethod()
3791 } else if (FormatTok->is(tok::l_brace)) { in parseObjCMethod()
3804 assert(FormatTok->is(tok::less) && "'<' expected."); in parseObjCProtocolList()
3808 if (FormatTok->isOneOf(tok::semi, tok::l_brace) || in parseObjCProtocolList()
3809 FormatTok->isObjCAtKeyword(tok::objc_end)) { in parseObjCProtocolList()
3812 } while (!eof() && FormatTok->isNot(tok::greater)); in parseObjCProtocolList()
3818 if (FormatTok->isObjCAtKeyword(tok::objc_end)) { in parseObjCUntilAtEnd()
3823 if (FormatTok->is(tok::l_brace)) { in parseObjCUntilAtEnd()
3827 } else if (FormatTok->is(tok::r_brace)) { in parseObjCUntilAtEnd()
3831 } else if (FormatTok->isOneOf(tok::minus, tok::plus)) { in parseObjCUntilAtEnd()
3841 assert(FormatTok->Tok.getObjCKeywordID() == tok::objc_interface || in parseObjCInterfaceOrImplementation()
3842 FormatTok->Tok.getObjCKeywordID() == tok::objc_implementation); in parseObjCInterfaceOrImplementation()
3848 if (FormatTok->is(tok::less)) in parseObjCInterfaceOrImplementation()
3850 if (FormatTok->is(tok::colon)) { in parseObjCInterfaceOrImplementation()
3854 if (FormatTok->is(tok::less)) in parseObjCInterfaceOrImplementation()
3856 } else if (FormatTok->is(tok::l_paren)) { in parseObjCInterfaceOrImplementation()
3861 if (FormatTok->is(tok::less)) in parseObjCInterfaceOrImplementation()
3864 if (FormatTok->is(tok::l_brace)) { in parseObjCInterfaceOrImplementation()
3878 assert(FormatTok->is(tok::less)); in parseObjCLightweightGenerics()
3890 if (FormatTok->isOneOf(tok::semi, tok::l_brace) || in parseObjCLightweightGenerics()
3891 FormatTok->isObjCAtKeyword(tok::objc_end)) { in parseObjCLightweightGenerics()
3894 if (FormatTok->is(tok::less)) { in parseObjCLightweightGenerics()
3896 } else if (FormatTok->is(tok::greater)) { in parseObjCLightweightGenerics()
3907 assert(FormatTok->Tok.getObjCKeywordID() == tok::objc_protocol); in parseObjCProtocol()
3910 if (FormatTok->is(tok::l_paren)) { in parseObjCProtocol()
3922 if (FormatTok->is(tok::less)) in parseObjCProtocol()
3926 if (FormatTok->is(tok::semi)) { in parseObjCProtocol()
3939 assert(IsImport || FormatTok->is(tok::kw_export)); in parseJavaScriptEs6ImportExport()
3943 if (FormatTok->is(tok::kw_default)) in parseJavaScriptEs6ImportExport()
3960 if (!IsImport && !FormatTok->isOneOf(tok::l_brace, tok::star) && in parseJavaScriptEs6ImportExport()
3966 if (FormatTok->is(tok::semi)) in parseJavaScriptEs6ImportExport()
3973 if (FormatTok->is(tok::l_brace)) { in parseJavaScriptEs6ImportExport()
3985 if (FormatTok->is(tok::l_paren)) in parseStatementMacro()
3987 if (FormatTok->is(tok::semi)) in parseStatementMacro()
4042 bool UnwrappedLineParser::eof() const { return FormatTok->is(tok::eof); } in eof()
4138 if (PreviousToken && PreviousToken->is(tok::l_brace) && in continuesLineCommentSection()
4149 if (PreviousToken && PreviousToken->is(tok::l_brace)) in continuesLineCommentSection()
4197 FormatTok->Tok.setKind(tok::r_brace); in nextToken()
4291 PreviousWasComment = FormatTok->is(tok::comment); in readToken()
4293 while (!Line->InPPDirective && FormatTok->is(tok::hash) && in readToken()
4316 PreviousWasComment = FormatTok->is(tok::comment); in readToken()
4326 if (!FormatTok->is(tok::comment)) { in readToken()