clang API Documentation

TokenKinds.h
Go to the documentation of this file.
00001 //===--- TokenKinds.h - Enum values for C Token Kinds -----------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the TokenKind enum and support functions.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_CLANG_TOKENKINDS_H
00015 #define LLVM_CLANG_TOKENKINDS_H
00016 
00017 namespace clang {
00018 
00019 namespace tok {
00020 
00021 /// TokenKind - This provides a simple uniform namespace for tokens from all C
00022 /// languages.
00023 enum TokenKind {
00024 #define TOK(X) X,
00025 #include "clang/Basic/TokenKinds.def"
00026   NUM_TOKENS
00027 };
00028 
00029 /// PPKeywordKind - This provides a namespace for preprocessor keywords which
00030 /// start with a '#' at the beginning of the line.
00031 enum PPKeywordKind {
00032 #define PPKEYWORD(X) pp_##X,
00033 #include "clang/Basic/TokenKinds.def"
00034   NUM_PP_KEYWORDS
00035 };
00036 
00037 /// ObjCKeywordKind - This provides a namespace for Objective-C keywords which
00038 /// start with an '@'.
00039 enum ObjCKeywordKind {
00040 #define OBJC1_AT_KEYWORD(X) objc_##X,
00041 #define OBJC2_AT_KEYWORD(X) objc_##X,
00042 #include "clang/Basic/TokenKinds.def"
00043   NUM_OBJC_KEYWORDS
00044 };
00045 
00046 /// OnOffSwitch - This defines the possible values of an on-off-switch
00047 /// (C99 6.10.6p2).
00048 enum OnOffSwitch {
00049   OOS_ON, OOS_OFF, OOS_DEFAULT
00050 };
00051 
00052 /// \brief Determines the name of a token as used within the front end.
00053 ///
00054 /// The name of a token will be an internal name (such as "l_square")
00055 /// and should not be used as part of diagnostic messages.
00056 const char *getTokenName(enum TokenKind Kind);
00057 
00058 /// \brief Determines the spelling of simple punctuation tokens like
00059 /// '!' or '%', and returns NULL for literal and annotation tokens.
00060 ///
00061 /// This routine only retrieves the "simple" spelling of the token,
00062 /// and will not produce any alternative spellings (e.g., a
00063 /// digraph). For the actual spelling of a given Token, use
00064 /// Preprocessor::getSpelling().
00065 const char *getTokenSimpleSpelling(enum TokenKind Kind);
00066 
00067 }  // end namespace tok
00068 }  // end namespace clang
00069 
00070 #endif