UNPKG

@thi.ng/parse

Version:

Purely functional parser combinators & AST generation for generic inputs

12 lines (11 loc) 267 B
import { xform } from "../combinators/xform.js"; const xfCollect = (scope) => { scope.result = scope.children.map((c) => c.result); scope.children = null; return scope; }; const collect = (parser) => xform(parser, xfCollect); export { collect, xfCollect };