Lines Matching refs:tok
102 FormatTok.Tok.setKind(tok::eof); in getFakeEOF()
270 tok::TokenKind kind = FormatTok->Tok.getKind(); in parseLevel()
272 kind = tok::l_brace; in parseLevel()
274 kind = tok::r_brace; in parseLevel()
278 case tok::comment: in parseLevel()
282 case tok::l_brace: in parseLevel()
290 case tok::r_brace: in parseLevel()
296 case tok::kw_default: in parseLevel()
297 case tok::kw_case: in parseLevel()
322 assert(Tok->Tok.is(tok::l_brace)); in calculateBraceTypes()
330 } while (NextTok->is(tok::comment)); in calculateBraceTypes()
333 case tok::l_brace: in calculateBraceTypes()
337 case tok::r_brace: in calculateBraceTypes()
342 ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::r_square); in calculateBraceTypes()
346 bool NextIsObjCMethod = NextTok->isOneOf(tok::plus, tok::minus) && in calculateBraceTypes()
358 NextTok->isOneOf(tok::comma, tok::period, tok::colon, in calculateBraceTypes()
359 tok::r_paren, tok::r_square, tok::l_brace, in calculateBraceTypes()
360 tok::l_paren, tok::ellipsis) || in calculateBraceTypes()
361 (NextTok->is(tok::semi) && in calculateBraceTypes()
376 case tok::at: in calculateBraceTypes()
377 case tok::semi: in calculateBraceTypes()
378 case tok::kw_if: in calculateBraceTypes()
379 case tok::kw_while: in calculateBraceTypes()
380 case tok::kw_for: in calculateBraceTypes()
381 case tok::kw_switch: in calculateBraceTypes()
382 case tok::kw_try: in calculateBraceTypes()
383 case tok::kw___try: in calculateBraceTypes()
391 } while (Tok->Tok.isNot(tok::eof) && !LBraceStack.empty()); in calculateBraceTypes()
403 assert(FormatTok->isOneOf(tok::l_brace, TT_MacroBlockBegin) && in parseBlock()
411 if (MacroBlock && FormatTok->is(tok::l_paren)) in parseBlock()
423 : !FormatTok->is(tok::r_brace)) { in parseBlock()
431 if (MacroBlock && FormatTok->is(tok::l_paren)) in parseBlock()
434 if (MunchSemi && FormatTok->Tok.is(tok::semi)) in parseBlock()
448 if (I->Tok->isNot(tok::period)) in isGoogScope()
454 return I->Tok->is(tok::l_paren); in isGoogScope()
459 if (InitialToken.is(tok::kw_namespace)) in ShouldBreakBeforeBrace()
461 if (InitialToken.is(tok::kw_class)) in ShouldBreakBeforeBrace()
463 if (InitialToken.is(tok::kw_union)) in ShouldBreakBeforeBrace()
465 if (InitialToken.is(tok::kw_struct)) in ShouldBreakBeforeBrace()
488 assert(FormatTok->Tok.is(tok::hash) && "'#' expected"); in parsePPDirective()
498 case tok::pp_define: in parsePPDirective()
501 case tok::pp_if: in parsePPDirective()
504 case tok::pp_ifdef: in parsePPDirective()
505 case tok::pp_ifndef: in parsePPDirective()
508 case tok::pp_else: in parsePPDirective()
511 case tok::pp_elif: in parsePPDirective()
514 case tok::pp_endif: in parsePPDirective()
575 FormatTok->Tok.is(tok::kw_false); in parsePPIf()
595 if (FormatTok->Tok.getKind() != tok::identifier) { in parsePPDefine()
600 if (FormatTok->Tok.getKind() == tok::l_paren && in parsePPDefine()
629 return Tok.isNot(tok::semi) && Tok.isNot(tok::l_brace) && in tokenCanStartNewLine()
630 Tok.isNot(tok::l_square) && in tokenCanStartNewLine()
633 Tok.isNot(tok::period) && Tok.isNot(tok::periodstar) && in tokenCanStartNewLine()
634 Tok.isNot(tok::arrow) && Tok.isNot(tok::arrowstar) && in tokenCanStartNewLine()
635 Tok.isNot(tok::less) && Tok.isNot(tok::greater) && in tokenCanStartNewLine()
636 Tok.isNot(tok::slash) && Tok.isNot(tok::percent) && in tokenCanStartNewLine()
637 Tok.isNot(tok::lessless) && Tok.isNot(tok::greatergreater) && in tokenCanStartNewLine()
638 Tok.isNot(tok::equal) && Tok.isNot(tok::plusequal) && in tokenCanStartNewLine()
639 Tok.isNot(tok::minusequal) && Tok.isNot(tok::starequal) && in tokenCanStartNewLine()
640 Tok.isNot(tok::slashequal) && Tok.isNot(tok::percentequal) && in tokenCanStartNewLine()
641 Tok.isNot(tok::ampequal) && Tok.isNot(tok::pipeequal) && in tokenCanStartNewLine()
642 Tok.isNot(tok::caretequal) && Tok.isNot(tok::greatergreaterequal) && in tokenCanStartNewLine()
643 Tok.isNot(tok::lesslessequal) && in tokenCanStartNewLine()
647 Tok.isNot(tok::colon) && in tokenCanStartNewLine()
649 Tok.isNot(tok::kw_noexcept); in tokenCanStartNewLine()
653 assert(!FormatTok->Tok.is(tok::l_brace)); in parseStructuralElement()
655 case tok::at: in parseStructuralElement()
657 if (FormatTok->Tok.is(tok::l_brace)) { in parseStructuralElement()
662 case tok::objc_public: in parseStructuralElement()
663 case tok::objc_protected: in parseStructuralElement()
664 case tok::objc_package: in parseStructuralElement()
665 case tok::objc_private: in parseStructuralElement()
667 case tok::objc_interface: in parseStructuralElement()
668 case tok::objc_implementation: in parseStructuralElement()
670 case tok::objc_protocol: in parseStructuralElement()
672 case tok::objc_end: in parseStructuralElement()
674 case tok::objc_optional: in parseStructuralElement()
675 case tok::objc_required: in parseStructuralElement()
679 case tok::objc_autoreleasepool: in parseStructuralElement()
681 if (FormatTok->Tok.is(tok::l_brace)) { in parseStructuralElement()
688 case tok::objc_try: in parseStructuralElement()
697 case tok::kw_asm: in parseStructuralElement()
699 if (FormatTok->is(tok::l_brace)) { in parseStructuralElement()
702 while (FormatTok && FormatTok->isNot(tok::eof)) { in parseStructuralElement()
703 if (FormatTok->is(tok::r_brace)) { in parseStructuralElement()
714 case tok::kw_namespace: in parseStructuralElement()
717 case tok::kw_inline: in parseStructuralElement()
719 if (FormatTok->Tok.is(tok::kw_namespace)) { in parseStructuralElement()
724 case tok::kw_public: in parseStructuralElement()
725 case tok::kw_protected: in parseStructuralElement()
726 case tok::kw_private: in parseStructuralElement()
733 case tok::kw_if: in parseStructuralElement()
736 case tok::kw_for: in parseStructuralElement()
737 case tok::kw_while: in parseStructuralElement()
740 case tok::kw_do: in parseStructuralElement()
743 case tok::kw_switch: in parseStructuralElement()
746 case tok::kw_default: in parseStructuralElement()
750 case tok::kw_case: in parseStructuralElement()
753 case tok::kw_try: in parseStructuralElement()
754 case tok::kw___try: in parseStructuralElement()
757 case tok::kw_extern: in parseStructuralElement()
759 if (FormatTok->Tok.is(tok::string_literal)) { in parseStructuralElement()
761 if (FormatTok->Tok.is(tok::l_brace)) { in parseStructuralElement()
768 case tok::kw_export: in parseStructuralElement()
774 case tok::identifier: in parseStructuralElement()
792 if (FormatTok->is(tok::colon)) { in parseStructuralElement()
805 case tok::at: in parseStructuralElement()
807 if (FormatTok->Tok.is(tok::l_brace)) in parseStructuralElement()
810 case tok::kw_enum: in parseStructuralElement()
820 case tok::kw_typedef: in parseStructuralElement()
826 case tok::kw_struct: in parseStructuralElement()
827 case tok::kw_union: in parseStructuralElement()
828 case tok::kw_class: in parseStructuralElement()
839 case tok::period: in parseStructuralElement()
843 FormatTok->is(tok::kw_class)) in parseStructuralElement()
851 case tok::semi: in parseStructuralElement()
855 case tok::r_brace: in parseStructuralElement()
858 case tok::l_paren: in parseStructuralElement()
861 case tok::kw_operator: in parseStructuralElement()
866 case tok::caret: in parseStructuralElement()
871 if (FormatTok->is(tok::l_paren)) in parseStructuralElement()
873 if (FormatTok->is(tok::l_brace)) in parseStructuralElement()
876 case tok::l_brace: in parseStructuralElement()
892 case tok::kw_try: in parseStructuralElement()
896 case tok::identifier: { in parseStructuralElement()
923 if (FormatTok->Tok.is(tok::colon) && !Line->MustBeDeclaration) { in parseStructuralElement()
929 bool FunctionLike = FormatTok->is(tok::l_paren); in parseStructuralElement()
946 case tok::equal: in parseStructuralElement()
952 if (FormatTok->is(tok::l_brace)) in parseStructuralElement()
958 if (FormatTok->Tok.is(tok::l_brace)) { in parseStructuralElement()
962 case tok::l_square: in parseStructuralElement()
965 case tok::kw_new: in parseStructuralElement()
983 (Line->Tokens.back().Tok->isOneOf(tok::identifier, tok::kw_operator, in tryToParseLambda()
984 tok::kw_new, tok::kw_delete) || in tryToParseLambda()
990 assert(FormatTok->is(tok::l_square)); in tryToParseLambda()
995 while (FormatTok->isNot(tok::l_brace)) { in tryToParseLambda()
1001 case tok::l_brace: in tryToParseLambda()
1003 case tok::l_paren: in tryToParseLambda()
1006 case tok::amp: in tryToParseLambda()
1007 case tok::star: in tryToParseLambda()
1008 case tok::kw_const: in tryToParseLambda()
1009 case tok::comma: in tryToParseLambda()
1010 case tok::less: in tryToParseLambda()
1011 case tok::greater: in tryToParseLambda()
1012 case tok::identifier: in tryToParseLambda()
1013 case tok::numeric_constant: in tryToParseLambda()
1014 case tok::coloncolon: in tryToParseLambda()
1015 case tok::kw_mutable: in tryToParseLambda()
1018 case tok::arrow: in tryToParseLambda()
1033 if (FormatTok->is(tok::equal)) { in tryToParseLambdaIntroducer()
1035 if (FormatTok->is(tok::r_square)) { in tryToParseLambdaIntroducer()
1039 if (FormatTok->isNot(tok::comma)) in tryToParseLambdaIntroducer()
1042 } else if (FormatTok->is(tok::amp)) { in tryToParseLambdaIntroducer()
1044 if (FormatTok->is(tok::r_square)) { in tryToParseLambdaIntroducer()
1048 if (!FormatTok->isOneOf(tok::comma, tok::identifier)) { in tryToParseLambdaIntroducer()
1051 if (FormatTok->is(tok::comma)) in tryToParseLambdaIntroducer()
1053 } else if (FormatTok->is(tok::r_square)) { in tryToParseLambdaIntroducer()
1058 if (FormatTok->is(tok::amp)) in tryToParseLambdaIntroducer()
1060 if (!FormatTok->isOneOf(tok::identifier, tok::kw_this)) in tryToParseLambdaIntroducer()
1063 if (FormatTok->is(tok::ellipsis)) in tryToParseLambdaIntroducer()
1065 if (FormatTok->is(tok::comma)) { in tryToParseLambdaIntroducer()
1067 } else if (FormatTok->is(tok::r_square)) { in tryToParseLambdaIntroducer()
1081 if (FormatTok->is(tok::identifier)) in tryToParseJSFunction()
1084 if (FormatTok->isNot(tok::l_paren)) in tryToParseJSFunction()
1090 if (FormatTok->is(tok::colon)) { in tryToParseJSFunction()
1096 if (FormatTok->is(tok::l_brace)) in tryToParseJSFunction()
1099 while (FormatTok->isNot(tok::l_brace) && !eof()) in tryToParseJSFunction()
1132 if (FormatTok->is(tok::l_brace)) { in parseBracedList()
1139 case tok::caret: in parseBracedList()
1141 if (FormatTok->is(tok::l_brace)) { in parseBracedList()
1145 case tok::l_square: in parseBracedList()
1148 case tok::l_brace: in parseBracedList()
1154 case tok::l_paren: in parseBracedList()
1159 if (FormatTok->is(tok::l_brace)) in parseBracedList()
1164 case tok::r_brace: in parseBracedList()
1167 case tok::semi: in parseBracedList()
1173 case tok::comma: in parseBracedList()
1185 assert(FormatTok->Tok.is(tok::l_paren) && "'(' expected."); in parseParens()
1189 case tok::l_paren: in parseParens()
1191 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_brace)) in parseParens()
1194 case tok::r_paren: in parseParens()
1197 case tok::r_brace: in parseParens()
1200 case tok::l_square: in parseParens()
1203 case tok::l_brace: in parseParens()
1207 case tok::at: in parseParens()
1209 if (FormatTok->Tok.is(tok::l_brace)) in parseParens()
1212 case tok::identifier: in parseParens()
1227 assert(FormatTok->Tok.is(tok::l_square) && "'[' expected."); in parseSquare()
1232 case tok::l_paren: in parseSquare()
1235 case tok::r_square: in parseSquare()
1238 case tok::r_brace: in parseSquare()
1241 case tok::l_square: in parseSquare()
1244 case tok::l_brace: { in parseSquare()
1249 case tok::at: in parseSquare()
1251 if (FormatTok->Tok.is(tok::l_brace)) in parseSquare()
1262 assert(FormatTok->Tok.is(tok::kw_if) && "'if' expected"); in parseIfThenElse()
1264 if (FormatTok->Tok.is(tok::l_paren)) in parseIfThenElse()
1267 if (FormatTok->Tok.is(tok::l_brace)) { in parseIfThenElse()
1280 if (FormatTok->Tok.is(tok::kw_else)) { in parseIfThenElse()
1282 if (FormatTok->Tok.is(tok::l_brace)) { in parseIfThenElse()
1286 } else if (FormatTok->Tok.is(tok::kw_if)) { in parseIfThenElse()
1300 assert(FormatTok->isOneOf(tok::kw_try, tok::kw___try) && "'try' expected"); in parseTryCatch()
1303 if (FormatTok->is(tok::colon)) { in parseTryCatch()
1306 while (FormatTok->is(tok::identifier)) { in parseTryCatch()
1308 if (FormatTok->is(tok::l_paren)) in parseTryCatch()
1310 if (FormatTok->is(tok::comma)) in parseTryCatch()
1315 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_paren)) { in parseTryCatch()
1318 if (FormatTok->is(tok::l_brace)) { in parseTryCatch()
1326 } else if (!FormatTok->is(tok::kw_catch)) { in parseTryCatch()
1336 if (FormatTok->is(tok::at)) in parseTryCatch()
1338 if (!(FormatTok->isOneOf(tok::kw_catch, Keywords.kw___except, in parseTryCatch()
1339 tok::kw___finally) || in parseTryCatch()
1343 (FormatTok->Tok.isObjCAtKeyword(tok::objc_catch) || in parseTryCatch()
1344 FormatTok->Tok.isObjCAtKeyword(tok::objc_finally)))) in parseTryCatch()
1347 while (FormatTok->isNot(tok::l_brace)) { in parseTryCatch()
1348 if (FormatTok->is(tok::l_paren)) { in parseTryCatch()
1352 if (FormatTok->isOneOf(tok::semi, tok::r_brace, tok::eof)) in parseTryCatch()
1369 assert(FormatTok->Tok.is(tok::kw_namespace) && "'namespace' expected"); in parseNamespace()
1373 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon)) in parseNamespace()
1375 if (FormatTok->Tok.is(tok::l_brace)) { in parseNamespace()
1385 if (FormatTok->Tok.is(tok::semi)) in parseNamespace()
1393 assert(FormatTok->is(tok::kw_new) && "'new' expected"); in parseNew()
1401 if (FormatTok->isOneOf(tok::semi, tok::l_brace, tok::r_brace)) in parseNew()
1405 if (FormatTok->is(tok::l_paren)) { in parseNew()
1409 if (FormatTok->is(tok::l_brace)) in parseNew()
1418 assert(FormatTok->isOneOf(tok::kw_for, tok::kw_while, TT_ForEachMacro) && in parseForOrWhileLoop()
1421 if (FormatTok->Tok.is(tok::l_paren)) in parseForOrWhileLoop()
1423 if (FormatTok->Tok.is(tok::l_brace)) { in parseForOrWhileLoop()
1436 assert(FormatTok->Tok.is(tok::kw_do) && "'do' expected"); in parseDoWhile()
1438 if (FormatTok->Tok.is(tok::l_brace)) { in parseDoWhile()
1451 if (!FormatTok->Tok.is(tok::kw_while)) { in parseDoWhile()
1465 if (CommentsBeforeNextToken.empty() && FormatTok->Tok.is(tok::l_brace)) { in parseLabel()
1468 if (FormatTok->Tok.is(tok::kw_break)) { in parseLabel()
1475 if (FormatTok->is(tok::semi)) in parseLabel()
1483 assert(FormatTok->Tok.is(tok::kw_case) && "'case' expected"); in parseCaseLabel()
1487 } while (!eof() && !FormatTok->Tok.is(tok::colon)); in parseCaseLabel()
1492 assert(FormatTok->Tok.is(tok::kw_switch) && "'switch' expected"); in parseSwitch()
1494 if (FormatTok->Tok.is(tok::l_paren)) in parseSwitch()
1496 if (FormatTok->Tok.is(tok::l_brace)) { in parseSwitch()
1514 if (FormatTok->Tok.is(tok::colon)) in parseAccessSpecifier()
1521 if (FormatTok->Tok.is(tok::kw_enum)) in parseEnum()
1525 if (FormatTok->Tok.is(tok::kw_class) || FormatTok->Tok.is(tok::kw_struct)) in parseEnum()
1529 FormatTok->isOneOf(tok::colon, tok::coloncolon, tok::less, in parseEnum()
1530 tok::greater, tok::comma, tok::question)) { in parseEnum()
1533 if (FormatTok->is(tok::l_paren)) in parseEnum()
1535 if (FormatTok->is(tok::identifier)) { in parseEnum()
1540 FormatTok->is(tok::identifier)) in parseEnum()
1546 if (FormatTok->isNot(tok::l_brace)) in parseEnum()
1562 if (FormatTok->is(tok::semi)) in parseEnum()
1580 if (Tok->is(tok::r_brace)) in parseJavaEnumBody()
1582 if (Tok->isOneOf(tok::l_brace, tok::semi)) { in parseJavaEnumBody()
1606 if (FormatTok->is(tok::l_brace)) { in parseJavaEnumBody()
1610 } else if (FormatTok->is(tok::l_paren)) { in parseJavaEnumBody()
1612 } else if (FormatTok->is(tok::comma)) { in parseJavaEnumBody()
1615 } else if (FormatTok->is(tok::semi)) { in parseJavaEnumBody()
1619 } else if (FormatTok->is(tok::r_brace)) { in parseJavaEnumBody()
1640 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::hashhash, in parseRecord()
1641 tok::kw___attribute, tok::kw___declspec, in parseRecord()
1642 tok::kw_alignas) || in parseRecord()
1645 FormatTok->isOneOf(tok::period, tok::comma))) { in parseRecord()
1647 FormatTok->is(tok::identifier) && in parseRecord()
1651 if (!IsNonMacroIdentifier && FormatTok->Tok.is(tok::l_paren)) in parseRecord()
1665 if (FormatTok->isOneOf(tok::colon, tok::less)) { in parseRecord()
1667 if (FormatTok->is(tok::l_brace)) { in parseRecord()
1672 if (FormatTok->Tok.is(tok::semi)) in parseRecord()
1677 if (FormatTok->Tok.is(tok::l_brace)) { in parseRecord()
1690 assert(FormatTok->Tok.is(tok::less) && "'<' expected."); in parseObjCProtocolList()
1693 while (!eof() && FormatTok->Tok.isNot(tok::greater)); in parseObjCProtocolList()
1699 if (FormatTok->Tok.isObjCAtKeyword(tok::objc_end)) { in parseObjCUntilAtEnd()
1704 if (FormatTok->is(tok::l_brace)) { in parseObjCUntilAtEnd()
1708 } else if (FormatTok->is(tok::r_brace)) { in parseObjCUntilAtEnd()
1723 if (FormatTok->Tok.is(tok::colon)) { in parseObjCInterfaceOrImplementation()
1726 } else if (FormatTok->Tok.is(tok::l_paren)) in parseObjCInterfaceOrImplementation()
1730 if (FormatTok->Tok.is(tok::less)) in parseObjCInterfaceOrImplementation()
1733 if (FormatTok->Tok.is(tok::l_brace)) { in parseObjCInterfaceOrImplementation()
1750 if (FormatTok->Tok.is(tok::less)) in parseObjCProtocol()
1754 if (FormatTok->Tok.is(tok::semi)) { in parseObjCProtocol()
1764 assert(FormatTok->isOneOf(Keywords.kw_import, tok::kw_export)); in parseJavaScriptEs6ImportExport()
1768 if (FormatTok->is(tok::kw_default)) in parseJavaScriptEs6ImportExport()
1778 if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, tok::kw_enum, in parseJavaScriptEs6ImportExport()
1782 if (FormatTok->is(tok::l_brace)) { in parseJavaScriptEs6ImportExport()
1787 while (!eof() && FormatTok->isNot(tok::semi) && in parseJavaScriptEs6ImportExport()
1788 FormatTok->isNot(tok::l_brace)) { in parseJavaScriptEs6ImportExport()
1833 bool UnwrappedLineParser::eof() const { return FormatTok->Tok.is(tok::eof); } in eof()
1868 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) && in readToken()
1899 if (!FormatTok->Tok.is(tok::comment)) in readToken()