import type { Parser , ScopeTransform } from "../api.js" ; import { xform } from "../combinators/xform.js" ; /**
 * Replace AST node with its first child node. Also see  hoist .
 *
 *  param scope export const xfHoist = ( scope ) => { Object . assign ( scope , scope ! . children ! [ 0 ] ) ; return scope ; } ; /**
 * Moves the result of first child node to this node, then discards all
 * children. Also see  hoistR .
 *
 *  param scope export const xfHoistResult = ( scope ) => { scope ! . result = scope ! . children ! [ 0 ] . result ; scope ! . children = null ; return scope ; } ; param parser export const hoist = < T > ( parser ) => xform ( parser , xfHoist ) ; param parser export const hoistResult = < T > ( parser ) => xform ( parser , xfHoistResult ) ;