forked from benjamn/ast-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe4x.js
86 lines (66 loc) · 2.24 KB
/
e4x.js
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
85
86
module.exports = function (fork) {
fork.use(require("./core"));
var types = fork.use(require("../lib/types"));
var def = types.Type.def;
var or = types.Type.or;
// Note that none of these types are buildable because the Mozilla Parser
// API doesn't specify any builder functions, and nobody uses E4X anymore.
def("XMLDefaultDeclaration")
.bases("Declaration")
.field("namespace", def("Expression"));
def("XMLAnyName").bases("Expression");
def("XMLQualifiedIdentifier")
.bases("Expression")
.field("left", or(def("Identifier"), def("XMLAnyName")))
.field("right", or(def("Identifier"), def("Expression")))
.field("computed", Boolean);
def("XMLFunctionQualifiedIdentifier")
.bases("Expression")
.field("right", or(def("Identifier"), def("Expression")))
.field("computed", Boolean);
def("XMLAttributeSelector")
.bases("Expression")
.field("attribute", def("Expression"));
def("XMLFilterExpression")
.bases("Expression")
.field("left", def("Expression"))
.field("right", def("Expression"));
def("XMLElement")
.bases("XML", "Expression")
.field("contents", [def("XML")]);
def("XMLList")
.bases("XML", "Expression")
.field("contents", [def("XML")]);
def("XML").bases("Node");
def("XMLEscape")
.bases("XML")
.field("expression", def("Expression"));
def("XMLText")
.bases("XML")
.field("text", String);
def("XMLStartTag")
.bases("XML")
.field("contents", [def("XML")]);
def("XMLEndTag")
.bases("XML")
.field("contents", [def("XML")]);
def("XMLPointTag")
.bases("XML")
.field("contents", [def("XML")]);
def("XMLName")
.bases("XML")
.field("contents", or(String, [def("XML")]));
def("XMLAttribute")
.bases("XML")
.field("value", String);
def("XMLCdata")
.bases("XML")
.field("contents", String);
def("XMLComment")
.bases("XML")
.field("contents", String);
def("XMLProcessingInstruction")
.bases("XML")
.field("target", String)
.field("contents", or(String, null));
};