source: frontend/node_modules/acorn-walk/dist/walk.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.5 KB
Line 
1import {Node} from 'acorn';
2
3declare module "acorn-walk" {
4 type FullWalkerCallback<TState> = (
5 node: Node,
6 state: TState,
7 type: string
8 ) => void;
9
10 type FullAncestorWalkerCallback<TState> = (
11 node: Node,
12 state: TState | Node[],
13 ancestors: Node[],
14 type: string
15 ) => void;
16 type WalkerCallback<TState> = (node: Node, state: TState) => void;
17
18 type SimpleWalkerFn<TState> = (
19 node: Node,
20 state: TState
21 ) => void;
22
23 type AncestorWalkerFn<TState> = (
24 node: Node,
25 state: TState| Node[],
26 ancestors: Node[]
27 ) => void;
28
29 type RecursiveWalkerFn<TState> = (
30 node: Node,
31 state: TState,
32 callback: WalkerCallback<TState>
33 ) => void;
34
35 type SimpleVisitors<TState> = {
36 [type: string]: SimpleWalkerFn<TState>
37 };
38
39 type AncestorVisitors<TState> = {
40 [type: string]: AncestorWalkerFn<TState>
41 };
42
43 type RecursiveVisitors<TState> = {
44 [type: string]: RecursiveWalkerFn<TState>
45 };
46
47 type FindPredicate = (type: string, node: Node) => boolean;
48
49 interface Found<TState> {
50 node: Node,
51 state: TState
52 }
53
54 export function simple<TState>(
55 node: Node,
56 visitors: SimpleVisitors<TState>,
57 base?: RecursiveVisitors<TState>,
58 state?: TState
59 ): void;
60
61 export function ancestor<TState>(
62 node: Node,
63 visitors: AncestorVisitors<TState>,
64 base?: RecursiveVisitors<TState>,
65 state?: TState
66 ): void;
67
68 export function recursive<TState>(
69 node: Node,
70 state: TState,
71 functions: RecursiveVisitors<TState>,
72 base?: RecursiveVisitors<TState>
73 ): void;
74
75 export function full<TState>(
76 node: Node,
77 callback: FullWalkerCallback<TState>,
78 base?: RecursiveVisitors<TState>,
79 state?: TState
80 ): void;
81
82 export function fullAncestor<TState>(
83 node: Node,
84 callback: FullAncestorWalkerCallback<TState>,
85 base?: RecursiveVisitors<TState>,
86 state?: TState
87 ): void;
88
89 export function make<TState>(
90 functions: RecursiveVisitors<TState>,
91 base?: RecursiveVisitors<TState>
92 ): RecursiveVisitors<TState>;
93
94 export function findNodeAt<TState>(
95 node: Node,
96 start: number | undefined,
97 end?: number | undefined,
98 type?: FindPredicate | string,
99 base?: RecursiveVisitors<TState>,
100 state?: TState
101 ): Found<TState> | undefined;
102
103 export function findNodeAround<TState>(
104 node: Node,
105 start: number | undefined,
106 type?: FindPredicate | string,
107 base?: RecursiveVisitors<TState>,
108 state?: TState
109 ): Found<TState> | undefined;
110
111 export const findNodeAfter: typeof findNodeAround;
112}
Note: See TracBrowser for help on using the repository browser.