Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

92   tok::TokenKind Kind  = Tok.getKind();
95 case tok::at: // May be a @try or @throw statement
101 case tok::code_completion:
106 case tok::identifier: {
108 if (Next.is(tok::colon)) { // C99 6.8.1: labeled-statement
113 if (Next.isNot(tok::coloncolon)) {
115 IdentifierInfo *Name = Tok.getIdentifierInfo();
116 SourceLocation NameLoc = Tok.getLocation();
128 if (Name->getTokenID() != tok::identifier) {
129 Tok.setIdentifierInfo(Name);
130 Tok.setKind(Name->getTokenID());
141 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
142 if (Tok.is(tok::semi))
152 Tok.setKind(tok::annot_typename);
153 setTypeAnnotation(Tok, Classification.getType());
154 Tok.setAnnotationEndLoc(NameLoc);
155 PP.AnnotateCachedTokens(Tok);
159 Tok.setKind(tok::annot_primary_expr);
160 setExprAnnotation(Tok, Classification.getExpression());
161 Tok.setAnnotationEndLoc(NameLoc);
162 PP.AnnotateCachedTokens(Tok);
177 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
178 if (Tok.is(tok::semi))
186 if (NextToken().is(tok::coloncolon) && TryAnnotateCXXScopeToken(false)){
189 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
190 if (Tok.is(tok::semi))
210 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
216 if (Tok.is(tok::r_brace)) {
217 Diag(Tok, diag::err_expected_statement);
224 case tok::kw_case: // C99 6.8.1: labeled-statement
226 case tok::kw_default: // C99 6.8.1: labeled-statement
229 case tok::l_brace: // C99 6.8.2: compound-statement
231 case tok::semi: { // C99 6.8.3p3: expression[opt] ';'
232 bool HasLeadingEmptyMacro = Tok.hasLeadingEmptyMacro();
236 case tok::kw_if: // C99 6.8.4.1: if-statement
238 case tok::kw_switch: // C99 6.8.4.2: switch-statement
241 case tok::kw_while: // C99 6.8.5.1: while-statement
243 case tok::kw_do: // C99 6.8.5.2: do-statement
247 case tok::kw_for: // C99 6.8.5.3: for-statement
250 case tok::kw_goto: // C99 6.8.6.1: goto-statement
254 case tok::kw_continue: // C99 6.8.6.2: continue-statement
258 case tok::kw_break: // C99 6.8.6.3: break-statement
262 case tok::kw_return: // C99 6.8.6.4: return-statement
267 case tok::kw_asm: {
277 case tok::kw_try: // C++ 15: try-block
280 case tok::kw___try:
285 if (Tok.is(tok::semi)) {
291 ExpectAndConsume(tok::semi, diag::err_expected_semi_after_stmt, SemiError);
293 SkipUntil(tok::r_brace, true, true);
302 Token OldToken = Tok;
311 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
312 if (Tok.is(tok::semi))
317 if (Tok.is(tok::colon) && getCurScope()->isSwitchScope() &&
334 assert(Tok.is(tok::kw___try) && "Expected '__try'");
349 if(Tok.isNot(tok::l_brace))
350 return StmtError(Diag(Tok,diag::err_expected_lbrace));
358 if(Tok.is(tok::kw___except)) {
361 } else if (Tok.is(tok::kw___finally)) {
365 return StmtError(Diag(Tok,diag::err_seh_expected_handler));
387 if(ExpectAndConsume(tok::l_paren,diag::err_expected_lparen))
408 if(ExpectAndConsume(tok::r_paren,diag::err_expected_rparen))
445 assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
448 Token IdentTok = Tok; // Save the whole token.
451 assert(Tok.is(tok::colon) && "Not a label!");
481 assert((MissingCase || Tok.is(tok::kw_case)) && "Not a case stmt!");
513 if (Tok.is(tok::code_completion)) {
527 SkipUntil(tok::colon);
534 if (Tok.is(tok::ellipsis)) {
535 Diag(Tok, diag::ext_gnu_case_range);
540 SkipUntil(tok::colon);
547 if (Tok.is(tok::colon)) {
551 } else if (Tok.is(tok::semi)) {
584 } while (Tok.is(tok::kw_case));
591 if (Tok.isNot(tok::r_brace)) {
620 assert(Tok.is(tok::kw_default) && "Not a default stmt!");
624 if (Tok.is(tok::colon)) {
628 } else if (Tok.is(tok::semi)) {
640 if (Tok.is(tok::r_brace)) {
691 assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
708 Tok.getLocation(),
711 BalancedDelimiterTracker T(*this, tok::l_brace);
719 while (Tok.is(tok::kw___label__)) {
725 if (Tok.isNot(tok::identifier)) {
726 Diag(Tok, diag::err_expected_ident);
730 IdentifierInfo *II = Tok.getIdentifierInfo();
734 if (!Tok.is(tok::comma))
742 StmtResult R = Actions.ActOnDeclStmt(Res, LabelLoc, Tok.getLocation());
744 ExpectAndConsume(tok::semi, diag::err_expected_semi_declaration);
749 while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
750 if (Tok.is(tok::annot_pragma_unused)) {
755 if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) ||
756 Tok.is(tok::kw___if_not_exists))) {
762 if (Tok.isNot(tok::kw___extension__)) {
770 while (Tok.is(tok::kw___extension__))
782 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
792 SkipUntil(tok::semi);
809 if (Tok.isNot(tok::r_brace)) {
810 Diag(Tok, diag::err_expected_rbrace);
837 BalancedDelimiterTracker T(*this, tok::l_paren);
855 if (ExprResult.isInvalid() && !DeclResult && Tok.isNot(tok::r_paren)) {
856 SkipUntil(tok::semi);
859 if (Tok.isNot(tok::r_paren))
879 assert(Tok.is(tok::kw_if) && "Not an if stmt!");
882 if (Tok.isNot(tok::l_paren)) {
883 Diag(Tok, diag::err_expected_lparen_after) << "if";
884 SkipUntil(tok::semi);
931 C99orCXX && Tok.isNot(tok::l_brace));
934 SourceLocation ThenStmtLoc = Tok.getLocation();
945 if (Tok.is(tok::kw_else)) {
947 ElseStmtLoc = Tok.getLocation();
959 C99orCXX && Tok.isNot(tok::l_brace));
965 } else if (Tok.is(tok::code_completion)) {
1005 assert(Tok.is(tok::kw_switch) && "Not a switch stmt!");
1008 if (Tok.isNot(tok::l_paren)) {
1009 Diag(Tok, diag::err_expected_lparen_after) << "switch";
1010 SkipUntil(tok::semi);
1047 if (Tok.is(tok::l_brace)) {
1049 SkipUntil(tok::r_brace, false, false);
1051 SkipUntil(tok::semi);
1067 C99orCXX && Tok.isNot(tok::l_brace));
1078 Body = Actions.ActOnNullStmt(Tok.getLocation());
1090 assert(Tok.is(tok::kw_while) && "Not a while stmt!");
1091 SourceLocation WhileLoc = Tok.getLocation();
1094 if (Tok.isNot(tok::l_paren)) {
1095 Diag(Tok, diag::err_expected_lparen_after) << "while";
1096 SkipUntil(tok::semi);
1142 C99orCXX && Tok.isNot(tok::l_brace));
1164 assert(Tok.is(tok::kw_do) && "Not a do stmt!");
1187 Tok.isNot(tok::l_brace));
1195 if (Tok.isNot(tok::kw_while)) {
1197 Diag(Tok, diag::err_expected_while);
1199 SkipUntil(tok::semi, false, true);
1205 if (Tok.isNot(tok::l_paren)) {
1206 Diag(Tok, diag::err_expected_lparen_after) << "do/while";
1207 SkipUntil(tok::semi, false, true);
1212 BalancedDelimiterTracker T(*this, tok::l_paren);
1247 assert(Tok.is(tok::kw_for) && "Not a for stmt!");
1250 if (Tok.isNot(tok::l_paren)) {
1251 Diag(Tok, diag::err_expected_lparen_after) << "for";
1252 SkipUntil(tok::semi);
1282 BalancedDelimiterTracker T(*this, tok::l_paren);
1296 if (Tok.is(tok::code_completion)) {
1305 if (Tok.is(tok::semi)) { // for (;
1311 Diag(Tok, diag::ext_c99_variable_decl_in_for_loop);
1320 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
1326 FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation());
1333 } else if (Tok.is(tok::semi)) { // for (int x = 4;
1340 if (Tok.is(tok::code_completion)) {
1347 Diag(Tok, diag::err_expected_semi_for);
1362 if (Tok.is(tok::semi)) {
1367 if (Tok.is(tok::code_completion)) {
1375 Diag(Tok, diag::err_expected_semi_for);
1378 SkipUntil(tok::r_paren, true, true);
1379 if (Tok.is(tok::semi))
1387 if (Tok.is(tok::semi)) { // for (...;;
1389 } else if (Tok.is(tok::r_paren)) {
1405 if (Tok.isNot(tok::semi)) {
1407 Diag(Tok, diag::err_expected_semi_for);
1410 SkipUntil(tok::r_paren, true, true);
1413 if (Tok.is(tok::semi)) {
1418 if (Tok.isNot(tok::r_paren)) { // for (...;...;)
1458 C99orCXXorObjC && Tok.isNot(tok::l_brace));
1497 assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
1501 if (Tok.is(tok::identifier)) {
1502 LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
1503 Tok.getLocation());
1504 Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(), LD);
1506 } else if (Tok.is(tok::star)) {
1508 Diag(Tok, diag::ext_gnu_indirect_goto);
1512 SkipUntil(tok::semi, false, true);
1517 Diag(Tok, diag::err_expected_ident);
1556 assert(Tok.is(tok::kw_return) && "Not a return stmt!");
1560 if (Tok.isNot(tok::semi)) {
1561 if (Tok.is(tok::code_completion)) {
1570 if (Tok.is(tok::l_brace) && getLang().CPlusPlus) {
1580 SkipUntil(tok::semi, false, true);
1601 if (Tok.is(tok::l_brace)) {
1615 SourceLocation TokLoc = Tok.getLocation();
1618 if (Tok.is(tok::eof))
1624 if (!InAsmComment && Tok.is(tok::semi)) {
1646 } else if (!InAsmComment && Tok.is(tok::r_brace)) {
1658 PP.Lex(Tok);
1661 TokLoc = Tok.getLocation();
1667 Diag(Tok, diag::err_expected_rbrace);
1672 Diag(Tok, diag::err_expected_lbrace);
1677 if (!Tok.is(tok::kw_asm))
1687 t.setKind(tok::string_literal);
1733 assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
1736 if (getLang().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) {
1741 SourceLocation Loc = Tok.getLocation();
1752 if (Tok.isNot(tok::l_paren)) {
1753 Diag(Tok, diag::err_expected_lparen_after) << "asm";
1754 SkipUntil(tok::r_paren);
1757 BalancedDelimiterTracker T(*this, tok::l_paren);
1769 if (Tok.is(tok::r_paren)) {
1781 if (Tok.is(tok::colon) || Tok.is(tok::coloncolon)) {
1783 AteExtraColon = Tok.is(tok::coloncolon);
1795 Tok.is(tok::colon) || Tok.is(tok::coloncolon)) {
1800 AteExtraColon = Tok.is(tok::coloncolon);
1816 if (AteExtraColon || Tok.is(tok::colon)) {
1821 if (Tok.isNot(tok::r_paren)) {
1830 if (Tok.isNot(tok::comma)) break;
1861 if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
1866 if (Tok.is(tok::l_square)) {
1867 BalancedDelimiterTracker T(*this, tok::l_square);
1870 if (Tok.isNot(tok::identifier)) {
1871 Diag(Tok, diag::err_expected_ident);
1872 SkipUntil(tok::r_paren);
1876 IdentifierInfo *II = Tok.getIdentifierInfo();
1886 SkipUntil(tok::r_paren);
1891 if (Tok.isNot(tok::l_paren)) {
1892 Diag(Tok, diag::err_expected_lparen_after) << "asm operand";
1893 SkipUntil(tok::r_paren);
1898 BalancedDelimiterTracker T(*this, tok::l_paren);
1903 SkipUntil(tok::r_paren);
1908 if (Tok.isNot(tok::comma)) return false;
1916 assert(Tok.is(tok::l_brace));
1917 SourceLocation LBraceLoc = Tok.getLocation();
1949 assert(Tok.is(tok::kw_try) && "Expected 'try'");
1956 if (Tok.is(tok::colon))
1968 SourceLocation LBraceLoc = Tok.getLocation();
1981 assert(Tok.is(tok::l_brace));
1989 if (SkipUntil(tok::r_brace, /*StopAtSemi=*/false, /*DontConsume=*/false,
2007 assert(Tok.is(tok::kw_try) && "Expected 'try'");
2030 if (Tok.isNot(tok::l_brace))
2031 return StmtError(Diag(Tok, diag::err_expected_lbrace));
2040 if(Tok.is(tok::kw___except) || Tok.is(tok::kw___finally)) {
2043 if(Tok.is(tok::kw___except)) {
2064 if (Tok.isNot(tok::kw_catch))
2065 return StmtError(Diag(Tok, diag::err_expected_catch));
2066 while (Tok.is(tok::kw_catch)) {
2092 assert(Tok.is(tok::kw_catch) && "Expected 'catch'");
2096 BalancedDelimiterTracker T(*this, tok::l_paren);
2108 if (Tok.isNot(tok::ellipsis)) {
2122 if (Tok.isNot(tok::l_brace))
2123 return StmtError(Diag(Tok, diag::err_expected_lbrace));
2139 if (Tok.isNot(tok::l_brace)) {
2140 Diag(Tok, diag::err_expected_lbrace);
2147 SkipUntil(tok::r_brace, false);
2152 while (Tok.isNot(tok::r_brace)) {
2158 if (Tok.isNot(tok::r_brace)) {
2159 Diag(Tok, diag::err_expected_rbrace);