import { EncodableDictionary, Value, Preservable, PreserveWritable, Embeddable } from '@preserves/core'; import { SchemaDefinition } from './reflection.js'; import * as M from './meta.js'; import * as H from './host.js'; export declare const UNIT: true; export type Parsed = Value | Parsed[] | DictOf | Bindings; export type TopParsed = Value | Parsed[] | DictOf | TopBindings; export type Top = Preservable & PreserveWritable & { __as_preserve__(): Value; }; export type DictOf = EncodableDictionary, Parsed>; export type BindingName = string; export type Bindings = { [key: BindingName]: Parsed; }; export type TopBindings = Bindings & Top; export type SingleConstructor = ((input: any) => Parsed) & { schema(): SchemaDefinition; }; export type MultipleConstructors = { [key: string]: SingleConstructor; }; export type DefinitionConstructors = SingleConstructor | MultipleConstructors; export declare namespace Bindings { function empty(): Bindings; function single(k: BindingName, v: Parsed): Bindings; function merge(...vs: Bindings[]): Bindings; } export type DynField = { type: 'simple'; value: Parsed; } | { type: 'compound'; values: Bindings; }; export declare namespace DynField { function unwrap(f: DynField): Parsed; function unwrap_compound(f: DynField): Bindings; function simple(value: Parsed): DynField; function maybeSimple(value: Parsed | null): DynField; function compound(values: Bindings): DynField; function promote(f: DynField, key?: symbol): Bindings; } export type Unparseable = TopParsed; export type Unparser = (v: Parsed) => Value; export type UnparserCompound = (v: Bindings) => Value; export declare class SchemaInterpreter { env: M.Modules; mergeEmbeddeds: (a: V, b: V) => V | undefined; activeModule: M.ModulePath; unparserCache: { [key: string]: [Unparser]; }; constructor(env?: M.Modules, mergeEmbeddeds?: (a: V, b: V) => V | undefined); _withModule(modulePath: M.ModulePath, f: () => R): R; _findModule(modulePath: M.ModulePath): { resolved: M.ModulePath; schema: M.Schema; }; _lookup(modulePath: M.ModulePath, name: symbol, f: (d: M.Definition, schema: M.Schema) => R): R; makeTop(modulePath: M.ModulePath, name: symbol, fields: Bindings): TopBindings; buildConstructor(modulePath: M.ModulePath, name: symbol, schema: M.Schema, ty: H.Simple, variant?: symbol): SingleConstructor; definitionConstructor(modulePath: M.ModulePath, name: symbol): DefinitionConstructors; parse(modulePath: M.ModulePath, name: symbol, input: Value): Unparseable; tryParse(modulePath: M.ModulePath, name: symbol, input: Value): Unparseable | undefined; parseDefinition(d: M.Definition, input: Value): Parsed | undefined; parseNamedAlternative(p: M.NamedAlternative, input: Value): Bindings | undefined; parseNamedPattern(p: M.NamedPattern, input: Value): Bindings | undefined; parseNamedSimplePattern(p: M.NamedSimplePattern, input: Value): DynField | undefined; parseSimplePattern(p: M.SimplePattern, input: Value): Parsed | null | undefined; parseCompoundPattern(p: M.CompoundPattern, input: Value): Bindings | undefined; parsePattern(p: M.Pattern, input: Value): DynField | undefined; unparse(modulePath: M.ModulePath, name: symbol, v: Unparseable): Value; unparser(modulePath: M.ModulePath, name: symbol): Unparser; _unparser(modulePath: M.ModulePath, name: symbol): [Unparser]; unparserDefinition(p: M.Definition): Unparser; unparserNamedAlternative(p: M.NamedAlternative): [string, UnparserCompound]; unparserNamedPattern(p: M.NamedPattern): Unparser; unparserPattern(p: M.Pattern): Unparser; unparserSimplePattern(p: M.SimplePattern): Unparser; unparserCompoundPattern(p: M.CompoundPattern): UnparserCompound; unparserNamedSimplePattern(p: M.NamedSimplePattern): Unparser; moduleFor(modulePath: M.ModulePath): { [key: string]: any; } | undefined; moduleTree(tree?: { [key: string]: any; }): { [key: string]: any; }; }