From 3ee1eab2f8e9110a38203f94710d5c30814c21e3 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Fri, 29 May 2026 17:37:26 -0400 Subject: [PATCH] compiler: Parser Compile Should Match Compile Protocol Signed-off-by: Will Hawkins --- Sources/P4Compiler/Declarations.swift | 2 +- Sources/P4Compiler/SpecialCompilers.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/P4Compiler/Declarations.swift b/Sources/P4Compiler/Declarations.swift index b73cb74..9f32dce 100644 --- a/Sources/P4Compiler/Declarations.swift +++ b/Sources/P4Compiler/Declarations.swift @@ -393,7 +393,7 @@ extension P4Lang.Parser: Compilable { withName: parser_name!, withParameters: parameter_list, node: current_node!, withContext: current_context) { - case Result.Ok((let parser, let updated_context)): + case Result.Ok(let parser): let parser_declaration = Declaration( TypedIdentifier(id: parser.name, withType: P4QualifiedType(parser))) // Create a new context with the name of the parser that was just compiled in scope. diff --git a/Sources/P4Compiler/SpecialCompilers.swift b/Sources/P4Compiler/SpecialCompilers.swift index 0dffc23..83f85ba 100644 --- a/Sources/P4Compiler/SpecialCompilers.swift +++ b/Sources/P4Compiler/SpecialCompilers.swift @@ -175,7 +175,7 @@ public struct SpecialCompilers { static func CompileParserBody( withName name: Common.Identifier, withParameters parameters: ParameterList, node: Node, withContext context: CompilerContext - ) -> Result<(P4Lang.Parser, CompilerContext)> { + ) -> Result { var parser = P4Lang.Parser(withName: name, withParameters: parameters) @@ -206,7 +206,7 @@ public struct SpecialCompilers { return .Error(error) } - return Result.Ok((parser, current_context)) + return Result.Ok(parser) } public struct ProgramCompiler {