Home | History | Annotate | Download | only in Lex

Lines Matching refs:Tok

85 /// current line until the tok::eod token is found.
90 assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive tokens");
91 } while (Tmp.isNot(tok::eod));
103 if (MacroNameTok.is(tok::code_completion)) {
111 if (MacroNameTok.is(tok::eod)) {
131 } else if (isDefineUndef && II->getPPKeywordID() == tok::pp_defined) {
147 // token kind to tok::eod.
148 MacroNameTok.setKind(tok::eod);
152 /// CheckEndOfDirective - Ensure that the next token is a tok::eod token. If
167 while (Tmp.is(tok::comment)) // Skip comments in -C mode.
170 if (Tmp.isNot(tok::eod)) {
212 Token Tok;
214 CurLexer->Lex(Tok);
216 if (Tok.is(tok::code_completion)) {
224 if (Tok.is(tok::eof)) {
239 if (Tok.isNot(tok::hash) || !Tok.isAtStartOfLine())
250 LexUnexpandedToken(Tok);
254 if (Tok.isNot(tok::raw_identifier)) {
266 const char *RawCharData = Tok.getRawIdentifierData();
278 // that we can't use Tok.getIdentifierInfo() because its lookup is disabled
282 if (!Tok.needsCleaning() && Tok.getLength() < 20) {
283 Directive = StringRef(RawCharData, Tok.getLength());
285 std::string DirectiveStr = getSpelling(Tok);
305 CurPPLexer->pushConditionalLevel(Tok.getLocation(), /*wasskipping*/true,
332 if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_else_after_else);
371 if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_elif_after_else);
396 Callbacks->SourceRangeSkipped(SourceRange(BeginLoc, Tok.getLocation()));
419 Token Tok;
420 LexUnexpandedToken(Tok);
424 tok::PPKeywordKind K = Tok.getIdentifierInfo()->getPPKeywordID();
426 if (K == tok::pp_else) {
450 assert(K == tok::pp_elif);
455 Diag(Tok, diag::pp_err_elif_after_else);
584 case tok::eod:
586 case tok::comment:
590 case tok::code_completion:
596 case tok::numeric_constant: // # 7 GNU line marker directive.
608 case tok::pp_if:
610 case tok::pp_ifdef:
612 case tok::pp_ifndef:
614 case tok::pp_elif:
616 case tok::pp_else:
618 case tok::pp_endif:
622 case tok::pp_include:
625 case tok::pp___include_macros:
630 case tok::pp_define:
632 case tok::pp_undef:
636 case tok::pp_line:
640 case tok::pp_error:
644 case tok::pp_pragma:
648 case tok::pp_import:
650 case tok::pp_include_next:
653 case tok::pp_warning:
656 case tok::pp_ident:
658 case tok::pp_sccs:
660 case tok::pp_assert:
663 case tok::pp_unassert:
667 case tok::pp___export_macro__:
669 case tok::pp___private_macro__:
687 if (Result.is(tok::hashhash))
688 Toks[1].setKind(tok::unknown);
710 if (DigitTok.isNot(tok::numeric_constant)) {
713 if (DigitTok.isNot(tok::eod))
764 void Preprocessor::HandleLineDirective(Token &Tok) {
791 if (StrTok.is(tok::eod))
793 else if (StrTok.isNot(tok::string_literal)) {
830 if (FlagTok.is(tok::eod)) return false;
838 if (FlagTok.is(tok::eod)) return false;
864 if (FlagTok.is(tok::eod)) return false;
879 if (FlagTok.is(tok::eod)) return false;
893 if (FlagTok.is(tok::eod)) return false;
925 if (StrTok.is(tok::eod))
927 else if (StrTok.isNot(tok::string_literal)) {
975 void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
988 Diag(Tok, diag::pp_hash_warning) << Message;
990 Diag(Tok, diag::err_pp_hash_error) << Message;
995 void Preprocessor::HandleIdentSCCSDirective(Token &Tok) {
997 Diag(Tok, diag::ext_pp_ident_directive);
1004 if (StrTok.isNot(tok::string_literal) &&
1005 StrTok.isNot(tok::wide_string_literal)) {
1007 if (StrTok.isNot(tok::eod))
1019 Callbacks->Ident(Tok.getLocation(), Str);
1024 void Preprocessor::HandleMacroExportDirective(Token &Tok) {
1029 if (MacroNameTok.is(tok::eod))
1055 void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
1060 if (MacroNameTok.is(tok::eod))
1150 while (CurTok.isNot(tok::eod)) {
1154 if (CurTok.is(tok::code_completion)) {
1181 if (CurTok.is(tok::greater))
1212 case tok::eod:
1216 case tok::angle_string_literal:
1217 case tok::string_literal:
1222 case tok::less:
1378 assert(TmpTok.isNot(tok::eof) && "Didn't find end of -imacros!");
1379 } while (TmpTok.isNot(tok::hashhash));
1393 Token Tok;
1395 LexUnexpandedToken(Tok);
1396 switch (Tok.getKind()) {
1397 case tok::r_paren:
1402 Diag(Tok, diag::err_pp_expected_ident_in_arg_list);
1404 case tok::ellipsis: // #define X(... -> C99 varargs
1406 Diag(Tok, Features.CPlusPlus0x ?
1411 LexUnexpandedToken(Tok);
1412 if (Tok.isNot(tok::r_paren)) {
1413 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
1421 case tok::eod: // #define X(
1422 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
1427 IdentifierInfo *II = Tok.getIdentifierInfo();
1430 Diag(Tok, diag::err_pp_invalid_tok_in_arg_list);
1438 Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II;
1446 LexUnexpandedToken(Tok);
1448 switch (Tok.getKind()) {
1450 Diag(Tok, diag::err_pp_expected_comma_in_arg_list);
1452 case tok::r_paren: // #define X(A)
1455 case tok::comma: // #define X(A,
1457 case tok::ellipsis: // #define X(A... -> GCC extension
1459 Diag(Tok, diag::ext_named_variadic_macro);
1462 LexUnexpandedToken(Tok);
1463 if (Tok.isNot(tok::r_paren)) {
1464 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
1485 if (MacroNameTok.is(tok::eod))
1497 Token Tok;
1498 LexUnexpandedToken(Tok);
1503 if (Tok.is(tok::eod)) {
1505 } else if (Tok.hasLeadingSpace()) {
1508 Tok.clearFlag(Token::LeadingSpace);
1509 } else if (Tok.is(tok::l_paren)) {
1531 LexUnexpandedToken(Tok);
1535 Diag(Tok, diag::ext_c99_whitespace_required_after_macro_name);
1544 if (Tok.is(tok::at)) // @ is not in the list above.
1546 else if (Tok.is(tok::unknown)) {
1553 Diag(Tok, diag::ext_missing_whitespace_after_macro_name);
1555 Diag(Tok, diag::warn_missing_whitespace_after_macro_name);
1558 if (!Tok.is(tok::eod))
1559 LastTok = Tok;
1564 while (Tok.isNot(tok::eod)) {
1565 LastTok = Tok;
1566 MI->AddTokenToBody(Tok);
1568 LexUnexpandedToken(Tok);
1575 while (Tok.isNot(tok::eod)) {
1576 LastTok = Tok;
1578 if (Tok.isNot(tok::hash)) {
1579 MI->AddTokenToBody(Tok);
1582 LexUnexpandedToken(Tok);
1587 LexUnexpandedToken(Tok);
1590 if (Tok.getIdentifierInfo() == 0 ||
1591 MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
1595 // the kind of the token to tok::unknown so that the preprocessor isn't
1597 if (getLangOptions().AsmPreprocessor && Tok.isNot(tok::eod)) {
1598 LastTok.setKind(tok::unknown);
1600 Diag(Tok, diag::err_pp_stringize_not_parameter);
1611 MI->AddTokenToBody(Tok);
1612 LastTok = Tok;
1615 LexUnexpandedToken(Tok);
1627 if (MI->getReplacementToken(0).is(tok::hashhash)) {
1632 if (MI->getReplacementToken(NumTokens-1).is(tok::hashhash)) {
1692 if (MacroNameTok.is(tok::eod))
1738 if (MacroNameTok.is(tok::eod)) {