@ohm-js/wasm 0.6.11 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/compat.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export interface Grammar extends WasmGrammar {
|
|
|
6
6
|
export declare function grammar(source: string): Grammar;
|
|
7
7
|
export declare function grammars(source: string): Record<string, Grammar>;
|
|
8
8
|
export { createToAst } from './createToAst.ts';
|
|
9
|
+
export type { AstMapping, AstNodeTemplate } from './createToAst.ts';
|
|
9
10
|
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -2,7 +2,7 @@ import type { CstNode, CstNodeChildren, MatchResult, NonterminalNode, TerminalNo
|
|
|
2
2
|
export type AstNodeTemplate<R> = {
|
|
3
3
|
[property: string]: number | string | boolean | object | null | ((children: CstNodeChildren) => R);
|
|
4
4
|
};
|
|
5
|
-
export type AstMapping<R> = Record<string, AstNodeTemplate<R> | number | ((...children: CstNodeChildren) => R)>;
|
|
5
|
+
export type AstMapping<R> = Record<string, AstNodeTemplate<R> | number | ((this: CstNode, ...children: CstNodeChildren) => R)>;
|
|
6
6
|
export declare function createToAst<TNode = any>(mapping: AstMapping<TNode>, opts?: {
|
|
7
7
|
debug?: boolean;
|
|
8
8
|
}): (nodeOrResult: MatchResult | CstNode) => TNode;
|