this repo has no description
www.jonmsterling.com/01HC/
1// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers
2//
3// SPDX-License-Identifier: MPL-2.0
4
5import Foundation
6
7public enum Keyword: Codable, Equatable, Sendable {
8 case `import`
9 case theory
10 case `where`
11}
12
13public enum Whitespace: Codable, Equatable, Sendable {
14 case newline
15 case other
16}
17
18public enum TokenKind: Codable, Equatable, Sendable {
19 case eof
20 case keyword(Keyword)
21 case error
22 case identifier
23 case whitespace(Whitespace)
24 case blockBegin
25 case blockEnd
26 case blockSep
27}
28
29public final class SyntaxTreeKind: Codable, Equatable, Sendable {
30 static let error: SyntaxTreeKind = .init(name: "error")
31
32 public static func == (lhs: SyntaxTreeKind, rhs: SyntaxTreeKind) -> Bool {
33 lhs === rhs
34 }
35
36 let name: String
37 var description: String { name }
38
39 required init(name: String) {
40 self.name = name
41 }
42}
43
44public struct TokenMetadata: Codable, Equatable, Sendable {
45}
46
47public struct SyntaxTreeMetadata: Codable, Equatable, Sendable {
48
49}
50
51extension TokenKind {
52 var canDetermineLayoutColumn: Bool {
53 switch self {
54 case .whitespace, .eof: false
55 default: true
56 }
57 }
58
59 var isBlockHerald: Bool {
60 switch self {
61 case .keyword(.where): true
62 default: false
63 }
64 }
65}