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
6import PterodactylSyntax
7import llbuild2fx
8
9extension Keys.Blob {
10 struct ParseDocument: BuildKey {
11 let blobId: LLBDataID
12
13 struct ValueType: Codable, FXValue {
14 let tree: PterodactylSyntax.SyntaxTree
15 let diagnostics: [Diagnostic]
16 }
17
18 static let versionDependencies: [any FXVersioning.Type] = [ReadContents.self, Tokenise.self]
19
20 func computeValue(_ ctx: BuildContext<Self>) async throws -> ValueType {
21 let code = try await ctx.request(ReadContents(blobId: blobId))
22 let tokens = try await ctx.request(Tokenise(blobId: blobId))
23 var parser = Parser(source: code, tokens: tokens)
24 PterodactylSyntax.Document.parse(&parser)
25 return ValueType(tree: parser.tree, diagnostics: parser.diagnostics)
26 }
27 }
28}