Lines Matching defs:tok

78   Tok.setKind(tok::eof);
123 static bool IsCommonTypo(tok::TokenKind ExpectedTok, const Token &Tok) {
125 case tok::semi:
126 return Tok.is(tok::colon) || Tok.is(tok::comma); // : or , for ;
131 bool Parser::ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned DiagID,
133 if (Tok.is(ExpectedTok) || Tok.is(tok::code_completion)) {
144 SourceRange(Loc), tok::getPunctuatorSpelling(ExpectedTok));
161 Spelling = tok::getPunctuatorSpelling(ExpectedTok);
178 if (TryConsumeToken(tok::semi))
181 if (Tok.is(tok::code_completion)) {
186 if ((Tok.is(tok::r_paren) || Tok.is(tok::r_square)) &&
187 NextToken().is(tok::semi)) {
196 return ExpectAndConsume(tok::semi, DiagID);
200 if (!Tok.is(tok::semi)) return;
207 while ((Tok.is(tok::semi) && !Tok.isAtStartOfLine())) {
252 bool Parser::SkipUntil(ArrayRef<tok::TokenKind> Toks, SkipUntilFlags Flags) {
272 if (Toks.size() == 1 && Toks[0] == tok::eof &&
275 while (Tok.isNot(tok::eof))
281 case tok::eof:
285 case tok::annot_pragma_openmp:
286 case tok::annot_pragma_openmp_end:
288 case tok::annot_module_begin:
289 case tok::annot_module_end:
290 case tok::annot_module_include:
296 case tok::code_completion:
301 case tok::l_paren:
305 SkipUntil(tok::r_paren, StopAtCodeCompletion);
307 SkipUntil(tok::r_paren);
309 case tok::l_square:
313 SkipUntil(tok::r_square, StopAtCodeCompletion);
315 SkipUntil(tok::r_square);
317 case tok::l_brace:
321 SkipUntil(tok::r_brace, StopAtCodeCompletion);
323 SkipUntil(tok::r_brace);
331 case tok::r_paren:
336 case tok::r_square:
341 case tok::r_brace:
347 case tok::string_literal:
348 case tok::wide_string_literal:
349 case tok::utf8_string_literal:
350 case tok::utf16_string_literal:
351 case tok::utf32_string_literal:
355 case tok::semi:
547 if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
552 case tok::annot_pragma_unused:
556 case tok::annot_module_include:
563 case tok::annot_module_begin:
569 case tok::annot_module_end:
575 case tok::eof:
635 case tok::annot_pragma_vis:
638 case tok::annot_pragma_pack:
641 case tok::annot_pragma_msstruct:
644 case tok::annot_pragma_align:
647 case tok::annot_pragma_weak:
650 case tok::annot_pragma_weakalias:
653 case tok::annot_pragma_redefine_extname:
656 case tok::annot_pragma_fp_contract:
659 case tok::annot_pragma_opencl_extension:
662 case tok::annot_pragma_openmp: {
666 case tok::annot_pragma_ms_pointers_to_members:
669 case tok::annot_pragma_ms_vtordisp:
672 case tok::annot_pragma_ms_pragma:
675 case tok::annot_pragma_dump:
678 case tok::semi:
685 case tok::r_brace:
689 case tok::eof:
692 case tok::kw___extension__: {
698 case tok::kw_asm: {
715 ExpectAndConsume(tok::semi, diag::err_expected_after,
723 case tok::at:
725 case tok::minus:
726 case tok::plus:
734 case tok::code_completion:
740 case tok::kw_using:
741 case tok::kw_namespace:
742 case tok::kw_typedef:
743 case tok::kw_template:
744 case tok::kw_export: // As in 'export template'
745 case tok::kw_static_assert:
746 case tok::kw__Static_assert:
753 case tok::kw_static:
756 if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) {
764 case tok::kw_inline:
766 tok::TokenKind NextKind = NextToken().getKind();
769 if (NextKind == tok::kw_namespace) {
776 if (NextKind == tok::kw_template) {
785 case tok::kw_extern:
786 if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) {
800 case tok::kw___if_exists:
801 case tok::kw___if_not_exists:
820 if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) {
822 if (KW.is(tok::kw_default) || KW.is(tok::kw_delete))
826 return Tok.is(tok::equal) || // int X()= -> not a function def
827 Tok.is(tok::comma) || // int X(), -> not a function def
828 Tok.is(tok::semi) || // int X(); -> not a function def
829 Tok.is(tok::kw_asm) || // int X() __asm__ -> not a function def
830 Tok.is(tok::kw___attribute) || // int X() __attr__ -> not a function def
832 Tok.is(tok::l_paren)); // int X(0) -> not a function def [C++]
839 if (Tok.is(tok::l_brace)) // int X() {}
847 if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) {
849 return KW.is(tok::kw_default) || KW.is(tok::kw_delete);
852 return Tok.is(tok::colon) || // X() : Base() {} (used for ctors)
853 Tok.is(tok::kw_try); // X() try { ... }
887 if (Tok.is(tok::semi)) {
906 if (getLangOpts().ObjC2 && Tok.is(tok::at)) {
908 if (!Tok.isObjCAtKeyword(tok::objc_interface) &&
909 !Tok.isObjCAtKeyword(tok::objc_protocol)) {
911 SkipUntil(tok::semi); // FIXME: better skip?
923 if (Tok.isObjCAtKeyword(tok::objc_protocol))
1003 if (Tok.isNot(tok::l_brace) &&
1005 (Tok.isNot(tok::colon) && Tok.isNot(tok::kw_try) &&
1006 Tok.isNot(tok::equal)))) {
1010 SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);
1013 if (Tok.isNot(tok::l_brace))
1019 if (Tok.isNot(tok::equal)) {
1033 if (getLangOpts().DelayedTemplateParsing && Tok.isNot(tok::equal) &&
1065 (Tok.is(tok::l_brace) || Tok.is(tok::kw_try) ||
1066 Tok.is(tok::colon)) &&
1109 if (TryConsumeToken(tok::equal)) {
1114 if (TryConsumeToken(tok::kw_delete, KWLoc)) {
1121 } else if (TryConsumeToken(tok::kw_default, KWLoc)) {
1131 if (Tok.is(tok::comma)) {
1134 SkipUntil(tok::semi);
1135 } else if (ExpectAndConsume(tok::semi, diag::err_expected_after,
1137 SkipUntil(tok::semi);
1152 if (Tok.is(tok::kw_try))
1157 if (Tok.is(tok::colon)) {
1161 if (!Tok.is(tok::l_brace)) {
1177 if (Tok.is(tok::equal)) {
1178 SkipUntil(tok::semi);
1182 bool IsFunctionTryBlock = Tok.is(tok::kw_try);
1190 SkipUntil(tok::r_brace);
1191 while (IsFunctionTryBlock && Tok.is(tok::kw_catch)) {
1192 SkipUntil(tok::l_brace);
1193 SkipUntil(tok::r_brace);
1222 if (TryConsumeToken(tok::semi)) {
1285 if (Tok.isNot(tok::comma))
1302 if (SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch))
1304 TryConsumeToken(tok::semi);
1344 assert(Tok.is(tok::kw_asm) && "Not an asm!");
1347 if (Tok.is(tok::kw_volatile)) {
1357 BalancedDelimiterTracker T(*this, tok::l_paren);
1370 } else if (SkipUntil(tok::r_paren, StopAtSemi | StopBeforeMatch)) {
1382 TemplateIdAnnotation *Parser::takeTemplateIdAnnotation(const Token &tok) {
1383 assert(tok.is(tok::annot_template_id) && "Expected template-id token");
1385 Id = static_cast<TemplateIdAnnotation *>(tok.getAnnotationValue());
1396 Tok.setKind(tok::annot_cxxscope);
1419 assert(Tok.is(tok::identifier) || Tok.is(tok::annot_cxxscope));
1422 const bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
1429 if (Tok.isNot(tok::identifier) || SS.isInvalid()) {
1447 return Tok.is(tok::annot_typename) ? ANK_Success : ANK_TentativeDecl;
1486 if (getLangOpts().ObjC1 && NextToken().is(tok::less) &&
1500 Tok.setKind(tok::annot_typename);
1509 Tok.setKind(tok::annot_primary_expr);
1518 if (Next.isNot(tok::less)) {
1549 assert(Tok.isNot(tok::identifier));
1555 Tok.setKind(tok::identifier);
1582 assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
1583 Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope) ||
1584 Tok.is(tok::kw_decltype) || Tok.is(tok::annot_template_id) ||
1585 Tok.is(tok::kw___super)) &&
1588 if (Tok.is(tok::kw_typename)) {
1595 if (getLangOpts().MSVCCompat && NextToken().is(tok::kw_typedef)) {
1619 if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id) ||
1620 Tok.is(tok::annot_decltype)) {
1622 if (Tok.is(tok::annot_decltype) ||
1640 if (Tok.is(tok::identifier)) {
1645 } else if (Tok.is(tok::annot_template_id)) {
1671 Tok.setKind(tok::annot_typename);
1680 bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
1693 /// specifier was extracted from an existing tok::annot_cxxscope annotation.
1698 if (Tok.is(tok::identifier)) {
1703 false, NextToken().is(tok::period), nullptr,
1717 if (getLangOpts().ObjC1 && NextToken().is(tok::less) &&
1733 Tok.setKind(tok::annot_typename);
1752 if (NextToken().is(tok::less)) {
1780 if (Tok.is(tok::annot_template_id)) {
1809 assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
1810 (Tok.is(tok::annot_template_id) && NextToken().is(tok::coloncolon)) ||
1811 Tok.is(tok::kw_decltype) || Tok.is(tok::kw___super)) &&
1825 tok::TokenKind Kind = Tok.getKind();
1829 case tok::ampequal: // &=
1830 case tok::starequal: // *=
1831 case tok::plusequal: // +=
1832 case tok::minusequal: // -=
1833 case tok::exclaimequal: // !=
1834 case tok::slashequal: // /=
1835 case tok::percentequal: // %=
1836 case tok::lessequal: // <=
1837 case tok::lesslessequal: // <<=
1838 case tok::greaterequal: // >=
1839 case tok::greatergreaterequal: // >>=
1840 case tok::caretequal: // ^=
1841 case tok::pipeequal: // |=
1842 case tok::equalequal: // ==
1846 case tok::equal:
1852 assert(Tok.is(tok::code_completion));
1905 assert((Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists)) &&
1907 Result.IsIfExists = Tok.is(tok::kw___if_exists);
1910 BalancedDelimiterTracker T(*this, tok::l_paren);
1967 BalancedDelimiterTracker Braces(*this, tok::l_brace);
1969 Diag(Tok, diag::err_expected) << tok::l_brace;
1988 while (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
2000 assert(Tok.isObjCAtKeyword(tok::objc_import) &&
2008 if (!Tok.is(tok::identifier)) {
2009 if (Tok.is(tok::code_completion)) {
2016 SkipUntil(tok::semi);
2024 if (Tok.is(tok::period)) {
2053 case tok::annot_module_end:
2057 case tok::annot_module_begin:
2061 case tok::annot_module_include:
2087 tok::TokenKind SkipToTok) {
2090 if (SkipToTok != tok::unknown)
2104 if (P.Tok.is(tok::annot_module_end))
2112 if (P.Tok.isNot(tok::r_paren) && P.Tok.isNot(tok::r_brace) &&
2113 P.Tok.isNot(tok::r_square) &&