Files
swift-mirror/include/swift/Syntax/TokenKinds.h
David Farler 7ee42994c8 Start the Syntax library and optional full token lexing
Add an option to the lexer to go back and get a list of "full"
tokens, which include their leading and trailing trivia, which
we can index into from SourceLocs in the current AST.

This starts the Syntax sublibrary, which will support structured
editing APIs. Some skeleton support and basic implementations are
in place for types and generics in the grammar. Yes, it's slightly
redundant with what we have right now. lib/AST conflates syntax
and semantics in the same place(s); this is a first step in changing
that to separate the two concepts for clarity and also to get closer
to incremental parsing and type-checking. The goal is to eventually
extract all of the syntactic information from lib/AST and change that
to be more of a semantic/symbolic model.

Stub out a Semantics manager. This ought to eventually be used as a hub
for encapsulating lazily computed semantic information for syntax nodes.
For the time being, it can serve as a temporary place for mapping from
Syntax nodes to semantically full lib/AST nodes.

This is still in a molten state - don't get too close, wear appropriate
proximity suits, etc.
2017-02-17 12:57:04 -08:00

48 lines
1.2 KiB
C++

//===--- TokenKinds.h - Token Kinds Interface -------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file defines the Token kinds.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_TOKENKINDS_H
#define SWIFT_TOKENKINDS_H
namespace swift {
enum class tok {
unknown = 0,
eof,
code_complete,
identifier,
oper_binary_unspaced, // "x+y"
oper_binary_spaced, // "x + y"
oper_postfix,
oper_prefix,
dollarident,
integer_literal,
floating_literal,
string_literal,
sil_local_name, // %42 in SIL mode.
comment,
#define KEYWORD(X) kw_ ## X,
#define PUNCTUATOR(X, Y) X,
#define POUND_KEYWORD(X) pound_ ## X,
#include "swift/Syntax/TokenKinds.def"
NUM_TOKENS
};
} // end namespace swift
#endif // SWIFT_TOKENKINDS_H