(stream: DocStream.DocStream<A>)
| 346 | |
| 347 | /** @internal */ |
| 348 | export 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…