forked from spreeuwers/xsd2ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsing.d.ts
84 lines (84 loc) · 2.94 KB
/
parsing.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
export declare type FindNextNode = (n: Node) => Node;
export declare type AstNodeFactory = (n: Node) => ASTNode;
export declare type AstNodeMerger = (r1: ASTNode, r2: ASTNode) => ASTNode;
export declare function setNamespace(namespace: string): void;
export declare function astNode(s: string): ASTNode;
export declare function astClass(n?: Node): ASTNode;
export declare function astEnum(n: Node): ASTNode;
export declare function astEnumValue(n: Node): ASTNode;
export declare function astField(): ASTNode;
export declare function oneOf(...options: Parslet[]): OneOf;
export declare function match(t: Terminal, m?: AstNodeMerger): Matcher;
export interface IParsable {
parse(node: Node, indent?: string): ASTNode;
}
export declare type Attribs = {
[key: string]: string;
};
export declare function getFieldType(type: string, defNs: string): string;
export declare class ASTNode {
nodeType: string;
name: string;
private _attr;
children: ASTNode[];
constructor(type: string);
prop(key: string, value: any): this;
named(name: string): ASTNode;
addName(node: Node, prefix?: string): ASTNode;
addField(node: Node, fldType?: string): this;
addAttrField(node: Node, fldType?: string): this;
get attr(): any;
addAttribs(n: Node): this;
merge(other: ASTNode): ASTNode;
}
export declare class ASTClass extends ASTNode {
constructor(n: Node);
get nodeType(): string;
}
export declare abstract class Parslet implements IParsable {
name: string;
label: string;
fnNextNode: FindNextNode;
nextParslet: Parslet;
constructor(name: string);
abstract parse(node: Node, indent?: string): ASTNode;
addNext(p: Parslet, fnn: FindNextNode): this;
children(...options: Parslet[]): this;
child(t: Terminal, m?: AstNodeMerger): this;
match(t: Terminal, m?: AstNodeMerger): this;
childIsOneOf(...options: Parslet[]): this;
empty(): this;
labeled(s: string): this;
}
export declare class Empty extends Parslet {
parse(node: Node, indent?: string): ASTNode;
}
export declare class Terminal implements IParsable {
name: string;
tagName: string;
private astNodeFactory;
constructor(name: string, handler?: AstNodeFactory);
parse(node: Node, indent?: string): ASTNode;
}
export declare class Proxy extends Parslet {
parsable: Parslet;
constructor(name: string);
set parslet(p: Parslet);
parse(node: Node, indent?: string): ASTNode;
}
export declare class Matcher extends Parslet {
private terminal;
private merger;
constructor(name: string, t: Terminal, m?: AstNodeMerger);
parse(node: Node, indent?: string): ASTNode;
}
export declare class OneOf extends Parslet {
options: Parslet[];
constructor(name: string, options: Parslet[]);
parse(node: Node, indent?: string): ASTNode;
}
export declare class Sibblings extends Parslet {
options: Parslet[];
constructor(name: string, options: Parslet[]);
parse(node: Node, indent?: string): ASTNode;
}