compiler, runtime: Support Formatted Error Messages
Make it possible to output formatted error messages using a flexible API that includes an ability to specify styles and formatters. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -71,7 +71,7 @@ public protocol ProgramExecutionEvaluator {
|
||||
}
|
||||
|
||||
public protocol Errorable: CustomStringConvertible {
|
||||
func format() -> String
|
||||
func format(_ formatter: Formattable) -> String
|
||||
func msg() -> String
|
||||
func append(error: any Errorable) -> any Errorable
|
||||
func eq(_ rhs: any Errorable) -> Bool
|
||||
@@ -83,6 +83,10 @@ extension Errorable {
|
||||
}
|
||||
}
|
||||
|
||||
public protocol Formattable {
|
||||
func formatWithStyle(_ value: String, _ style: Style) -> String
|
||||
}
|
||||
|
||||
extension ProgramExecutionEvaluator {
|
||||
public func ExecuteStatements(
|
||||
_ statements: [EvaluatableStatement], inExecution execution: ProgramExecution
|
||||
|
||||
Reference in New Issue
Block a user