//===--- TokenKinds.def - C Family Token Kind Database ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the TokenKind database.  This includes normal tokens like
// tok::ampamp (corresponding to the && token) as well as keywords for various
// languages.  Users of this file must optionally #define the TOK, KEYWORD,
// ALIAS, or PPKEYWORD macros to make use of this file.
//
//===----------------------------------------------------------------------===//

#ifndef TOK
#define TOK(X)
#endif
#ifndef KEYWORD
#define KEYWORD(X,Y) TOK(kw_ ## X)
#endif
#ifndef ALIAS
#define ALIAS(X,Y)
#endif
#ifndef PPKEYWORD
#define PPKEYWORD(X)
#endif
#ifndef CXX_KEYWORD_OPERATOR
#define CXX_KEYWORD_OPERATOR(X,Y)
#endif
#ifndef OBJC1_AT_KEYWORD
#define OBJC1_AT_KEYWORD(X)
#endif
#ifndef OBJC2_AT_KEYWORD
#define OBJC2_AT_KEYWORD(X)
#endif

//===----------------------------------------------------------------------===//
// Preprocessor keywords.
//===----------------------------------------------------------------------===//

// These have meaning after a '#' at the start of a line. These define enums in
// the tok::pp_* namespace.  Note that IdentifierInfo::getPPKeywordID must be
// manually updated if something is added here.
PPKEYWORD(not_keyword)

// C99 6.10.1 - Conditional Inclusion.
PPKEYWORD(if)
PPKEYWORD(ifdef)
PPKEYWORD(ifndef)
PPKEYWORD(elif)
PPKEYWORD(else)
PPKEYWORD(endif)
PPKEYWORD(defined)

// C99 6.10.2 - Source File Inclusion.
PPKEYWORD(include)

// C99 6.10.3 - Macro Replacement.
PPKEYWORD(define)
PPKEYWORD(undef)

// C99 6.10.4 - Line Control.
PPKEYWORD(line)

// C99 6.10.5 - Error Directive.
PPKEYWORD(error)

// C99 6.10.6 - Pragma Directive.
PPKEYWORD(pragma)

// GNU Extensions.
PPKEYWORD(import)
PPKEYWORD(include_next)
PPKEYWORD(warning)
PPKEYWORD(ident)
PPKEYWORD(sccs)
PPKEYWORD(assert)
PPKEYWORD(unassert)

//===----------------------------------------------------------------------===//
// Language keywords.
//===----------------------------------------------------------------------===//

// These define members of the tok::* namespace.

TOK(unknown)             // Not a token.
TOK(eof)                 // End of file.
TOK(eom)                 // End of macro (end of line inside a macro).

// C99 6.4.9: Comments.
TOK(comment)             // Comment (only in -E -C[C] mode)

// C99 6.4.2: Identifiers.
TOK(identifier)          // abcde123

// C99 6.4.4.1: Integer Constants
// C99 6.4.4.2: Floating Constants
TOK(numeric_constant)    // 0x123

// C99 6.4.4: Character Constants
TOK(char_constant)       // 'a'   L'b'

// C99 6.4.5: String Literals.
TOK(string_literal)      // "foo"
TOK(wide_string_literal) // L"foo"
TOK(angle_string_literal)// <foo>

// C99 6.4.6: Punctuators.
TOK(l_square)            // [
TOK(r_square)            // ]
TOK(l_paren)             // (
TOK(r_paren)             // )
TOK(l_brace)             // {
TOK(r_brace)             // }
TOK(period)              // .
TOK(ellipsis)            // ...
TOK(amp)                 // &
TOK(ampamp)              // &&
TOK(ampequal)            // &=
TOK(star)                // *
TOK(starequal)           // *=
TOK(plus)                // +
TOK(plusplus)            // ++
TOK(plusequal)           // +=
TOK(minus)               // -
TOK(arrow)               // ->
TOK(minusminus)          // --
TOK(minusequal)          // -=
TOK(tilde)               // ~
TOK(exclaim)             // !
TOK(exclaimequal)        // !=
TOK(slash)               // /
TOK(slashequal)          // /=
TOK(percent)             // %
TOK(percentequal)        // %=
TOK(less)                // <
TOK(lessless)            // <<
TOK(lessequal)           // <=
TOK(lesslessequal)       // <<=
TOK(greater)             // >
TOK(greatergreater)      // >>
TOK(greaterequal)        // >=
TOK(greatergreaterequal) // >>=
TOK(caret)               // ^
TOK(caretequal)          // ^=
TOK(pipe)                // |
TOK(pipepipe)            // ||
TOK(pipeequal)           // |=
TOK(question)            // ?
TOK(colon)               // :
TOK(semi)                // ;
TOK(equal)               // =
TOK(equalequal)          // ==
TOK(comma)               // ,
TOK(hash)                // #
TOK(hashhash)            // ##
TOK(hashat)              // #@

// C++ Support
TOK(periodstar)          // .*
TOK(arrowstar)           // ->*
TOK(coloncolon)          // ::

// Objective C support.
TOK(at)                  // @


// C99 6.4.1: Keywords.  These turn into kw_* tokens.
// Flags allowed:
//   NOTC90 - In C90, this token is never available.
//   EXTC90 - In C90, this token is an extension that is enabled unless strict.
//   NOTC99 - In C99, this token is never available.
//   EXTC99 - In C99, this token is an extension that is enabled unless strict.
//   NOTCPP - In C++98, this token is never available.
//   EXTCPP - In C++98, this token is an extension that is enabled unless strict.
//   NOTCPP0x - In C++0x, this token is never available.
//   EXTCPP0x - In C++0x, this token is an extension that is enabled unless 
//              strict.
//
KEYWORD(auto                        , 0)
KEYWORD(break                       , 0)
KEYWORD(case                        , 0)
KEYWORD(char                        , 0)
KEYWORD(const                       , 0)
KEYWORD(continue                    , 0)
KEYWORD(default                     , 0)
KEYWORD(do                          , 0)
KEYWORD(double                      , 0)
KEYWORD(else                        , 0)
KEYWORD(enum                        , 0)
KEYWORD(extern                      , 0)
KEYWORD(float                       , 0)
KEYWORD(for                         , 0)
KEYWORD(goto                        , 0)
KEYWORD(if                          , 0)
KEYWORD(inline                      , EXTC90)  // Ext in C90, ok in C99/C++
KEYWORD(int                         , 0)
KEYWORD(long                        , 0)
KEYWORD(register                    , 0)
KEYWORD(restrict                    , NOTC90)    // Not in C90
KEYWORD(return                      , 0)
KEYWORD(short                       , 0)
KEYWORD(signed                      , 0)
KEYWORD(sizeof                      , 0)
KEYWORD(static                      , 0)
KEYWORD(struct                      , 0)
KEYWORD(switch                      , 0)
KEYWORD(typedef                     , 0)
KEYWORD(union                       , 0)
KEYWORD(unsigned                    , 0)
KEYWORD(void                        , 0)
KEYWORD(volatile                    , 0)
KEYWORD(while                       , 0)
KEYWORD(_Bool                       , EXTC90|EXTCPP|EXTCPP0x)  // C99 only
KEYWORD(_Complex                    , EXTC90|EXTCPP|EXTCPP0x)  // C99 only
KEYWORD(_Imaginary                  , EXTC90|NOTCPP|NOTCPP0x)  // C90 only

// Special tokens to the compiler.
KEYWORD(__func__                    , EXTC90|EXTCPP|EXTCPP0x) // Only in C99.
KEYWORD(__FUNCTION__                , EXTC90|EXTC99|EXTCPP|EXTCPP0x) // GCC Extension.
KEYWORD(__PRETTY_FUNCTION__         , EXTC90|EXTC99|EXTCPP|EXTCPP0x) // GCC Extension.

// C++ 2.11p1: Keywords.
KEYWORD(asm                         , EXTC90|EXTC99) // Exts in C90/C99
KEYWORD(bool                        , BOOLSUPPORT)
KEYWORD(catch                       , NOTC90|NOTC99)
KEYWORD(class                       , NOTC90|NOTC99)
KEYWORD(const_cast                  , NOTC90|NOTC99)
KEYWORD(delete                      , NOTC90|NOTC99)
KEYWORD(dynamic_cast                , NOTC90|NOTC99)
KEYWORD(explicit                    , NOTC90|NOTC99)
KEYWORD(export                      , NOTC90|NOTC99)
KEYWORD(false                       , BOOLSUPPORT)
KEYWORD(friend                      , NOTC90|NOTC99)
KEYWORD(mutable                     , NOTC90|NOTC99)
KEYWORD(namespace                   , NOTC90|NOTC99)
KEYWORD(new                         , NOTC90|NOTC99)
KEYWORD(operator                    , NOTC90|NOTC99)
KEYWORD(private                     , NOTC90|NOTC99)
KEYWORD(protected                   , NOTC90|NOTC99)
KEYWORD(public                      , NOTC90|NOTC99)
KEYWORD(reinterpret_cast            , NOTC90|NOTC99)
KEYWORD(static_cast                 , NOTC90|NOTC99)
KEYWORD(template                    , NOTC90|NOTC99)
KEYWORD(this                        , NOTC90|NOTC99)
KEYWORD(throw                       , NOTC90|NOTC99)
KEYWORD(true                        , BOOLSUPPORT)
KEYWORD(try                         , NOTC90|NOTC99)
KEYWORD(typename                    , NOTC90|NOTC99)
KEYWORD(typeid                      , NOTC90|NOTC99)
KEYWORD(using                       , NOTC90|NOTC99)
KEYWORD(virtual                     , NOTC90|NOTC99)
KEYWORD(wchar_t                     , NOTC90|NOTC99)

// C++ 2.5p2: Alternative Representations.
CXX_KEYWORD_OPERATOR(and     , ampamp)
CXX_KEYWORD_OPERATOR(and_eq  , ampequal)
CXX_KEYWORD_OPERATOR(bitand  , amp)
CXX_KEYWORD_OPERATOR(bitor   , pipe)
CXX_KEYWORD_OPERATOR(compl   , tilde)
CXX_KEYWORD_OPERATOR(not     , exclaim)
CXX_KEYWORD_OPERATOR(not_eq  , exclaimequal)
CXX_KEYWORD_OPERATOR(or      , pipepipe)
CXX_KEYWORD_OPERATOR(or_eq   , pipeequal)
CXX_KEYWORD_OPERATOR(xor     , caret)
CXX_KEYWORD_OPERATOR(xor_eq  , caretequal)

// C++0x keywords
KEYWORD(char16_t                    , NOTC90|NOTC99|NOTCPP)
KEYWORD(char32_t                    , NOTC90|NOTC99|NOTCPP)
KEYWORD(static_assert               , NOTC90|NOTC99|NOTCPP)

// GNU Extensions.
KEYWORD(_Decimal32                  , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(_Decimal64                  , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(_Decimal128                 , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(typeof                      , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__null                      , NOTC90|NOTC99|EXTCPP|EXTCPP0x) // C++-only Extensn
KEYWORD(__alignof                   , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__attribute                 , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__builtin_choose_expr       , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__builtin_overload          , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__builtin_offsetof          , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__builtin_types_compatible_p, EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__builtin_va_arg            , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__extension__               , 0)     // Not treated as an extension!
KEYWORD(__imag                      , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__label__                   , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__real                      , EXTC90|EXTC99|EXTCPP|EXTCPP0x)
KEYWORD(__thread                    , EXTC90|EXTC99|EXTCPP|EXTCPP0x)

// Apple Extension.
KEYWORD(__private_extern__          , EXTC90|EXTC99|NOTCPP)

// Alternate spelling for various tokens.  There are GCC extensions in all
// languages, but should not be disabled in strict conformance mode.
ALIAS("__attribute__", __attribute)
ALIAS("__const"      , const      )
ALIAS("__const__"    , const      )
ALIAS("__alignof__"  , __alignof  )
ALIAS("_asm"         , asm        )
ALIAS("__asm"        , asm        )
ALIAS("__asm__"      , asm        )
ALIAS("__complex"    , _Complex   )
ALIAS("__complex__"  , _Complex   )
ALIAS("__imag__"     , __imag     )
ALIAS("__inline"     , inline     )
ALIAS("__inline__"   , inline     )
ALIAS("__real__"     , __real     )
ALIAS("__restrict"   , restrict   )
ALIAS("__restrict__" , restrict   )
ALIAS("__signed"     , signed     )
ALIAS("__signed__"   , signed     )
ALIAS("__typeof"     , typeof     )
ALIAS("__typeof__"   , typeof     )
ALIAS("__volatile"   , volatile   )
ALIAS("__volatile__" , volatile   )


//===----------------------------------------------------------------------===//
// Objective-C @-preceeded keywords.
//===----------------------------------------------------------------------===//

// These have meaning after an '@' in Objective-C mode. These define enums in
// the tok::objc_* namespace.

OBJC1_AT_KEYWORD(not_keyword)
OBJC1_AT_KEYWORD(class)
OBJC1_AT_KEYWORD(compatibility_alias)
OBJC1_AT_KEYWORD(defs)
OBJC1_AT_KEYWORD(encode)
OBJC1_AT_KEYWORD(end)
OBJC1_AT_KEYWORD(implementation)
OBJC1_AT_KEYWORD(interface)
OBJC1_AT_KEYWORD(private)
OBJC1_AT_KEYWORD(protected)
OBJC1_AT_KEYWORD(protocol)
OBJC1_AT_KEYWORD(public)
OBJC1_AT_KEYWORD(selector)
OBJC1_AT_KEYWORD(throw)
OBJC1_AT_KEYWORD(try)
OBJC1_AT_KEYWORD(catch)
OBJC1_AT_KEYWORD(finally)
OBJC1_AT_KEYWORD(synchronized)

OBJC2_AT_KEYWORD(property)
OBJC2_AT_KEYWORD(package)
OBJC2_AT_KEYWORD(required)
OBJC2_AT_KEYWORD(optional)
OBJC2_AT_KEYWORD(synthesize)
OBJC2_AT_KEYWORD(dynamic)

// TODO: What to do about context-sensitive keywords like:
//       bycopy/byref/in/inout/oneway/out?

#undef OBJC2_AT_KEYWORD
#undef OBJC1_AT_KEYWORD
#undef CXX_KEYWORD_OPERATOR
#undef PPKEYWORD
#undef ALIAS
#undef KEYWORD
#undef TOK
