@thi.ng/parse
Version:
Purely functional parser combinators & AST generation for generic inputs
19 lines • 884 B
TypeScript
import type { Parser, ScopeTransform } from "../api.js";
/**
* HOF scope transform which applies given parser to result of given scope's
* result, or if result is null, first joins children using {@link xfJoin}.
*
* @remarks
* The nested parser is applied to a separate {@link ParseContext} and if
* successful, the resulting AST will be transplanted into the current parse
* scope. If the nested parser fails, the scope will remain untouched.
*
* If the current parse context retains line/column details, the inner parse
* context will be configured to produce true absolute offsets for its results
* as if they were in the main context.
*
* @param parser -
*/
export declare const xfNest: (parser: Parser<string>) => ScopeTransform<string>;
export declare const nest: (outer: Parser<string>, inner: Parser<string>) => Parser<string>;
//# sourceMappingURL=nest.d.ts.map