3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Read the node tables backwards, a directive to the node and marks it names

This commit is contained in:
2026-09-01 11:09:21 +02:00
parent 7a33827311
commit 70398d1667
31 changed files with 558 additions and 140 deletions
+8 -6
View File
@@ -1,15 +1,17 @@
import type { AdfAttributes } from './document.ts'
import type { JsonValue } from '../json-value.ts'
type AttributeKind = 'boolean' | 'json' | 'number' | 'string'
export type AttributeKind = 'boolean' | 'json' | 'number' | 'string'
export type AttributeVocabulary = Readonly<Record<string, AttributeKind>>
export type VocabularyPair =
| { key: string; kind: 'boolean'; value: boolean }
| { key: string; kind: 'json'; value: JsonValue }
| { key: string; kind: 'number'; value: number }
| { key: string; kind: 'string'; value: string }
export type VocabularyValue =
| { kind: 'boolean'; value: boolean }
| { kind: 'json'; value: JsonValue }
| { kind: 'number'; value: number }
| { kind: 'string'; value: string }
export type VocabularyPair = VocabularyValue & { key: string }
export function vocabularyPairs(attrs: AdfAttributes, vocabulary: AttributeVocabulary, spelledElsewhere: readonly string[]): VocabularyPair[] | undefined {
const pairs: VocabularyPair[] = []