//===--- Tokens.def - Swift Tokenizer Metaprogramming -----------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines macros used for macro-metaprogramming lexer tokens.
//
//===----------------------------------------------------------------------===//

/// KEYWORD(kw)
///   Expands for every Swift keyword, such as 'if', 'else', etc.
#ifndef KEYWORD
#define KEYWORD(kw)
#endif

/// PUNCTUATOR(name, str)
///   Expands for every Swift punctuator.
///   \param name  The symbolic name of the punctuator, such as
///                'l_paren' or 'arrow'.
///   \param str   A string literal containing the spelling of the punctuator,
///                such as '"("' or '"->"'.
#ifndef PUNCTUATOR
#define PUNCTUATOR(name, str)
#endif

// Keywords that start decls.
KEYWORD(class)
KEYWORD(constructor)
KEYWORD(destructor)
KEYWORD(enum)
KEYWORD(extension)
KEYWORD(func)
KEYWORD(import)
KEYWORD(init)
KEYWORD(protocol)
KEYWORD(static)
KEYWORD(struct)
KEYWORD(subscript)
KEYWORD(typealias)
KEYWORD(var)

KEYWORD(sil)        // This is only enabled when parsing .sil files.
KEYWORD(sil_stage)  // This is only enabled when parsing .sil files.

// Statement keywords.
KEYWORD(if)
KEYWORD(do)
KEYWORD(else)
KEYWORD(for)
KEYWORD(in)
KEYWORD(while)
KEYWORD(return)
KEYWORD(break)
KEYWORD(continue)
KEYWORD(fallthrough)
KEYWORD(switch)
KEYWORD(case)
KEYWORD(default)
KEYWORD(where)

// Expression and type keywords.
KEYWORD(new)
KEYWORD(as)
KEYWORD(is)
KEYWORD(super)
KEYWORD(self)
KEYWORD(Self)
KEYWORD(weak)
KEYWORD(unowned)
KEYWORD(metatype)
KEYWORD(__FILE__)
KEYWORD(__LINE__)
KEYWORD(__COLUMN__)

// Pattern keywords.
KEYWORD(_)

// Punctuators.
PUNCTUATOR(l_paren,       "(")
PUNCTUATOR(r_paren,       ")")
PUNCTUATOR(l_brace,       "{")
PUNCTUATOR(r_brace,       "}")
PUNCTUATOR(l_square,      "[")
PUNCTUATOR(r_square,      "]")

PUNCTUATOR(period,        ".")
PUNCTUATOR(period_prefix, ".")
PUNCTUATOR(comma,         ",")
PUNCTUATOR(colon,         ":")
PUNCTUATOR(semi,          ";")
PUNCTUATOR(equal,         "=")
PUNCTUATOR(ellipsis,      "...")

PUNCTUATOR(amp_prefix,    "&")
PUNCTUATOR(arrow,         "->")

PUNCTUATOR(question,      "?")

PUNCTUATOR(sil_at_sign,   "@")    // Only in SIL mode.
PUNCTUATOR(sil_dollar,    "$")    // Only in SIL mode.
PUNCTUATOR(sil_pound,     "#")    // Only in SIL mode.
PUNCTUATOR(sil_exclamation, "!")    // Only in SIL mode.


#undef KEYWORD
#undef IDENTIFIER_KEYWORD
#undef PUNCTUATOR
