// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers // SPDX-FileCopyrightText: 2026 The Project Pterodactyl Developers // // SPDX-License-Identifier: MPL-2.0 import LanguageServerProtocol public enum Keyword: String, Codable, Sendable, CaseIterable { case theory = "theory" case `where` = "where" case `import` = "import" case type = "Type" case refl = "refl" } extension Keyword: CustomStringConvertible { public var description: String { rawValue } } public enum Punctuation: String, CaseIterable, Codable, Equatable, Sendable { case lparen = "(" case rparen = ")" case lbrace = "{" case rbrace = "}" case comma = "," case dot = "." case colon = ":" case semicolon = ";" case doubleLeftArrow = "<=" case doubleRightArrow = "=>" case rightArrow = "->" case equal = "=" case questionMark = "?" } extension Punctuation: CustomStringConvertible { public var description: String { rawValue } } public enum TokenKind: Codable, Equatable, Sendable, Hashable { case eof case keyword(Keyword) case punctuation(Punctuation) case error case identifier case newline case whitespace case blockBegin case blockEnd case blockSep case lineComment case blockComment(terminated: Bool) } extension Keyword { public var isBlockHerald: Bool { switch self { case .where: true default: false } } } extension TokenKind { public var isTrivia: Bool { switch self { case .whitespace, .newline, .lineComment, .blockComment: true default: false } } public var isVisible: Bool { switch self { case .whitespace, .blockBegin, .blockSep, .blockEnd, .newline: false default: true } } public var canDetermineLayoutColumn: Bool { switch self { case .whitespace, .eof: false default: true } } public var isBlockHerald: Bool { switch self { case .keyword(let kwd): kwd.isBlockHerald default: false } } } public enum RecordItemKind: Codable, Equatable, Sendable { case spec case impl } public enum SyntaxTreeKind: Codable, Equatable, Sendable { case document case `import` case importName case theory case theoryName case claimDecl case probeDecl case refineDecl case defineDecl case declLhs case declRhs case typedBinder case untypedBinder case depFunType case record case recordItem(kind: RecordItemKind) case funType case lambda case spine case appFrame case projFrame case identifier case universeCodes case idType case hole case refl case hint case error } extension SyntaxTreeKind { public var isDecl: Bool { switch self { case .theory, .claimDecl, .refineDecl, .defineDecl, .probeDecl: true default: false } } } public struct TokenMetadata: Equatable, Codable, Sendable { public var semanticTokenType: SemanticTokenTypes public var semanticTokenModifiers: Set = [] public var delimitedFoldingRangeKind: FoldingRangeKind? = nil } public struct SyntaxTreeMetadata: Codable, Equatable, Sendable { public var delimitedFoldingRangeKind: FoldingRangeKind? = nil public var hint: String? = nil }