Make Formatter Happy

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-02-24 00:44:04 -05:00
parent b4c5ce55e1
commit 5dbb8d3d60
16 changed files with 280 additions and 269 deletions
+1 -1
View File
@@ -19,4 +19,4 @@ import Common
public struct Instantiation {
}
}
+2 -3
View File
@@ -113,7 +113,7 @@ public class ParserState: Equatable, CustomStringConvertible, Comparable {
public private(set) var next_state: ParserState?
public static func < (lhs: ParserState, rhs: ParserState) -> Bool {
// If lhs transitions to rhs, then return true. Otherwise, return false.
// If lhs transitions to rhs, then return true. Otherwise, return false.
// TODO!!
return false
@@ -141,7 +141,7 @@ public class ParserState: Equatable, CustomStringConvertible, Comparable {
public func semantic_check(states: ParserStates) -> Bool {
guard let transition = transition else {
return self == accept || self == reject
return self == accept || self == reject
}
if let next_state_name = transition.next_state_name,
@@ -226,7 +226,6 @@ public struct ParserStates {
}
}
public struct Parser: P4Type {
public var states: ParserStates
+20 -20
View File
@@ -22,26 +22,26 @@ public struct ExpressionStatement {
}
public struct Program {
public var types: [P4Type] = Array()
public var types: [P4Type] = Array()
/// Find the program's main parser
///
/// Note: For now, the main parser is expected to be named main_parser.
public func starting_parser() -> Result<Parser> {
return self.find_parser(withName: Identifier(name: "main_parser"))
/// Find the program's main parser
///
/// Note: For now, the main parser is expected to be named main_parser.
public func starting_parser() -> Result<Parser> {
return self.find_parser(withName: Identifier(name: "main_parser"))
}
public func find_parser(withName name: Identifier) -> Result<Parser> {
for type in self.types {
guard let parser = type as? Parser else {
continue
}
if parser.name == name {
return .Ok(parser)
}
}
return .Error(Error(withMessage: "Could not find parser named \(name)"))
}
public func find_parser(withName name: Identifier) -> Result<Parser> {
for type in self.types {
guard let parser = type as? Parser else {
continue
}
if parser.name == name {
return .Ok(parser)
}
}
return .Error(Error(withMessage: "Could not find parser named \(name)"))
}
public init() {}
}
public init() {}
}