Refactor P4Compiler to P4Parser
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -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,
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user