MCPcopy
hub / github.com/Effect-TS/effect / treeForm

Function treeForm

packages/printer/src/internal/docTree.ts:348–368  ·  view source on GitHub ↗
(stream: DocStream.DocStream<A>)

Source from the content-addressed store, hash-verified

346
347/** @internal */
348export const treeForm = <A>(stream: DocStream.DocStream<A>): DocTree.DocTree<A> => {
349 const result = parser<A>()(stream)
350 switch (result._tag) {
351 case "None": {
352 throw new Error(
353 "BUG: DocTree.treeForm - failed to convert DocStream to DocTree" +
354 " - please report an issue at https://github.com/Effect-TS/printer/issues"
355 )
356 }
357 case "Some": {
358 const [docTree, remaining] = result.value
359 if (remaining._tag !== "EmptyStream") {
360 throw new Error(
361 "BUG: DocTree.treeForm - DocStream not fully consumed during DocTree parsing" +
362 " - please report an issue at https://github.com/Effect-TS/printer/issues"
363 )
364 }
365 return docTree
366 }
367 }
368}
369
370// -----------------------------------------------------------------------------
371// Parser

Callers

nothing calls this directly

Calls 1

parserFunction · 0.85

Tested by

no test coverage detected