Refactor P4Compiler to P4Parser
Continuous Integration / Grammar Tests (push) Successful in 36s
Continuous Integration / Library Format Tests (push) Successful in 1m46s
Continuous Integration / Library Tests (push) Successful in 4m23s

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-06-12 23:23:35 -04:00
parent e17533dfc8
commit 6c23cf7458
23 changed files with 1042 additions and 1120 deletions
+6 -6
View File
@@ -439,7 +439,7 @@ public struct CliTestDeclarationMacro: PeerMacro, Sendable {
}
}
public enum DeriveCompilableStatement: MemberMacro {
public enum DeriveParsableStatement: MemberMacro {
public static func expansion(
of: AttributeSyntax, providingMembersOf type: some DeclGroupSyntax, conformingTo: [TypeSyntax],
in: some MacroExpansionContext
@@ -447,10 +447,10 @@ public enum DeriveCompilableStatement: MemberMacro {
let implementation = DeclSyntax(
"""
public static func CompileStatement(
node: Node, withContext context: ASTCompilerContext
) -> Result<AST.AnStatement> {
return switch Compile(node: node, withContext: context) {
public static func ParseStatement(
node: Node, withContext context: CSTCompilerContext
) -> Result<CST.Statement> {
return switch Parse(node: node, withContext: context) {
case .Ok(let res): .Ok(res)
case .Error(let e): .Error(e)
}
@@ -465,6 +465,6 @@ struct P4Macros: CompilerPlugin {
var providingMacros: [Macro.Type] = [
RequireResult.self, RequireErrorResult.self, UseOkResult.self, UseErrorResult.self,
RequireNodeType.self, SkipUnlessNodeType.self, SkipUnlessNodesTypes.self, RequireNodesType.self,
MustOr.self, CliTestDeclarationMacro.self, DeriveCompilableStatement.self,
MustOr.self, CliTestDeclarationMacro.self, DeriveParsableStatement.self,
]
}