3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 14:45:44 +01:00

Give the directive grammar, flavours and reader failures one place each

This commit is contained in:
2026-10-21 23:43:05 +02:00
committed by Lillem4n
parent db10287cae
commit b080410852
37 changed files with 212 additions and 189 deletions
+3
View File
@@ -25,6 +25,9 @@ export type ParseError = ConvertError & { position: SourcePosition }
export type Result<T, E extends ConvertError = ConvertError> = { error: E; ok: false } | { ok: true; value: T }
// A reader with no path to name; the walk attaches the path where it knows it.
export type Read<T> = { fault: ConvertFault; value?: undefined } | { fault?: undefined; value: T }
export function failure<T>(code: ConvertErrorCode, message: string, path: ConvertErrorPath): Result<T> {
return { error: { code, message, path }, ok: false }
}