// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers // // SPDX-License-Identifier: MPL-2.0 import Foundation enum Theory: Grammar { static let kind = SyntaxTreeKind(name: "theory") static let kinds = [kind] static func before(_ parser: inout Parser) -> Bool { parser.isAt(kind: .keyword(.theory)) } static func inside(_ parser: inout Parser) -> ParseResult { parser.expect(kind: .keyword(.theory), metadata: TokenMetadata(semanticTokenType: .keyword)) parser.eatTrivia() if !TheoryName.tryParse(&parser) { parser.advance(error: "Expected theory name") } parser.eatTrivia() TheoryBlock.parse(&parser) return ParseResult(kind: Self.kind) } } extension SyntaxView { var name: SyntaxView? { matchingSubview() } var block: SyntaxView? { matchingSubview() } }