Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

33   if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) {
84 assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
122 if (Tok.is(tok::kw_export)) {
128 if (Tok.is(tok::kw_template)) {
131 Diag(Tok.getLocation(), diag::err_expected_template);
141 SkipUntil(tok::r_brace, true, true);
142 if (Tok.is(tok::semi))
159 } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
211 if (Tok.is(tok::kw_using))
224 if (Tok.is(tok::semi)) {
237 SkipUntil(tok::r_brace, true, true);
238 if (Tok.is(tok::semi))
249 if (Tok.is(tok::comma)) {
250 Diag(Tok, diag::err_multiple_template_declarators)
252 SkipUntil(tok::semi, true, false);
257 ExpectAndConsume(tok::semi, diag::err_expected_semi_declaration);
265 Diag(Tok, diag::err_function_declared_typedef);
267 if (Tok.is(tok::l_brace)) {
272 SkipUntil(tok::r_brace, true);
274 SkipUntil(tok::semi);
282 Diag(Tok, diag::err_expected_fn_body);
284 Diag(Tok, diag::err_invalid_token_after_toplevel_declarator);
285 SkipUntil(tok::semi);
303 if (!Tok.is(tok::less)) {
304 Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
310 if (Tok.is(tok::greater))
313 if (!Tok.is(tok::greater)) {
314 Diag(Tok.getLocation(), diag::err_expected_greater);
340 SkipUntil(tok::comma, tok::greater, true, true);
344 if (Tok.is(tok::comma)) {
346 } else if (Tok.is(tok::greater)) {
355 Diag(Tok.getLocation(), diag::err_expected_comma_greater);
356 SkipUntil(tok::greater, true, true);
366 if (Tok.is(tok::kw_class)) {
370 case tok::equal:
371 case tok::comma:
372 case tok::greater:
373 case tok::greatergreater:
374 case tok::ellipsis:
377 case tok::identifier:
387 case tok::equal:
388 case tok::comma:
389 case tok::greater:
390 case tok::greatergreater:
398 if (Tok.isNot(tok::kw_typename))
410 if (Next.getKind() == tok::identifier)
414 case tok::equal:
415 case tok::comma:
416 case tok::greater:
417 case tok::greatergreater:
418 case tok::ellipsis:
445 if (Tok.is(tok::kw_template))
464 assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
468 bool TypenameKeyword = Tok.is(tok::kw_typename);
474 if (Tok.is(tok::ellipsis)) {
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)) {
495 Diag(Tok.getLocation(), diag::err_expected_ident);
504 if (Tok.is(tok::equal)) {
524 assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
540 if (!Tok.is(tok::kw_class)) {
541 Diag(Tok.getLocation(), diag::err_expected_class_before)
542 << PP.getSpelling(Tok);
549 if (Tok.is(tok::ellipsis)) {
561 if (Tok.is(tok::identifier)) {
562 ParamName = Tok.getIdentifierInfo();
564 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) || Tok.is(tok::greater)) {
568 Diag(Tok.getLocation(), diag::err_expected_ident);
584 if (Tok.is(tok::equal)) {
588 Diag(Tok.getLocation(),
590 static const tok::TokenKind EndToks[] = {
591 tok::comma, tok::greater, tok::greatergreater
625 Diag(Tok.getLocation(), diag::err_parse_error);
626 SkipUntil(tok::comma, tok::greater, true, true);
635 if (Tok.is(tok::equal)) {
647 SkipUntil(tok::comma, tok::greater, true, true);
682 assert(Tok.is(tok::less) && "Must have already parsed the template-name");
691 if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater))
696 SkipUntil(tok::greater, true, !ConsumeLastToken);
702 if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater)) {
703 Diag(Tok.getLocation(), diag::err_expected_greater);
709 RAngleLoc = Tok.getLocation();
711 if (Tok.is(tok::greatergreater)) {
713 if (NextToken().is(tok::greater) || NextToken().is(tok::greatergreater))
716 Diag(Tok.getLocation(), getLang().CPlusPlus0x ?
719 << FixItHint::CreateReplacement(SourceRange(Tok.getLocation()),
722 Tok.setKind(tok::greater);
726 PP.EnterToken(Tok);
777 assert(Template && Tok.is(tok::less) &&
795 if (Tok.is(tok::greater))
813 if (Tok.is(tok::greater))
818 Tok.setKind(tok::annot_typename);
819 setTypeAnnotation(Tok, Type.get());
821 Tok.setLocation(SS.getBeginLoc());
823 Tok.setLocation(TemplateKWLoc);
825 Tok.setLocation(TemplateNameLoc);
829 Tok.setKind(tok::annot_template_id);
848 Tok.setAnnotationValue(TemplateId);
850 Tok.setLocation(TemplateKWLoc);
852 Tok.setLocation(TemplateNameLoc);
858 Tok.setAnnotationEndLoc(RAngleLoc);
862 PP.AnnotateCachedTokens(Tok);
873 assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
875 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
892 Tok.setKind(tok::annot_typename);
893 setTypeAnnotation(Tok, Type.isInvalid() ? ParsedType() : Type.get());
895 Tok.setLocation(TemplateId->SS.getBeginLoc());
900 PP.AnnotateCachedTokens(Tok);
904 static bool isEndOfTemplateArgument(Token Tok) {
905 return Tok.is(tok::comma) || Tok.is(tok::greater) ||
906 Tok.is(tok::greatergreater);
911 if (!Tok.is(tok::identifier) && !Tok.is(tok::coloncolon) &&
912 !Tok.is(tok::annot_cxxscope))
932 if (SS.isSet() && Tok.is(tok::kw_template)) {
937 if (Tok.is(tok::identifier)) {
940 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
944 if (Tok.is(tok::ellipsis))
951 if (isEndOfTemplateArgument(Tok) &&
959 } else if (Tok.is(tok::identifier)) {
963 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
967 if (Tok.is(tok::ellipsis))
970 if (isEndOfTemplateArgument(Tok)) {
1008 SourceLocation Loc = Tok.getLocation();
1035 SourceLocation Loc = Tok.getLocation();
1059 if (!Tok.is(tok::less))
1064 if (Tok.is(tok::greater))
1072 return Tok.is(tok::greater) || Tok.is(tok::comma);
1085 if (Tok.is(tok::ellipsis)) {
1091 SkipUntil(tok::comma, tok::greater, true, true);
1100 if (Tok.isNot(tok::comma)) break;
1209 LMT.Toks.push_back(Tok);
1214 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try))
1232 if (Tok.is(tok::kw_try)) {
1235 if (Tok.is(tok::colon))
1240 if (Tok.is(tok::l_brace)) {
1261 tok::TokenKind kind = Tok.getKind();
1264 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
1268 if (kind == tok::kw_try) {
1269 while (Tok.is(tok::kw_catch)) {
1270 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
1271 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);