Make Formatter Happy
Continuous Integration / Grammar Tests (push) Has been cancelled
Continuous Integration / Library Tests (push) Has been cancelled
Continuous Integration / Library Format Tests (push) Has been cancelled

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-04-30 18:41:01 -04:00
parent ed976c7855
commit a84e778e79
5 changed files with 42 additions and 19 deletions
+8 -4
View File
@@ -55,7 +55,7 @@ extension Control: LibraryCallable {
// Skip those with mismatching types.
if !val.type().eq(key_val.type()) {
continue;
continue
}
/// ASSUME: All matches are exact.
@@ -80,9 +80,13 @@ extension Control: LibraryCallable {
return (.Ok(P4TableHitMissValue.Miss), control_execution)
}
switch Call(body: call_body, withArguments: arguments, withParameters: self.parameters, inExecution: control_execution) {
case (.Ok(let r), let updated_execution): return (r, updated_execution)
case (.Error(let e), let updated_execution): return (P4TableHitMissValue.Miss, updated_execution.setError(error: e))
switch Call(
body: call_body, withArguments: arguments, withParameters: self.parameters,
inExecution: control_execution)
{
case (.Ok(let r), let updated_execution): return (r, updated_execution)
case (.Error(let e), let updated_execution):
return (P4TableHitMissValue.Miss, updated_execution.setError(error: e))
}
}
}
+8 -3
View File
@@ -35,7 +35,9 @@ public struct Runtime<U, T: LibraryCallable<U>>: CustomStringConvertible {
}
/// Create a parser runtime from a P4 program
public static func create(program: P4Lang.Program) -> Result<Runtime<InstantiatedParserState, Parser>> {
public static func create(
program: P4Lang.Program
) -> Result<Runtime<InstantiatedParserState, Parser>> {
return Runtime.create(program: program, withGlobalValues: .none)
}
@@ -44,7 +46,9 @@ public struct Runtime<U, T: LibraryCallable<U>>: CustomStringConvertible {
) -> Result<Runtime<InstantiatedParserState, Parser>> {
return switch program.starting_parser() {
case .Ok(let parser):
.Ok(P4Runtime.Runtime<InstantiatedParserState, Parser>(callable: parser, withGlobalValues: initial))
.Ok(
P4Runtime.Runtime<InstantiatedParserState, Parser>(
callable: parser, withGlobalValues: initial))
case .Error(let error): .Error(error)
}
}
@@ -52,7 +56,8 @@ public struct Runtime<U, T: LibraryCallable<U>>: CustomStringConvertible {
public static func create(
control: P4Lang.Control, withGlobalValues initial: VarValueScopes?
) -> Result<Runtime<P4TableHitMissValue, Control>> {
return .Ok(P4Runtime.Runtime<P4TableHitMissValue, Control>(callable: control, withGlobalValues: initial))
return .Ok(
P4Runtime.Runtime<P4TableHitMissValue, Control>(callable: control, withGlobalValues: initial))
}
/// Run a P4 parser with no arguments