//===--- 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,Z)
#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
#ifndef ANNOTATION
#define ANNOTATION(X) TOK(annot_ ## 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)
PPKEYWORD(__include_macros)

// 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:
//   KEYALL   - This is a keyword in all variants of C and C++, or it
//              is a keyword in the implementation namespace that should
//              always be treated as a keyword
//   KEYC99   - This is a keyword introduced to C in C99
//   KEYCXX   - This is a C++ keyword, or a C++-specific keyword in the
//              implementation namespace
//   KEYCXX0X - This is a C++ keyword introduced to C++ in C++0x
//   KEYGNU   - This is a keyword if GNU extensions are enabled
//   KEYMS    - This is a keyword if Microsoft extensions are enabled
//
KEYWORD(auto                        , KEYALL)
KEYWORD(break                       , KEYALL)
KEYWORD(case                        , KEYALL)
KEYWORD(char                        , KEYALL)
KEYWORD(const                       , KEYALL)
KEYWORD(continue                    , KEYALL)
KEYWORD(default                     , KEYALL)
KEYWORD(do                          , KEYALL)
KEYWORD(double                      , KEYALL)
KEYWORD(else                        , KEYALL)
KEYWORD(enum                        , KEYALL)
KEYWORD(extern                      , KEYALL)
KEYWORD(float                       , KEYALL)
KEYWORD(for                         , KEYALL)
KEYWORD(goto                        , KEYALL)
KEYWORD(if                          , KEYALL)
KEYWORD(inline                      , KEYC99|KEYCXX|KEYGNU)
KEYWORD(int                         , KEYALL)
KEYWORD(long                        , KEYALL)
KEYWORD(register                    , KEYALL)
KEYWORD(restrict                    , KEYC99)
KEYWORD(return                      , KEYALL)
KEYWORD(short                       , KEYALL)
KEYWORD(signed                      , KEYALL)
KEYWORD(sizeof                      , KEYALL)
KEYWORD(static                      , KEYALL)
KEYWORD(struct                      , KEYALL)
KEYWORD(switch                      , KEYALL)
KEYWORD(typedef                     , KEYALL)
KEYWORD(union                       , KEYALL)
KEYWORD(unsigned                    , KEYALL)
KEYWORD(void                        , KEYALL)
KEYWORD(volatile                    , KEYALL)
KEYWORD(while                       , KEYALL)
KEYWORD(_Bool                       , KEYALL)
KEYWORD(_Complex                    , KEYALL)
KEYWORD(_Imaginary                  , KEYALL)
KEYWORD(__func__                    , KEYALL)

// C++ 2.11p1: Keywords.
KEYWORD(asm                         , KEYCXX|KEYGNU)
KEYWORD(bool                        , KEYCXX)
KEYWORD(catch                       , KEYCXX)
KEYWORD(class                       , KEYCXX)
KEYWORD(const_cast                  , KEYCXX)
KEYWORD(delete                      , KEYCXX)
KEYWORD(dynamic_cast                , KEYCXX)
KEYWORD(explicit                    , KEYCXX)
KEYWORD(export                      , KEYCXX)
KEYWORD(false                       , KEYCXX)
KEYWORD(friend                      , KEYCXX)
KEYWORD(mutable                     , KEYCXX)
KEYWORD(namespace                   , KEYCXX)
KEYWORD(new                         , KEYCXX)
KEYWORD(operator                    , KEYCXX)
KEYWORD(private                     , KEYCXX)
KEYWORD(protected                   , KEYCXX)
KEYWORD(public                      , KEYCXX)
KEYWORD(reinterpret_cast            , KEYCXX)
KEYWORD(static_cast                 , KEYCXX)
KEYWORD(template                    , KEYCXX)
KEYWORD(this                        , KEYCXX)
KEYWORD(throw                       , KEYCXX)
KEYWORD(true                        , KEYCXX)
KEYWORD(try                         , KEYCXX)
KEYWORD(typename                    , KEYCXX)
KEYWORD(typeid                      , KEYCXX)
KEYWORD(using                       , KEYCXX)
KEYWORD(virtual                     , KEYCXX)
KEYWORD(wchar_t                     , KEYCXX)

// 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(alignof                     , KEYCXX0X)
KEYWORD(axiom                       , KEYCXX0X)
KEYWORD(char16_t                    , KEYCXX0X)
KEYWORD(char32_t                    , KEYCXX0X)
KEYWORD(concept                     , KEYCXX0X)
KEYWORD(concept_map                 , KEYCXX0X)
KEYWORD(constexpr                   , KEYCXX0X)
KEYWORD(decltype                    , KEYCXX0X)
KEYWORD(late_check                  , KEYCXX0X)
KEYWORD(nullptr                     , KEYCXX0X)
KEYWORD(requires                    , KEYCXX0X)
KEYWORD(static_assert               , KEYCXX0X)
KEYWORD(thread_local                , KEYCXX0X)

// GNU Extensions (in impl-reserved namespace)
KEYWORD(_Decimal32                  , KEYALL)
KEYWORD(_Decimal64                  , KEYALL)
KEYWORD(_Decimal128                 , KEYALL)
KEYWORD(__null                      , KEYCXX)
KEYWORD(__alignof                   , KEYALL)
KEYWORD(__attribute                 , KEYALL)
KEYWORD(__builtin_choose_expr       , KEYALL)
KEYWORD(__builtin_offsetof          , KEYALL)
KEYWORD(__builtin_types_compatible_p, KEYALL)
KEYWORD(__builtin_va_arg            , KEYALL)
KEYWORD(__extension__               , KEYALL)
KEYWORD(__imag                      , KEYALL)
KEYWORD(__label__                   , KEYALL)
KEYWORD(__real                      , KEYALL)
KEYWORD(__thread                    , KEYALL)
KEYWORD(__FUNCTION__                , KEYALL)
KEYWORD(__PRETTY_FUNCTION__         , KEYALL)

// GNU Extensions (outside impl-reserved namespace)
KEYWORD(typeof                      , KEYGNU)

// GNU and MS Type Traits
KEYWORD(__has_nothrow_assign        , KEYCXX)
KEYWORD(__has_nothrow_copy          , KEYCXX)
KEYWORD(__has_nothrow_constructor   , KEYCXX)
KEYWORD(__has_trivial_assign        , KEYCXX)
KEYWORD(__has_trivial_copy          , KEYCXX)
KEYWORD(__has_trivial_constructor   , KEYCXX)
KEYWORD(__has_trivial_destructor    , KEYCXX)
KEYWORD(__has_virtual_destructor    , KEYCXX)
KEYWORD(__is_abstract               , KEYCXX)
KEYWORD(__is_base_of                , KEYCXX)
KEYWORD(__is_class                  , KEYCXX)
KEYWORD(__is_empty                  , KEYCXX)
KEYWORD(__is_enum                   , KEYCXX)
KEYWORD(__is_pod                    , KEYCXX)
KEYWORD(__is_polymorphic            , KEYCXX)
KEYWORD(__is_union                  , KEYCXX)
// FIXME: Add MS's traits, too.

// Apple Extension.
KEYWORD(__private_extern__          , KEYALL)

// Microsoft Extension.
KEYWORD(__declspec                  , KEYALL)
KEYWORD(__cdecl                     , KEYALL)
KEYWORD(__stdcall                   , KEYALL)
KEYWORD(__fastcall                  , KEYALL)
KEYWORD(__ptr64                     , KEYALL)
KEYWORD(__w64                       , KEYALL)
KEYWORD(__forceinline               , KEYALL)

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

// Microsoft extensions which should be disabled in strict conformance mode
ALIAS("_asm"         , asm        , KEYMS)
ALIAS("_cdecl"       , __cdecl    , KEYMS)
ALIAS("_fastcall"    , __fastcall , KEYMS)
ALIAS("_stdcall"     , __stdcall  , KEYMS)

//===----------------------------------------------------------------------===//
// 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?

ANNOTATION(cxxscope)     // annotation for a C++ scope spec, e.g. "::foo::bar::"
ANNOTATION(typename)     // annotation for a C typedef name, a C++ (possibly
                         // qualified) typename, e.g. "foo::MyClass", or
                         // template-id that names a type ("std::vector<int>")
ANNOTATION(template_id)  // annotation for a C++ template-id that names a
                         // function template specialization (not a type),
                         // e.g., "std::swap<int>"
#undef ANNOTATION
#undef OBJC2_AT_KEYWORD
#undef OBJC1_AT_KEYWORD
#undef CXX_KEYWORD_OPERATOR
#undef PPKEYWORD
#undef ALIAS
#undef KEYWORD
#undef TOK
