//===--- SyntaxKinds.def - Swift Syntax Node Metaprogramming --------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#define DECL(Id, Parent) SYNTAX(Id##Decl, Parent)
#define STMT(Id, Parent) SYNTAX(Id##Stmt, Parent)
#define EXPR(Id, Parent) SYNTAX(Id##Expr, Parent)
#define PATTERN(Id, Parent) SYNTAX(Id##Pattern, Parent)

//#include "swift/AST/DeclNodes.def"
//#include "swift/AST/StmtNodes.def"
//#include "swift/AST/ExprNodes.def"
//#include "swift/AST/PatternNodes.def"

#ifndef ABSTRACT_SYNTAX
#define ABSTRACT_SYNTAX(Id, Parent)
#endif

#ifndef SYNTAX_RANGE
#define SYNTAX_RANGE(Id, First, Last)
#endif

#ifndef MISSING_SYNTAX
#define MISSING_SYNTAX(Id, Parent)
#endif

#ifndef SYNTAX_COLLECTION
#define SYNTAX_COLLECTION(Id, Element)
#endif

SYNTAX(Unknown, Syntax)

// Decls
ABSTRACT_SYNTAX(DeclSyntax, Syntax)
  MISSING_SYNTAX(MissingDecl, DeclSyntax)
  SYNTAX(UnknownDecl, DeclSyntax)
  SYNTAX(StructDecl, DeclSyntax)
  SYNTAX(TypeAliasDecl, DeclSyntax)
  SYNTAX(FunctionDecl, DeclSyntax)

SYNTAX_RANGE(Decl, MissingDecl, FunctionDecl)

SYNTAX(DeclMembers, Syntax)
SYNTAX(GenericParameter, Syntax)
SYNTAX(GenericParameterClause, Syntax)
SYNTAX(GenericParameterList, Syntax)

SYNTAX(GenericWhereClause, Syntax)
SYNTAX(GenericRequirementList, Syntax)
SYNTAX(GenericArgumentClause, Syntax)
SYNTAX(GenericArgumentList, Syntax)
ABSTRACT_SYNTAX(GenericRequirementSyntax, Syntax)
  SYNTAX(ConformanceRequirement, GenericRequirementSyntax)
  SYNTAX(SameTypeRequirement, GenericRequirementSyntax)

// Types
ABSTRACT_SYNTAX(TypeSyntax, Syntax)
  MISSING_SYNTAX(MissingType, TypeSyntax)
  SYNTAX(MetatypeType, TypeSyntax)
  SYNTAX(TypeIdentifier, TypeSyntax)
  SYNTAX(TupleType, TypeSyntax)
  SYNTAX(OptionalType, TypeSyntax)
  SYNTAX(ImplicitlyUnwrappedOptionalType, TypeSyntax)
  SYNTAX(ArrayType, TypeSyntax)
  SYNTAX(DictionaryType, TypeSyntax)
  SYNTAX(FunctionType, TypeSyntax)
SYNTAX_RANGE(Type, MissingType, FunctionType)

// Statements
SYNTAX(StmtList, Syntax)

ABSTRACT_SYNTAX(StmtSyntax, Syntax)
  SYNTAX(UnknownStmt, StmtSyntax)
  SYNTAX(CodeBlockStmt, StmtSyntax)
  SYNTAX(FallthroughStmt, StmtSyntax)
  SYNTAX(BreakStmt, StmtSyntax)
  SYNTAX(ContinueStmt, StmtSyntax)
  SYNTAX(ReturnStmt, StmtSyntax)
SYNTAX_RANGE(Stmt, UnknownStmt, ReturnStmt)

// Expressions
ABSTRACT_SYNTAX(ExprSyntax, Syntax)
  MISSING_SYNTAX(MissingExpr, ExprSyntax)
  SYNTAX(UnknownExpr, ExprSyntax)
  SYNTAX(IntegerLiteralExpr, ExprSyntax)
  SYNTAX(FunctionCallExpr, ExprSyntax)
  SYNTAX(SymbolicReferenceExpr, ExprSyntax)
SYNTAX_RANGE(Expr, MissingExpr, SymbolicReferenceExpr)

// Other stuff
SYNTAX(BalancedTokens, Syntax)
SYNTAX(TypeAttribute, Syntax)
SYNTAX(TypeAttributes, Syntax)
SYNTAX(TupleTypeElement, Syntax)
SYNTAX(FunctionTypeArgument, Syntax)
SYNTAX(FunctionCallArgumentList, Syntax)
SYNTAX(FunctionCallArgument, Syntax)
SYNTAX(FunctionSignature, Syntax)
SYNTAX(FunctionParameter, Syntax)
SYNTAX(DeclModifier, Syntax)
SYNTAX(DeclModifierList, Syntax)

SYNTAX_COLLECTION(FunctionParameterList, FunctionParameterSyntax)
SYNTAX_COLLECTION(TupleTypeElementList, TupleTypeElementSyntax)

#undef SYNTAX_COLLECTION
#undef ABSTRACT_SYNTAX
#undef DECL
#undef STMT
#undef EXPR
#undef PATTERN
#undef SYNTAX
#undef MISSING_SYNTAX
#undef SYNTAX_RANGE
