UNPKG

@thi.ng/parse

Version:

Purely functional parser combinators & AST generation for generic inputs

12 lines (11 loc) 249 B
import { xform } from "../combinators/xform.js"; const xfCount = (scope) => { scope.result = scope.children?.length || 0; scope.children = null; return scope; }; const count = (parser) => xform(parser, xfCount); export { count, xfCount };