Lines Matching refs:tok

26 void Parser::MaybeSkipAttributes(tok::ObjCKeywordKind Kind) {
28 if (Tok.is(tok::kw___attribute)) {
29 if (Kind == tok::objc_interface || Kind == tok::objc_protocol)
31 << (Kind == tok::objc_protocol);
49 if (Tok.is(tok::code_completion)) {
57 case tok::objc_class:
59 case tok::objc_interface: {
64 case tok::objc_protocol: {
68 case tok::objc_implementation:
70 case tok::objc_end:
72 case tok::objc_compatibility_alias:
75 case tok::objc_synthesize:
78 case tok::objc_dynamic:
81 case tok::objc_import:
89 SkipUntil(tok::semi);
108 MaybeSkipAttributes(tok::objc_class);
109 if (Tok.isNot(tok::identifier)) {
111 SkipUntil(tok::semi);
118 if (Tok.isNot(tok::comma))
125 if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
183 assert(Tok.isObjCAtKeyword(tok::objc_interface) &&
189 if (Tok.is(tok::code_completion)) {
195 MaybeSkipAttributes(tok::objc_interface);
197 if (Tok.isNot(tok::identifier)) {
205 if (Tok.is(tok::l_paren) &&
208 BalancedDelimiterTracker T(*this, tok::l_paren);
213 if (Tok.is(tok::code_completion)) {
220 if (Tok.is(tok::identifier)) {
242 if (Tok.is(tok::less) &&
256 if (Tok.is(tok::l_brace))
257 ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, AtLoc);
259 ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
266 if (Tok.is(tok::colon)) { // a super class is specified.
270 if (Tok.is(tok::code_completion)) {
276 if (Tok.isNot(tok::identifier)) {
287 if (Tok.is(tok::less) &&
292 if (Tok.isNot(tok::less))
302 if (Tok.is(tok::l_brace))
303 ParseObjCClassInstanceVariables(ClsType, tok::objc_protected, AtLoc);
305 ParseObjCInterfaceDeclList(tok::objc_interface, ClsType);
320 tok::ObjCKeywordKind MethodImplKind;
326 tok::ObjCKeywordKind MethodImplKind) :
387 void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
392 tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
398 if (Tok.is(tok::minus) || Tok.is(tok::plus)) {
406 SkipUntil(tok::at, StopAtSemi | StopBeforeMatch);
407 if (Tok.is(tok::semi))
412 if (Tok.is(tok::l_paren)) {
415 tok::minus,
420 if (Tok.is(tok::semi)) {
426 if (Tok.is(tok::eof))
430 if (Tok.is(tok::code_completion)) {
438 if (Tok.isNot(tok::at)) {
442 if (Tok.is(tok::r_brace))
451 if (Tok.is(tok::code_completion)) {
456 tok::ObjCKeywordKind DirectiveKind = Tok.getObjCKeywordID();
458 if (DirectiveKind == tok::objc_end) { // @end -> terminate list
462 } else if (DirectiveKind == tok::objc_not_keyword) {
464 SkipUntil(tok::semi);
479 SkipUntil(tok::r_brace, tok::at, StopAtSemi);
482 case tok::objc_implementation:
483 case tok::objc_interface:
491 case tok::objc_required:
492 case tok::objc_optional:
495 if (contextKey != tok::objc_protocol)
501 case tok::objc_property:
508 if (Tok.is(tok::l_paren)) {
520 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list);
527 if (Tok.is(tok::code_completion)) {
530 } else if (Tok.isObjCAtKeyword(tok::objc_end)) {
567 assert(Tok.getKind() == tok::l_paren);
568 BalancedDelimiterTracker T(*this, tok::l_paren);
572 if (Tok.is(tok::code_completion)) {
613 if (ExpectAndConsume(tok::equal, DiagID, "", tok::r_paren))
616 if (Tok.is(tok::code_completion)) {
631 SkipUntil(tok::r_paren, StopAtSemi);
639 if (ExpectAndConsume(tok::colon,
641 tok::r_paren))
649 SkipUntil(tok::r_paren, StopAtSemi);
653 if (Tok.isNot(tok::comma))
672 Decl *Parser::ParseObjCMethodPrototype(tok::ObjCKeywordKind MethodImplKind,
674 assert((Tok.is(tok::minus) || Tok.is(tok::plus)) && "expected +/-");
676 tok::TokenKind methodType = Tok.getKind();
698 case tok::ampamp:
699 case tok::ampequal:
700 case tok::amp:
701 case tok::pipe:
702 case tok::tilde:
703 case tok::exclaim:
704 case tok::exclaimequal:
705 case tok::pipepipe:
706 case tok::pipeequal:
707 case tok::caret:
708 case tok::caretequal: {
712 Tok.setKind(tok::identifier);
719 case tok::identifier:
720 case tok::kw_asm:
721 case tok::kw_auto:
722 case tok::kw_bool:
723 case tok::kw_break:
724 case tok::kw_case:
725 case tok::kw_catch:
726 case tok::kw_char:
727 case tok::kw_class:
728 case tok::kw_const:
729 case tok::kw_const_cast:
730 case tok::kw_continue:
731 case tok::kw_default:
732 case tok::kw_delete:
733 case tok::kw_do:
734 case tok::kw_double:
735 case tok::kw_dynamic_cast:
736 case tok::kw_else:
737 case tok::kw_enum:
738 case tok::kw_explicit:
739 case tok::kw_export:
740 case tok::kw_extern:
741 case tok::kw_false:
742 case tok::kw_float:
743 case tok::kw_for:
744 case tok::kw_friend:
745 case tok::kw_goto:
746 case tok::kw_if:
747 case tok::kw_inline:
748 case tok::kw_int:
749 case tok::kw_long:
750 case tok::kw_mutable:
751 case tok::kw_namespace:
752 case tok::kw_new:
753 case tok::kw_operator:
754 case tok::kw_private:
755 case tok::kw_protected:
756 case tok::kw_public:
757 case tok::kw_register:
758 case tok::kw_reinterpret_cast:
759 case tok::kw_restrict:
760 case tok::kw_return:
761 case tok::kw_short:
762 case tok::kw_signed:
763 case tok::kw_sizeof:
764 case tok::kw_static:
765 case tok::kw_static_cast:
766 case tok::kw_struct:
767 case tok::kw_switch:
768 case tok::kw_template:
769 case tok::kw_this:
770 case tok::kw_throw:
771 case tok::kw_true:
772 case tok::kw_try:
773 case tok::kw_typedef:
774 case tok::kw_typeid:
775 case tok::kw_typename:
776 case tok::kw_typeof:
777 case tok::kw_union:
778 case tok::kw_unsigned:
779 case tok::kw_using:
780 case tok::kw_virtual:
781 case tok::kw_void:
782 case tok::kw_volatile:
783 case tok::kw_wchar_t:
784 case tok::kw_while:
785 case tok::kw__Bool:
786 case tok::kw__Complex:
787 case tok::kw___alignof:
800 return (getLangOpts().ObjC2 && Tok.is(tok::identifier) &&
818 if (Tok.is(tok::code_completion)) {
824 if (Tok.isNot(tok::identifier))
898 assert(Tok.is(tok::l_paren) && "expected (");
900 BalancedDelimiterTracker T(*this, tok::l_paren);
931 Tok.is(tok::identifier)) {
941 if (Tok.is(tok::r_paren))
946 SkipUntil(tok::r_paren, StopAtSemi);
984 tok::TokenKind mType,
985 tok::ObjCKeywordKind MethodImplKind,
989 if (Tok.is(tok::code_completion)) {
990 Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
999 if (Tok.is(tok::l_paren))
1007 if (Tok.is(tok::code_completion)) {
1008 Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
1019 if (!SelIdent && Tok.isNot(tok::colon)) { // missing selector name.
1023 SkipUntil(tok::at, StopAtSemi | StopBeforeMatch);
1028 if (Tok.isNot(tok::colon)) {
1057 if (Tok.isNot(tok::colon)) {
1064 if (Tok.is(tok::l_paren)) // Parse the argument type if present.
1078 if (Tok.is(tok::code_completion)) {
1081 mType == tok::minus,
1088 if (Tok.isNot(tok::identifier)) {
1105 if (Tok.is(tok::code_completion)) {
1107 mType == tok::minus,
1116 if (!SelIdent && Tok.isNot(tok::colon))
1132 while (Tok.is(tok::comma)) {
1134 if (Tok.is(tok::ellipsis)) {
1186 assert(Tok.is(tok::less) && "expected <");
1193 if (Tok.is(tok::code_completion)) {
1200 if (Tok.isNot(tok::identifier)) {
1202 SkipUntil(tok::greater, StopAtSemi);
1210 if (Tok.isNot(tok::comma))
1229 assert(Tok.is(tok::less) && "Protocol qualifiers start with '<'");
1281 tok::ObjCKeywordKind visibility,
1283 assert(Tok.is(tok::l_brace) && "expected {");
1289 BalancedDelimiterTracker T(*this, tok::l_brace);
1292 while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
1296 if (Tok.is(tok::semi)) {
1302 if (Tok.is(tok::at)) { // parse objc-visibility-spec
1305 if (Tok.is(tok::code_completion)) {
1311 case tok::objc_private:
1312 case tok::objc_public:
1313 case tok::objc_protected:
1314 case tok::objc_package:
1319 case tok::objc_end:
1322 Tok.setKind(tok::at);
1335 if (Tok.is(tok::code_completion)) {
1344 tok::ObjCKeywordKind visibility;
1347 ObjCIvarCallback(Parser &P, Decl *IDecl, tok::ObjCKeywordKind V,
1370 if (Tok.is(tok::semi)) {
1375 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
1402 assert(Tok.isObjCAtKeyword(tok::objc_protocol) &&
1406 if (Tok.is(tok::code_completion)) {
1412 MaybeSkipAttributes(tok::objc_protocol);
1414 if (Tok.isNot(tok::identifier)) {
1422 if (Tok.is(tok::semi)) { // forward declaration of one protocol.
1431 if (Tok.is(tok::comma)) { // list of forward declarations.
1438 if (Tok.isNot(tok::identifier)) {
1440 SkipUntil(tok::semi);
1447 if (Tok.isNot(tok::comma))
1451 if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol"))
1465 if (Tok.is(tok::less) &&
1477 ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType);
1493 assert(Tok.isObjCAtKeyword(tok::objc_implementation) &&
1499 if (Tok.is(tok::code_completion)) {
1505 MaybeSkipAttributes(tok::objc_implementation);
1507 if (Tok.isNot(tok::identifier)) {
1516 if (Tok.is(tok::l_paren)) {
1522 if (Tok.is(tok::code_completion)) {
1528 if (Tok.is(tok::identifier)) {
1535 if (Tok.isNot(tok::r_paren)) {
1537 SkipUntil(tok::r_paren); // don't stop at ';'
1541 if (Tok.is(tok::less)) { // we have illegal '<' try to recover
1555 if (Tok.is(tok::colon)) {
1558 if (Tok.isNot(tok::identifier)) {
1569 if (Tok.is(tok::l_brace)) // we have ivars
1570 ParseObjCClassInstanceVariables(ObjCImpDecl, tok::objc_private, AtLoc);
1571 else if (Tok.is(tok::less)) { // we have illegal '<' try to recover
1585 while (!ObjCImplParsing.isFinished() && Tok.isNot(tok::eof)) {
1601 assert(Tok.isObjCAtKeyword(tok::objc_end) &&
1615 if (P.Tok.is(tok::eof)) {
1654 assert(Tok.isObjCAtKeyword(tok::objc_compatibility_alias) &&
1657 if (Tok.isNot(tok::identifier)) {
1663 if (Tok.isNot(tok::identifier)) {
1669 ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
1687 assert(Tok.isObjCAtKeyword(tok::objc_synthesize) &&
1692 if (Tok.is(tok::code_completion)) {
1698 if (Tok.isNot(tok::identifier)) {
1700 SkipUntil(tok::semi);
1708 if (Tok.is(tok::equal)) {
1712 if (Tok.is(tok::code_completion)) {
1718 if (Tok.isNot(tok::identifier)) {
1727 if (Tok.isNot(tok::comma))
1731 ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@synthesize");
1743 assert(Tok.isObjCAtKeyword(tok::objc_dynamic) &&
1747 if (Tok.is(tok::code_completion)) {
1753 if (Tok.isNot(tok::identifier)) {
1755 SkipUntil(tok::semi);
1764 if (Tok.isNot(tok::comma))
1768 ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@dynamic");
1778 if (Tok.isNot(tok::semi)) {
1781 SkipUntil(tok::semi);
1786 ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@throw");
1796 if (Tok.isNot(tok::l_paren)) {
1805 if (Tok.is(tok::r_paren)) {
1812 SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);
1816 if (Tok.isNot(tok::l_brace)) {
1857 if (Tok.isNot(tok::l_brace)) {
1869 while (Tok.is(tok::at)) {
1874 if (!AfterAt.isObjCAtKeyword(tok::objc_catch) &&
1875 !AfterAt.isObjCAtKeyword(tok::objc_finally))
1879 if (Tok.isObjCAtKeyword(tok::objc_catch)) {
1882 if (Tok.is(tok::l_paren)) {
1885 if (Tok.isNot(tok::ellipsis)) {
1899 if (Tok.is(tok::r_paren))
1902 SkipUntil(tok::r_paren, StopAtSemi);
1905 if (Tok.is(tok::l_brace))
1926 assert(Tok.isObjCAtKeyword(tok::objc_finally) && "Lookahead confused?");
1931 if (Tok.is(tok::l_brace))
1959 if (Tok.isNot(tok::l_brace)) {
1984 if (Tok.is(tok::kw_try)) {
1986 if (Tok.is(tok::colon)) {
1989 while (Tok.isNot(tok::l_brace)) {
1990 ConsumeAndStoreUntil(tok::l_paren, Toks, /*StopAtSemi=*/false);
1991 ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
1996 else if (Tok.is(tok::colon)) {
1998 while (Tok.isNot(tok::l_brace)) {
1999 ConsumeAndStoreUntil(tok::l_paren, Toks, /*StopAtSemi=*/false);
2000 ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
2006 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
2007 while (Tok.is(tok::kw_catch)) {
2008 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
2009 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
2022 if (Tok.is(tok::semi)) {
2031 if (Tok.isNot(tok::l_brace)) {
2035 SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);
2038 if (Tok.isNot(tok::l_brace))
2044 SkipUntil(tok::r_brace);
2058 if (Tok.is(tok::code_completion)) {
2064 if (Tok.isObjCAtKeyword(tok::objc_try))
2067 if (Tok.isObjCAtKeyword(tok::objc_throw))
2070 if (Tok.isObjCAtKeyword(tok::objc_synchronized))
2073 if (Tok.isObjCAtKeyword(tok::objc_autoreleasepool))
2081 SkipUntil(tok::semi);
2092 case tok::code_completion:
2097 case tok::minus:
2098 case tok::plus: {
2099 tok::TokenKind Kind = Tok.getKind();
2102 if (!Tok.is(tok::numeric_constant)) {
2105 case tok::minus: Symbol = "-"; break;
2106 case tok::plus: Symbol = "+"; break;
2128 case tok::string_literal: // primary-expression: string-literal
2129 case tok::wide_string_literal:
2132 case tok::char_constant:
2135 case tok::numeric_constant:
2138 case tok::kw_true: // Objective-C++, etc.
2139 case tok::kw___objc_yes: // c/c++/objc/objc++ __objc_yes
2141 case tok::kw_false: // Objective-C++, etc.
2142 case tok::kw___objc_no: // c/c++/objc/objc++ __objc_no
2145 case tok::l_square:
2149 case tok::l_brace:
2153 case tok::l_paren:
2162 case tok::objc_encode:
2164 case tok::objc_protocol:
2166 case tok::objc_selector:
2170 if (GetLookAheadToken(1).is(tok::l_brace)) {
2214 if (Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
2215 Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope))
2237 if (Tok.is(tok::l_paren)) {
2282 assert(Tok.is(tok::l_square) && getLangOpts().ObjC1 &&
2284 return GetLookAheadToken(1).is(tok::identifier) &&
2285 GetLookAheadToken(2).is(tok::identifier);
2289 if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) ||
2296 if (Tok.is(tok::annot_typename))
2298 else if (Tok.is(tok::identifier))
2306 if (AfterNext.is(tok::colon) || AfterNext.is(tok::r_square)) {
2307 if (Tok.is(tok::identifier))
2310 return Tok.is(tok::annot_typename);
2327 assert(Tok.is(tok::l_square) && "'[' expected");
2330 if (Tok.is(tok::code_completion)) {
2345 if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
2346 NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope())
2354 SkipUntil(tok::r_square, StopAtSemi);
2368 if (Tok.is(tok::identifier)) {
2374 NextToken().is(tok::period),
2382 SkipUntil(tok::r_square, StopAtSemi);
2400 SkipUntil(tok::r_square, StopAtSemi);
2453 if (Tok.is(tok::code_completion)) {
2475 if (Tok.is(tok::colon)) {
2481 if (Tok.isNot(tok::colon)) {
2486 SkipUntil(tok::r_square, StopAtSemi);
2493 if (Tok.is(tok::code_completion)) {
2512 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
2523 SkipUntil(tok::r_square, StopAtSemi);
2531 if (Tok.is(tok::code_completion)) {
2550 if (!selIdent && Tok.isNot(tok::colon))
2555 while (Tok.is(tok::comma)) {
2560 if (Tok.is(tok::colon)) {
2567 SkipUntil(tok::r_square, StopAtSemi);
2580 SkipUntil(tok::r_square, StopAtSemi);
2584 if (Tok.isNot(tok::r_square)) {
2585 if (Tok.is(tok::identifier))
2592 SkipUntil(tok::r_square, StopAtSemi);
2627 while (Tok.is(tok::at)) {
2687 if (Tok.isNot(tok::l_paren))
2690 BalancedDelimiterTracker T(*this, tok::l_paren);
2711 while (Tok.isNot(tok::r_square)) {
2718 SkipUntil(tok::r_square, StopAtSemi);
2723 if (Tok.is(tok::ellipsis))
2730 if (Tok.is(tok::comma))
2732 else if (Tok.isNot(tok::r_square))
2743 while (Tok.isNot(tok::r_brace)) {
2753 SkipUntil(tok::r_brace, StopAtSemi);
2758 if (Tok.is(tok::colon)) {
2762 SkipUntil(tok::r_brace, StopAtSemi);
2771 SkipUntil(tok::r_brace, StopAtSemi);
2777 if (Tok.is(tok::ellipsis) && getLangOpts().CPlusPlus)
2787 if (Tok.is(tok::comma))
2789 else if (Tok.isNot(tok::r_brace))
2803 assert(Tok.isObjCAtKeyword(tok::objc_encode) && "Not an @encode expression!");
2807 if (Tok.isNot(tok::l_paren))
2810 BalancedDelimiterTracker T(*this, tok::l_paren);
2830 if (Tok.isNot(tok::l_paren))
2833 BalancedDelimiterTracker T(*this, tok::l_paren);
2836 if (Tok.isNot(tok::identifier))
2854 if (Tok.isNot(tok::l_paren))
2860 BalancedDelimiterTracker T(*this, tok::l_paren);
2863 if (Tok.is(tok::code_completion)) {
2871 Tok.isNot(tok::colon) && Tok.isNot(tok::coloncolon))
2876 if (Tok.isNot(tok::r_paren)) {
2878 if (Tok.is(tok::coloncolon)) { // Handle :: in C++.
2881 } else if (Tok.isNot(tok::colon))
2886 if (Tok.is(tok::r_paren))
2889 if (Tok.is(tok::code_completion)) {
2899 if (!SelIdent && Tok.isNot(tok::colon) && Tok.isNot(tok::coloncolon))
2931 assert((Tok.is(tok::l_brace) || Tok.is(tok::kw_try) ||
2932 Tok.is(tok::colon)) &&
2946 if (Tok.is(tok::kw_try))
2949 if (Tok.is(tok::colon))
2962 while (Tok.getLocation() != OrigLoc && Tok.isNot(tok::eof))