compiler: Parser Compile Should Match Compile Protocol

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-29 17:37:26 -04:00
parent d2797e1acc
commit 3ee1eab2f8
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -393,7 +393,7 @@ extension P4Lang.Parser: Compilable {
withName: parser_name!, withParameters: parameter_list, node: current_node!, withName: parser_name!, withParameters: parameter_list, node: current_node!,
withContext: current_context) withContext: current_context)
{ {
case Result.Ok((let parser, let updated_context)): case Result.Ok(let parser):
let parser_declaration = Declaration( let parser_declaration = Declaration(
TypedIdentifier(id: parser.name, withType: P4QualifiedType(parser))) TypedIdentifier(id: parser.name, withType: P4QualifiedType(parser)))
// Create a new context with the name of the parser that was just compiled in scope. // Create a new context with the name of the parser that was just compiled in scope.
+2 -2
View File
@@ -175,7 +175,7 @@ public struct SpecialCompilers {
static func CompileParserBody( static func CompileParserBody(
withName name: Common.Identifier, withParameters parameters: ParameterList, node: Node, withName name: Common.Identifier, withParameters parameters: ParameterList, node: Node,
withContext context: CompilerContext withContext context: CompilerContext
) -> Result<(P4Lang.Parser, CompilerContext)> { ) -> Result<P4Lang.Parser> {
var parser = P4Lang.Parser(withName: name, withParameters: parameters) var parser = P4Lang.Parser(withName: name, withParameters: parameters)
@@ -206,7 +206,7 @@ public struct SpecialCompilers {
return .Error(error) return .Error(error)
} }
return Result.Ok((parser, current_context)) return Result.Ok(parser)
} }
public struct ProgramCompiler { public struct ProgramCompiler {