/** * Common scalar grammar for GCF. * Shared between encoder, decoder, and streaming encoder. */ /** * Policy for an in-domain integer whose magnitude exceeds 2^53-1 (a value the host * `number` cannot hold exactly). This is a JavaScript-local boundary, not the numeric * domain edge (which is int64 and is enforced regardless of this policy). SPEC 2.3.2. * - `'error'` (default): throw rather than return a value that would later lose * precision in `number` arithmetic. * - `'string'`: return the decimal digits as a string (recommended for identifiers). * - `'bigint'`: return a native `bigint` (lossless, for consumers that compute on it). * - `'number'`: return a `number` (explicit, lossy). */ export type LargeIntMode = 'error' | 'string' | 'bigint' | 'number'; /** Set the large-integer policy for the current decode (see LargeIntMode). */ export declare function setLargeIntMode(mode: LargeIntMode): void; /** Check if a string value must be quoted per Section 2.4. */ export declare function needsQuote(s: string): boolean; /** Produce a JSON-compatible quoted string. */ export declare function quoteString(s: string): string; /** Format a JS value as a GCF scalar. delimiter is '|', ',', or 0. */ export declare function formatScalar(v: unknown, delimiter?: number): string; /** Format a number per Section 2.3 canonical rules. */ export declare function formatNumber(f: number): string; /** * Format a graph score to exactly two decimals with round-half-to-even applied to * the exact IEEE-754 double (SPEC 5). This matches the C/Go printf family, Python, * Rust, and .NET. It deliberately does NOT use Number.prototype.toFixed, which * rounds half-up and diverges at exact binary midpoints (0.125 -> 0.12 not 0.13, * 0.625 -> 0.62 not 0.63), producing a non-interoperable wire. */ export declare function formatScore(x: number): string; /** Check if a key is a valid bare key. */ export declare function isBareKey(s: string): boolean; /** Format a key, quoting if necessary. */ export declare function formatKey(s: string): string; /** Parse a GCF scalar token per Section 2.1 precedence. */ export declare function parseScalar(s: string, tabularContext: boolean): any; export declare const MISSING: unique symbol; export declare const ATTACHMENT: unique symbol; /** Parse a JSON-compatible quoted string. */ export declare function parseQuotedString(s: string): string; /** Split a string on a delimiter, respecting quoted strings. */ export declare function splitRespectingQuotes(s: string, delim: string): string[]; /** Split a field declaration like {id,"display name","a,b"}. */ export declare function splitFieldDecl(s: string): string[]; //# sourceMappingURL=scalar.d.ts.map