Lines Matching refs:Tok
32 assert(Tok.isOneOf(tok::l_brace, tok::colon, tok::kw_try, tok::equal) &&
59 if (TryConsumeToken(tok::equal)) {
61 SkipUntil(tok::semi);
67 SourceLocation KWEndLoc = Tok.getEndLoc().getLocWithOffset(-1);
68 if (TryConsumeToken(tok::kw_delete, KWLoc)) {
78 } else if (TryConsumeToken(tok::kw_default, KWLoc)) {
91 if (Tok.is(tok::comma)) {
94 SkipUntil(tok::semi);
95 } else if (ExpectAndConsume(tok::semi, diag::err_expected_after,
97 SkipUntil(tok::semi);
135 tok::TokenKind kind = Tok.getKind();
150 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
154 if (kind == tok::kw_try) {
155 while (Tok.is(tok::kw_catch)) {
156 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
157 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
191 assert(Tok.isOneOf(tok::l_brace, tok::equal) &&
199 tok::TokenKind kind = Tok.getKind();
200 if (kind == tok::equal) {
201 Toks.push_back(Tok);
205 if (kind == tok::l_brace) {
207 Toks.push_back(Tok);
211 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/true);
221 Eof.setKind(tok::eof);
222 Eof.setLocation(Tok.getLocation());
321 DefArgEnd.setKind(tok::eof);
327 Toks->push_back(Tok); // So that the current token doesn't get lost
334 assert(Tok.is(tok::equal) && "Default argument not starting with '='");
344 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
345 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
353 if (Tok.isNot(tok::eof) || Tok.getEofData() != Param) {
355 // Tok; the last token in the default argument is the one before
358 Diag(Tok.getLocation(), diag::err_default_arg_unparsed)
359 << SourceRange(Tok.getLocation(),
368 while (Tok.isNot(tok::eof))
371 if (Tok.is(tok::eof) && Tok.getEofData() == Param)
395 ExceptionSpecEnd.setKind(tok::eof);
401 Toks->push_back(Tok); // So that the current token doesn't get lost
437 if (Tok.isNot(tok::eof) || Tok.getEofData() != LM.Method)
438 Diag(Tok.getLocation(), diag::err_except_spec_unparsed);
450 while (Tok.isNot(tok::eof))
454 if (Tok.is(tok::eof) && Tok.getEofData() == LM.Method)
500 BodyEnd.setKind(tok::eof);
506 LM.Toks.push_back(Tok);
511 assert(Tok.isOneOf(tok::l_brace, tok::colon, tok::kw_try)
519 if (Tok.is(tok::kw_try)) {
522 while (Tok.isNot(tok::eof))
525 if (Tok.is(tok::eof) && Tok.getEofData() == LM.D)
529 if (Tok.is(tok::colon)) {
533 if (!Tok.is(tok::l_brace)) {
537 while (Tok.isNot(tok::eof))
540 if (Tok.is(tok::eof) && Tok.getEofData() == LM.D)
560 while (Tok.isNot(tok::eof))
563 if (Tok.is(tok::eof) && Tok.getEofData() == LM.D)
619 MI.Toks.push_back(Tok);
636 if (Tok.isNot(tok::eof)) {
640 EndLoc = Tok.getLocation();
646 while (Tok.isNot(tok::eof))
650 if (Tok.getEofData() == MI.Field)
660 bool Parser::ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2,
668 if (Tok.is(T1) || Tok.is(T2)) {
670 Toks.push_back(Tok);
676 switch (Tok.getKind()) {
677 case tok::eof:
678 case tok::annot_module_begin:
679 case tok::annot_module_end:
680 case tok::annot_module_include:
684 case tok::l_paren:
686 Toks.push_back(Tok);
688 ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
690 case tok::l_square:
692 Toks.push_back(Tok);
694 ConsumeAndStoreUntil(tok::r_square, Toks, /*StopAtSemi=*/false);
696 case tok::l_brace:
698 Toks.push_back(Tok);
700 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
708 case tok::r_paren:
711 Toks.push_back(Tok);
714 case tok::r_square:
717 Toks.push_back(Tok);
720 case tok::r_brace:
723 Toks.push_back(Tok);
727 case tok::code_completion:
728 Toks.push_back(Tok);
732 case tok::string_literal:
733 case tok::wide_string_literal:
734 case tok::utf8_string_literal:
735 case tok::utf16_string_literal:
736 case tok::utf32_string_literal:
737 Toks.push_back(Tok);
740 case tok::semi:
746 Toks.push_back(Tok);
761 if (Tok.is(tok::kw_try)) {
762 Toks.push_back(Tok);
766 if (Tok.isNot(tok::colon)) {
772 ConsumeAndStoreUntil(tok::l_brace, tok::r_brace, Toks,
775 if (Tok.isNot(tok::l_brace))
776 return Diag(Tok.getLocation(), diag::err_expected) << tok::l_brace;
778 Toks.push_back(Tok);
783 Toks.push_back(Tok);
800 if (Tok.is(tok::kw_decltype)) {
801 Toks.push_back(Tok);
803 if (Tok.isNot(tok::l_paren))
804 return Diag(Tok.getLocation(), diag::err_expected_lparen_after)
806 Toks.push_back(Tok);
808 if (!ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/true)) {
809 Diag(Tok.getLocation(), diag::err_expected) << tok::r_paren;
810 Diag(OpenLoc, diag::note_matching) << tok::l_paren;
816 if (Tok.is(tok::coloncolon)) {
817 Toks.push_back(Tok);
820 if (Tok.is(tok::kw_template)) {
821 Toks.push_back(Tok);
826 if (Tok.isOneOf(tok::identifier, tok::kw_template)) {
827 Toks.push_back(Tok);
829 } else if (Tok.is(tok::code_completion)) {
830 Toks.push_back(Tok);
840 } while (Tok.is(tok::coloncolon));
842 if (Tok.is(tok::less))
852 if (!ConsumeAndStoreUntil(tok::l_paren, tok::l_brace, Toks,
857 Tok.getLocation(), diag::err_expected) << tok::l_brace;
859 } else if (Tok.isNot(tok::l_paren) && Tok.isNot(tok::l_brace)) {
862 return Diag(Tok.getLocation(), diag::err_expected_either)
863 << tok::l_paren << tok::l_brace;
865 return Diag(Tok.getLocation(), diag::err_expected) << tok::l_paren;
868 tok::TokenKind kind = Tok.getKind();
869 Toks.push_back(Tok);
870 bool IsLParen = (kind == tok::l_paren);
871 SourceLocation OpenLoc = Tok.getLocation();
876 assert(kind == tok::l_brace && "Must be left paren or brace here.");
887 tok::TokenKind CloseKind = IsLParen ? tok::r_paren : tok::r_brace;
889 Diag(Tok, diag::err_expected) << CloseKind;
895 if (Tok.is(tok::ellipsis)) {
896 Toks.push_back(Tok);
902 if (Tok.is(tok::comma)) {
903 Toks.push_back(Tok);
905 } else if (Tok.is(tok::l_brace)) {
920 Toks.push_back(Tok);
924 return Diag(Tok.getLocation(), diag::err_expected_either) << tok::l_brace
925 << tok::comma;
934 assert(Tok.is(tok::question));
935 Toks.push_back(Tok);
938 while (Tok.isNot(tok::colon)) {
939 if (!ConsumeAndStoreUntil(tok::question, tok::colon, Toks,
945 if (Tok.is(tok::question) && !ConsumeAndStoreConditional(Toks))
950 Toks.push_back(Tok);
959 tok::TokenKind EndKind)
976 Buffer[Toks.size() - 1] = Self.Tok;
979 Self.Tok = Toks.front();
986 tok::TokenKind EndKind;
1007 switch (Tok.getKind()) {
1008 case tok::comma:
1028 ? tok::semi : tok::r_paren);
1038 if (Result == TPResult::Ambiguous && Tok.isNot(tok::semi))
1070 case tok::eof:
1071 case tok::annot_module_begin:
1072 case tok::annot_module_end:
1073 case tok::annot_module_include:
1077 case tok::less:
1083 case tok::question:
1090 case tok::greatergreatergreater:
1096 case tok::greatergreater:
1102 case tok::greater:
1107 case tok::kw_template:
1111 Toks.push_back(Tok);
1113 if (Tok.is(tok::identifier)) {
1114 Toks.push_back(Tok);
1116 if (Tok.is(tok::less)) {
1119 Toks.push_back(Tok);
1125 case tok::kw_operator:
1128 Toks.push_back(Tok);
1130 switch (Tok.getKind()) {
1131 case tok::comma:
1132 case tok::greatergreatergreater:
1133 case tok::greatergreater:
1134 case tok::greater:
1135 case tok::less:
1136 Toks.push_back(Tok);
1144 case tok::l_paren:
1146 Toks.push_back(Tok);
1148 ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
1150 case tok::l_square:
1152 Toks.push_back(Tok);
1154 ConsumeAndStoreUntil(tok::r_square, Toks, /*StopAtSemi=*/false);
1156 case tok::l_brace:
1158 Toks.push_back(Tok);
1160 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
1169 case tok::r_paren:
1174 Toks.push_back(Tok);
1177 case tok::r_square:
1180 Toks.push_back(Tok);
1183 case tok::r_brace:
1186 Toks.push_back(Tok);
1190 case tok::code_completion:
1191 Toks.push_back(Tok);
1195 case tok::string_literal:
1196 case tok::wide_string_literal:
1197 case tok::utf8_string_literal:
1198 case tok::utf16_string_literal:
1199 case tok::utf32_string_literal:
1200 Toks.push_back(Tok);
1203 case tok::semi:
1209 Toks.push_back(Tok);