1 //===--- TokenKinds.h - Enum values for C Token Kinds -----------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file defines the TokenKind enum and support functions. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_CLANG_TOKENKINDS_H 15 #define LLVM_CLANG_TOKENKINDS_H 16 17 namespace clang { 18 19 namespace tok { 20 21 /// TokenKind - This provides a simple uniform namespace for tokens from all C 22 /// languages. 23 enum TokenKind { 24 #define TOK(X) X, 25 #include "clang/Basic/TokenKinds.def" 26 NUM_TOKENS 27 }; 28 29 /// PPKeywordKind - This provides a namespace for preprocessor keywords which 30 /// start with a '#' at the beginning of the line. 31 enum PPKeywordKind { 32 #define PPKEYWORD(X) pp_##X, 33 #include "clang/Basic/TokenKinds.def" 34 NUM_PP_KEYWORDS 35 }; 36 37 /// ObjCKeywordKind - This provides a namespace for Objective-C keywords which 38 /// start with an '@'. 39 enum ObjCKeywordKind { 40 #define OBJC1_AT_KEYWORD(X) objc_##X, 41 #define OBJC2_AT_KEYWORD(X) objc_##X, 42 #include "clang/Basic/TokenKinds.def" 43 NUM_OBJC_KEYWORDS 44 }; 45 46 /// OnOffSwitch - This defines the possible values of an on-off-switch 47 /// (C99 6.10.6p2). 48 enum OnOffSwitch { 49 OOS_ON, OOS_OFF, OOS_DEFAULT 50 }; 51 52 /// \brief Determines the name of a token as used within the front end. 53 /// 54 /// The name of a token will be an internal name (such as "l_square") 55 /// and should not be used as part of diagnostic messages. 56 const char *getTokenName(enum TokenKind Kind); 57 58 /// \brief Determines the spelling of simple punctuation tokens like 59 /// '!' or '%', and returns NULL for literal and annotation tokens. 60 /// 61 /// This routine only retrieves the "simple" spelling of the token, 62 /// and will not produce any alternative spellings (e.g., a 63 /// digraph). For the actual spelling of a given Token, use 64 /// Preprocessor::getSpelling(). 65 const char *getTokenSimpleSpelling(enum TokenKind Kind); 66 67 } // end namespace tok 68 } // end namespace clang 69 70 #endif 71