Make Formatter Happy

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-03-13 09:45:43 -04:00
parent 0b4db34177
commit 75f9f68349
6 changed files with 30 additions and 20 deletions
+9 -5
View File
@@ -110,7 +110,7 @@ struct Expression {
let localElementsParsers: [CompilableExpression.Type] = [
P4BooleanValue.self, P4StringValue.self, P4IntValue.self, TypedIdentifier.self,
BinaryOperatorExpression.self, ArrayAccessExpression.self
BinaryOperatorExpression.self, ArrayAccessExpression.self,
]
for le_parser in localElementsParsers {
@@ -313,7 +313,9 @@ extension BinaryOperatorExpression: CompilableExpression {
}
extension ArrayAccessExpression: CompilableExpression {
static func compile(node: SwiftTreeSitter.Node, withContext context: CompilerContext) -> Common.Result<(any Common.EvaluatableExpression)?> {
static func compile(
node: SwiftTreeSitter.Node, withContext context: CompilerContext
) -> Common.Result<(any Common.EvaluatableExpression)?> {
let expression = node.child(at: 0)!
#SkipUnlessNodeType<Node, EvaluatableExpression?>(
@@ -362,16 +364,18 @@ extension ArrayAccessExpression: CompilableExpression {
let array_access_indexor_node = currentChild!
let maybe_array_identifier = Expression.Compile(node: array_access_identifier_node, withContext: context)
let maybe_array_identifier = Expression.Compile(
node: array_access_identifier_node, withContext: context)
guard case Result.Ok(let array_identifier) = maybe_array_identifier else {
return Result.Error(maybe_array_identifier.error()!)
}
let maybe_array_indexor = Expression.Compile(node: array_access_indexor_node, withContext: context)
let maybe_array_indexor = Expression.Compile(
node: array_access_indexor_node, withContext: context)
guard case Result.Ok(let array_indexor) = maybe_array_indexor else {
return Result.Error(maybe_array_indexor.error()!)
}
return .Ok(ArrayAccessExpression(withName: array_identifier, withIndexor: array_indexor))
}
}
}
+7 -4
View File
@@ -27,7 +27,9 @@ public struct Program {
return Program.Compile(source, withGlobalTypes: .none)
}
public static func Compile(_ source: String, withGlobalTypes globalTypes: LexicalScopes?) -> Result<P4Lang.Program> {
public static func Compile(
_ source: String, withGlobalTypes globalTypes: LexicalScopes?
) -> Result<P4Lang.Program> {
let maybe_parser = ConfigureP4Parser()
guard case .Ok(let p) = maybe_parser else {
@@ -194,9 +196,10 @@ public struct Program {
}
// Any of the types that are in the top-level scope should go into the program!
program.types = Array(compilation_context.names.map() { (_, v) in
v
})
program.types = Array(
compilation_context.names.map { (_, v) in
v
})
return Result.Ok(program)
}
}