// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers // // SPDX-License-Identifier: MPL-2.0 import Foundation public enum Keyword: Codable, Equatable, Sendable { case `import` case theory case `where` } public enum Whitespace: Codable, Equatable, Sendable { case newline case other } public enum TokenKind: Codable, Equatable, Sendable { case eof case keyword(Keyword) case error case identifier case whitespace(Whitespace) case blockBegin case blockEnd case blockSep } public final class SyntaxTreeKind: Codable, Equatable, Sendable { static let error: SyntaxTreeKind = .init(name: "error") public static func == (lhs: SyntaxTreeKind, rhs: SyntaxTreeKind) -> Bool { lhs === rhs } let name: String var description: String { name } required init(name: String) { self.name = name } } public struct TokenMetadata: Codable, Equatable, Sendable { } public struct SyntaxTreeMetadata: Codable, Equatable, Sendable { } extension TokenKind { var canDetermineLayoutColumn: Bool { switch self { case .whitespace, .eof: false default: true } } var isBlockHerald: Bool { switch self { case .keyword(.where): true default: false } } }