Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849/** String leaf emission helpers for parsed TOML values. Basic-string escaping lives in the shared `basic-escape.ts` so this emitter and the from-scratch value and key encoders cannot drift apart; here it is applied per the parsed node's style and `multiline` flag. @module */
import type { ForeignBorrowed, } from '@monochromatic-dev/ownership-marker-foreign-borrowed/ts';import type { AST, } from 'toml-eslint-parser';
import { escapeBasicMultiline, escapeBasicSingleLine,} from './basic-escape.ts';
//region String emission
/** Emit a `TOMLStringValue` per its style and `multiline` flag. @param node - Parsed TOML string value. @returns Computed string. @example ```ts emitStringValue({ node: tomlStringNode, },); ``` */export function emitStringValue({ node,}: { readonly node: ForeignBorrowed<AST.TOMLStringValue>;}): string { if (node.style === 'literal') { if (node.multiline) return `'''${node.value}'''`; return `'${node.value}'`; } if (node.multiline) return `"""${escapeBasicMultiline({ value: node.value, },)}"""`; return `"${escapeBasicSingleLine({ value: node.value, },)}"`;}
//endregion String emission