Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

33   if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) {
64 assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
104 TryConsumeToken(tok::kw_export, ExportLoc);
108 if (!TryConsumeToken(tok::kw_template, TemplateLoc)) {
109 Diag(Tok.getLocation(), diag::err_expected_template);
119 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
120 TryConsumeToken(tok::semi);
137 } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
179 if (Tok.is(tok::kw_using))
190 if (Tok.is(tok::semi)) {
214 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
215 if (Tok.is(tok::semi))
239 Diag(Tok, diag::err_template_defn_explicit_instantiation) << 0;
271 if (Tok.is(tok::comma)) {
272 Diag(Tok, diag::err_multiple_template_declarators)
274 SkipUntil(tok::semi);
300 if (!TryConsumeToken(tok::less, LAngleLoc)) {
301 Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
307 if (!Tok.is(tok::greater) && !Tok.is(tok::greatergreater))
310 if (Tok.is(tok::greatergreater)) {
316 Tok.setKind(tok::greater);
317 RAngleLoc = Tok.getLocation();
318 Tok.setLocation(Tok.getLocation().getLocWithOffset(1));
319 } else if (!TryConsumeToken(tok::greater, RAngleLoc) && Failed) {
320 Diag(Tok.getLocation(), diag::err_expected) << tok::greater;
344 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
349 if (Tok.is(tok::comma)) {
351 } else if (Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
358 Diag(Tok.getLocation(), diag::err_expected_comma_greater);
359 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
370 if (Tok.is(tok::kw_class)) {
374 case tok::equal:
375 case tok::comma:
376 case tok::greater:
377 case tok::greatergreater:
378 case tok::ellipsis:
381 case tok::identifier:
391 case tok::equal:
392 case tok::comma:
393 case tok::greater:
394 case tok::greatergreater:
402 if (Tok.isNot(tok::kw_typename))
414 if (Next.getKind() == tok::identifier)
418 case tok::equal:
419 case tok::comma:
420 case tok::greater:
421 case tok::greatergreater:
422 case tok::ellipsis:
449 if (Tok.is(tok::kw_template))
468 assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
472 bool TypenameKeyword = Tok.is(tok::kw_typename);
477 if (TryConsumeToken(tok::ellipsis, EllipsisLoc)) {
487 if (Tok.is(tok::identifier)) {
488 ParamName = Tok.getIdentifierInfo();
490 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
491 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
495 Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
501 if (TryConsumeToken(tok::ellipsis, EllipsisLoc))
509 if (TryConsumeToken(tok::equal, EqualLoc))
531 assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
550 if (!TryConsumeToken(tok::kw_class)) {
551 bool Replace = Tok.is(tok::kw_typename) || Tok.is(tok::kw_struct);
552 const Token &Next = Tok.is(tok::kw_struct) ? NextToken() : Tok;
553 if (Tok.is(tok::kw_typename)) {
554 Diag(Tok.getLocation(),
559 ? FixItHint::CreateReplacement(Tok.getLocation(), "class")
561 } else if (Next.is(tok::identifier) || Next.is(tok::comma) ||
562 Next.is(tok::greater) || Next.is(tok::greatergreater) ||
563 Next.is(tok::ellipsis)) {
564 Diag(Tok.getLocation(), diag::err_class_on_template_template_param)
565 << (Replace ? FixItHint::CreateReplacement(Tok.getLocation(), "class")
566 : FixItHint::CreateInsertion(Tok.getLocation(), "class "));
568 Diag(Tok.getLocation(), diag::err_class_on_template_template_param);
576 if (TryConsumeToken(tok::ellipsis, EllipsisLoc))
585 if (Tok.is(tok::identifier)) {
586 ParamName = Tok.getIdentifierInfo();
588 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
589 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
593 Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
599 if (TryConsumeToken(tok::ellipsis, EllipsisLoc))
614 if (TryConsumeToken(tok::equal, EqualLoc)) {
617 Diag(Tok.getLocation(),
619 SkipUntil(tok::comma, tok::greater, tok::greatergreater,
648 Diag(Tok.getLocation(), diag::err_expected_template_parameter);
654 if (TryConsumeToken(tok::ellipsis, EllipsisLoc))
662 if (TryConsumeToken(tok::equal, EqualLoc)) {
673 SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch);
718 tok::TokenKind RemainingToken;
721 switch (Tok.getKind()) {
723 Diag(Tok.getLocation(), diag::err_expected) << tok::greater;
726 case tok::greater:
729 RAngleLoc = Tok.getLocation();
734 case tok::greatergreater:
735 RemainingToken = tok::greater;
738 case tok::greatergreatergreater:
739 RemainingToken = tok::greatergreater;
742 case tok::greaterequal:
743 RemainingToken = tok::equal;
747 case tok::greatergreaterequal:
748 RemainingToken = tok::greaterequal;
756 // tok::greatergreatergreater, rather than two separate tokens.
758 RAngleLoc = Tok.getLocation();
776 if ((RemainingToken == tok::greater ||
777 RemainingToken == tok::greatergreater) &&
778 (Next.is(tok::greater) || Next.is(tok::greatergreater) ||
779 Next.is(tok::greatergreatergreater) || Next.is(tok::equal) ||
780 Next.is(tok::greaterequal) || Next.is(tok::greatergreaterequal) ||
781 Next.is(tok::equalequal)) &&
782 areTokensAdjacent(Tok, Next))
787 (Tok.is(tok::greatergreater) || Tok.is(tok::greatergreatergreater)))
789 else if (Tok.is(tok::greaterequal))
791 Diag(Tok.getLocation(), DiagId) << Hint1 << Hint2;
794 if (RemainingToken == tok::equal && Next.is(tok::equal) &&
795 areTokensAdjacent(Tok, Next)) {
800 Tok.setKind(tok::equalequal);
801 Tok.setLength(Tok.getLength() + 1);
803 Tok.setKind(RemainingToken);
804 Tok.setLength(Tok.getLength() - 1);
806 Tok.setLocation(Lexer::AdvanceToTokenCharacter(RAngleLoc, 1,
813 PP.EnterToken(Tok);
814 Tok.setKind(tok::greater);
815 Tok.setLength(1);
816 Tok.setLocation(RAngleLoc);
848 assert(Tok.is(tok::less) && "Must have already parsed the template-name");
857 if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater))
863 SkipUntil(tok::greater, StopAtSemi);
865 SkipUntil(tok::greater, StopAtSemi | StopBeforeMatch);
916 assert(Template && Tok.is(tok::less) &&
934 TryConsumeToken(tok::greater);
949 TryConsumeToken(tok::greater);
953 Tok.setKind(tok::annot_typename);
954 setTypeAnnotation(Tok, Type.get());
956 Tok.setLocation(SS.getBeginLoc());
958 Tok.setLocation(TemplateKWLoc);
960 Tok.setLocation(TemplateNameLoc);
964 Tok.setKind(tok::annot_template_id);
984 Tok.setAnnotationValue(TemplateId);
986 Tok.setLocation(TemplateKWLoc);
988 Tok.setLocation(TemplateNameLoc);
992 Tok.setAnnotationEndLoc(RAngleLoc);
996 PP.AnnotateCachedTokens(Tok);
1007 assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
1009 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
1026 Tok.setKind(tok::annot_typename);
1027 setTypeAnnotation(Tok, Type.isInvalid() ? ParsedType() : Type.get());
1029 Tok.setLocation(TemplateId->SS.getBeginLoc());
1034 PP.AnnotateCachedTokens(Tok);
1038 static bool isEndOfTemplateArgument(Token Tok) {
1039 return Tok.is(tok::comma) || Tok.is(tok::greater) ||
1040 Tok.is(tok::greatergreater);
1045 if (!Tok.is(tok::identifier) && !Tok.is(tok::coloncolon) &&
1046 !Tok.is(tok::annot_cxxscope))
1066 if (SS.isSet() && Tok.is(tok::kw_template)) {
1071 if (Tok.is(tok::identifier)) {
1074 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1077 TryConsumeToken(tok::ellipsis, EllipsisLoc);
1083 if (isEndOfTemplateArgument(Tok) &&
1091 } else if (Tok.is(tok::identifier)) {
1095 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1098 TryConsumeToken(tok::ellipsis, EllipsisLoc);
1100 if (isEndOfTemplateArgument(Tok)) {
1138 SourceLocation Loc = Tok.getLocation();
1165 SourceLocation Loc = Tok.getLocation();
1189 if (!TryConsumeToken(tok::less))
1193 if (Tok.is(tok::greater))
1201 return Tok.is(tok::greater) || Tok.is(tok::comma);
1219 if (TryConsumeToken(tok::ellipsis, EllipsisLoc))
1223 SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch);
1232 } while (TryConsumeToken(tok::comma));
1317 LPT.Toks.push_back(Tok);
1322 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try))
1334 if (Tok.is(tok::kw_try)) {
1337 if (Tok.is(tok::colon))
1342 if (Tok.is(tok::l_brace)) {
1365 tok::TokenKind kind = Tok.getKind();
1368 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
1372 if (kind == tok::kw_try) {
1373 while (Tok.is(tok::kw_catch)) {
1374 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
1375 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);