3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 22:25:44 +01:00

Answer principles round 1: 1 🔴, 5 🟡 (0 misread); the document carry's line feeds checked, element spellings shared with the writer, carried JSON bounded by type, an edit to a carry refused, one test per case, a start tag read one attribute at a time

This commit is contained in:
2026-10-28 01:27:40 +01:00
committed by Lillem4n
parent e39ca86d74
commit 0cb80fd4fc
14 changed files with 430 additions and 302 deletions
+2 -2
View File
@@ -61,11 +61,11 @@ function readCarriedJson(raw: string, spelling: JsonSpelling, levels: number, ty
const typed = type === undefined || type === '' ? { value } : typedValue(value, type)
if (typed.fault !== undefined) return typed
const nested = carriedNesting(typed.value, levels)
if (nested !== undefined) return { fault: nested }
if (nested.fault !== undefined) return nested
if (!spellsCanonicalJson(value, spelling, raw)) {
return { fault: unsupportedNodeShape(`${carryHolder} spells its node's JSON canonically: ${spelling === 'compact' ? 'compact' : 'two-space indent'}, keys sorted; ${wayOut}`) }
}
const node = carriedNode(typed.value, carryHolder)
const node = carriedNode(nested.value, carryHolder)
return node.fault === undefined ? node : { fault: { ...node.fault, message: `${node.fault.message}; ${wayOut}` } }
}