@cr_docs_t/dts 0.32.0 → 0.33.0
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/misc/fetch/index.d.ts +9 -4
- package/dist/misc/fetch/index.d.ts.map +1 -1
- package/dist/misc/fetch/index.js +10 -1
- package/dist/treesitter/types/AST.d.ts +245 -12
- package/dist/treesitter/types/AST.d.ts.map +1 -1
- package/dist/treesitter/types/AST.js +1491 -856
- package/dist/type-gen.js +37 -37
- package/dist/types/Presence.d.ts +4 -2
- package/dist/types/Presence.d.ts.map +1 -1
- package/dist/types/Presence.js +1 -1
- package/package.json +1 -1
|
@@ -3,2003 +3,2634 @@ import { v4 } from "uuid";
|
|
|
3
3
|
// Unmarshalers
|
|
4
4
|
function unmarshalerAcronymDefinitionNode(node, ctx, parentId) {
|
|
5
5
|
const id = v4();
|
|
6
|
+
const namedChildren = node.namedChildren;
|
|
6
7
|
const n = {
|
|
7
8
|
id,
|
|
8
9
|
parentId,
|
|
9
10
|
type: "acronym_definition",
|
|
10
|
-
text: node.text,
|
|
11
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
12
|
+
startIndex: node.startIndex,
|
|
13
|
+
endIndex: node.endIndex,
|
|
11
14
|
};
|
|
12
15
|
ctx.nodes.set(id, n);
|
|
13
|
-
n.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
17
|
+
{
|
|
18
|
+
const _fc = node.childForFieldName("command");
|
|
19
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
20
|
+
}
|
|
21
|
+
{
|
|
22
|
+
const _fc = node.childForFieldName("long");
|
|
23
|
+
n.long = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
24
|
+
}
|
|
25
|
+
{
|
|
26
|
+
const _fc = node.childForFieldName("name");
|
|
27
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
28
|
+
}
|
|
29
|
+
{
|
|
30
|
+
const _fc = node.childForFieldName("options");
|
|
31
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
32
|
+
}
|
|
33
|
+
{
|
|
34
|
+
const _fc = node.childForFieldName("short");
|
|
35
|
+
n.short = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
36
|
+
}
|
|
27
37
|
return id;
|
|
28
38
|
}
|
|
29
39
|
function unmarshalerAcronymReferenceNode(node, ctx, parentId) {
|
|
30
40
|
const id = v4();
|
|
41
|
+
const namedChildren = node.namedChildren;
|
|
31
42
|
const n = {
|
|
32
43
|
id,
|
|
33
44
|
parentId,
|
|
34
45
|
type: "acronym_reference",
|
|
35
|
-
text: node.text,
|
|
46
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
47
|
+
startIndex: node.startIndex,
|
|
48
|
+
endIndex: node.endIndex,
|
|
36
49
|
};
|
|
37
50
|
ctx.nodes.set(id, n);
|
|
38
|
-
n.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
node.childForFieldName("name")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
52
|
+
{
|
|
53
|
+
const _fc = node.childForFieldName("command");
|
|
54
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
55
|
+
}
|
|
56
|
+
{
|
|
57
|
+
const _fc = node.childForFieldName("name");
|
|
58
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
59
|
+
}
|
|
60
|
+
{
|
|
61
|
+
const _fc = node.childForFieldName("options");
|
|
62
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
63
|
+
}
|
|
48
64
|
return id;
|
|
49
65
|
}
|
|
50
66
|
function unmarshalerAsyEnvironmentNode(node, ctx, parentId) {
|
|
51
67
|
const id = v4();
|
|
68
|
+
const namedChildren = node.namedChildren;
|
|
52
69
|
const n = {
|
|
53
70
|
id,
|
|
54
71
|
parentId,
|
|
55
72
|
type: "asy_environment",
|
|
56
|
-
text: node.text,
|
|
73
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
74
|
+
startIndex: node.startIndex,
|
|
75
|
+
endIndex: node.endIndex,
|
|
57
76
|
};
|
|
58
77
|
ctx.nodes.set(id, n);
|
|
59
|
-
n.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
node.childForFieldName("
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
79
|
+
{
|
|
80
|
+
const _fc = node.childForFieldName("begin");
|
|
81
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
82
|
+
}
|
|
83
|
+
{
|
|
84
|
+
const _fc = node.childForFieldName("code");
|
|
85
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
86
|
+
}
|
|
87
|
+
{
|
|
88
|
+
const _fc = node.childForFieldName("end");
|
|
89
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
90
|
+
}
|
|
68
91
|
return id;
|
|
69
92
|
}
|
|
70
93
|
function unmarshalerAsydefEnvironmentNode(node, ctx, parentId) {
|
|
71
94
|
const id = v4();
|
|
95
|
+
const namedChildren = node.namedChildren;
|
|
72
96
|
const n = {
|
|
73
97
|
id,
|
|
74
98
|
parentId,
|
|
75
99
|
type: "asydef_environment",
|
|
76
|
-
text: node.text,
|
|
100
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
101
|
+
startIndex: node.startIndex,
|
|
102
|
+
endIndex: node.endIndex,
|
|
77
103
|
};
|
|
78
104
|
ctx.nodes.set(id, n);
|
|
79
|
-
n.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
node.childForFieldName("
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
106
|
+
{
|
|
107
|
+
const _fc = node.childForFieldName("begin");
|
|
108
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
109
|
+
}
|
|
110
|
+
{
|
|
111
|
+
const _fc = node.childForFieldName("code");
|
|
112
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
113
|
+
}
|
|
114
|
+
{
|
|
115
|
+
const _fc = node.childForFieldName("end");
|
|
116
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
117
|
+
}
|
|
88
118
|
return id;
|
|
89
119
|
}
|
|
90
120
|
function unmarshalerAuthorNode(node, ctx, parentId) {
|
|
91
121
|
const id = v4();
|
|
122
|
+
const namedChildren = node.namedChildren;
|
|
92
123
|
const n = {
|
|
93
124
|
id,
|
|
94
125
|
parentId,
|
|
95
126
|
type: "author",
|
|
96
|
-
text: node.text,
|
|
127
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
128
|
+
startIndex: node.startIndex,
|
|
129
|
+
endIndex: node.endIndex,
|
|
97
130
|
};
|
|
98
131
|
ctx.nodes.set(id, n);
|
|
99
|
-
n.childrenIds =
|
|
132
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
100
133
|
return id;
|
|
101
134
|
}
|
|
102
135
|
function unmarshalerAuthorDeclarationNode(node, ctx, parentId) {
|
|
103
136
|
const id = v4();
|
|
137
|
+
const namedChildren = node.namedChildren;
|
|
104
138
|
const n = {
|
|
105
139
|
id,
|
|
106
140
|
parentId,
|
|
107
141
|
type: "author_declaration",
|
|
108
|
-
text: node.text,
|
|
142
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
143
|
+
startIndex: node.startIndex,
|
|
144
|
+
endIndex: node.endIndex,
|
|
109
145
|
};
|
|
110
146
|
ctx.nodes.set(id, n);
|
|
111
|
-
n.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
node.childForFieldName("command")
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
147
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
148
|
+
{
|
|
149
|
+
const _fc = node.childForFieldName("authors");
|
|
150
|
+
n.authors = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
151
|
+
}
|
|
152
|
+
{
|
|
153
|
+
const _fc = node.childForFieldName("command");
|
|
154
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
155
|
+
}
|
|
156
|
+
{
|
|
157
|
+
const _fc = node.childForFieldName("options");
|
|
158
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
159
|
+
}
|
|
121
160
|
return id;
|
|
122
161
|
}
|
|
123
162
|
function unmarshalerBeginNode(node, ctx, parentId) {
|
|
124
163
|
const id = v4();
|
|
164
|
+
const namedChildren = node.namedChildren;
|
|
125
165
|
const n = {
|
|
126
166
|
id,
|
|
127
167
|
parentId,
|
|
128
168
|
type: "begin",
|
|
129
|
-
text: node.text,
|
|
169
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
170
|
+
startIndex: node.startIndex,
|
|
171
|
+
endIndex: node.endIndex,
|
|
130
172
|
};
|
|
131
173
|
ctx.nodes.set(id, n);
|
|
132
|
-
n.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
174
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
175
|
+
{
|
|
176
|
+
const _fc = node.childForFieldName("command");
|
|
177
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
178
|
+
}
|
|
179
|
+
{
|
|
180
|
+
const _fc = node.childForFieldName("language");
|
|
181
|
+
n.language = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
182
|
+
}
|
|
183
|
+
{
|
|
184
|
+
const _fc = node.childForFieldName("name");
|
|
185
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
186
|
+
}
|
|
187
|
+
{
|
|
188
|
+
const _fc = node.childForFieldName("options");
|
|
189
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
190
|
+
}
|
|
145
191
|
return id;
|
|
146
192
|
}
|
|
147
193
|
function unmarshalerBiblatexIncludeNode(node, ctx, parentId) {
|
|
148
194
|
const id = v4();
|
|
195
|
+
const namedChildren = node.namedChildren;
|
|
149
196
|
const n = {
|
|
150
197
|
id,
|
|
151
198
|
parentId,
|
|
152
199
|
type: "biblatex_include",
|
|
153
|
-
text: node.text,
|
|
200
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
201
|
+
startIndex: node.startIndex,
|
|
202
|
+
endIndex: node.endIndex,
|
|
154
203
|
};
|
|
155
204
|
ctx.nodes.set(id, n);
|
|
156
|
-
n.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
205
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
206
|
+
{
|
|
207
|
+
const _fc = node.childForFieldName("glob");
|
|
208
|
+
n.glob = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
209
|
+
}
|
|
210
|
+
{
|
|
211
|
+
const _fc = node.childForFieldName("options");
|
|
212
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
213
|
+
}
|
|
161
214
|
return id;
|
|
162
215
|
}
|
|
163
216
|
function unmarshalerBibstyleIncludeNode(node, ctx, parentId) {
|
|
164
217
|
const id = v4();
|
|
218
|
+
const namedChildren = node.namedChildren;
|
|
165
219
|
const n = {
|
|
166
220
|
id,
|
|
167
221
|
parentId,
|
|
168
222
|
type: "bibstyle_include",
|
|
169
|
-
text: node.text,
|
|
223
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
224
|
+
startIndex: node.startIndex,
|
|
225
|
+
endIndex: node.endIndex,
|
|
170
226
|
};
|
|
171
227
|
ctx.nodes.set(id, n);
|
|
172
|
-
n.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
228
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
229
|
+
{
|
|
230
|
+
const _fc = node.childForFieldName("command");
|
|
231
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
232
|
+
}
|
|
233
|
+
{
|
|
234
|
+
const _fc = node.childForFieldName("path");
|
|
235
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
236
|
+
}
|
|
176
237
|
return id;
|
|
177
238
|
}
|
|
178
239
|
function unmarshalerBibtexIncludeNode(node, ctx, parentId) {
|
|
179
240
|
const id = v4();
|
|
241
|
+
const namedChildren = node.namedChildren;
|
|
180
242
|
const n = {
|
|
181
243
|
id,
|
|
182
244
|
parentId,
|
|
183
245
|
type: "bibtex_include",
|
|
184
|
-
text: node.text,
|
|
246
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
247
|
+
startIndex: node.startIndex,
|
|
248
|
+
endIndex: node.endIndex,
|
|
185
249
|
};
|
|
186
250
|
ctx.nodes.set(id, n);
|
|
187
|
-
n.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
251
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
252
|
+
{
|
|
253
|
+
const _fc = node.childForFieldName("command");
|
|
254
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
255
|
+
}
|
|
256
|
+
{
|
|
257
|
+
const _fc = node.childForFieldName("paths");
|
|
258
|
+
n.paths = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
259
|
+
}
|
|
191
260
|
return id;
|
|
192
261
|
}
|
|
193
262
|
function unmarshalerBlockCommentNode(node, ctx, parentId) {
|
|
194
263
|
const id = v4();
|
|
264
|
+
const namedChildren = node.namedChildren;
|
|
195
265
|
const n = {
|
|
196
266
|
id,
|
|
197
267
|
parentId,
|
|
198
268
|
type: "block_comment",
|
|
199
|
-
text: node.text,
|
|
269
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
270
|
+
startIndex: node.startIndex,
|
|
271
|
+
endIndex: node.endIndex,
|
|
200
272
|
};
|
|
201
273
|
ctx.nodes.set(id, n);
|
|
202
|
-
n.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
node.childForFieldName("
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
274
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
275
|
+
{
|
|
276
|
+
const _fc = node.childForFieldName("begin");
|
|
277
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
278
|
+
}
|
|
279
|
+
{
|
|
280
|
+
const _fc = node.childForFieldName("comment");
|
|
281
|
+
n.comment = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
282
|
+
}
|
|
283
|
+
{
|
|
284
|
+
const _fc = node.childForFieldName("end");
|
|
285
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
286
|
+
}
|
|
213
287
|
return id;
|
|
214
288
|
}
|
|
215
289
|
function unmarshalerBrackGroupNode(node, ctx, parentId) {
|
|
216
290
|
const id = v4();
|
|
291
|
+
const namedChildren = node.namedChildren;
|
|
217
292
|
const n = {
|
|
218
293
|
id,
|
|
219
294
|
parentId,
|
|
220
295
|
type: "brack_group",
|
|
221
|
-
text: node.text,
|
|
296
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
297
|
+
startIndex: node.startIndex,
|
|
298
|
+
endIndex: node.endIndex,
|
|
222
299
|
};
|
|
223
300
|
ctx.nodes.set(id, n);
|
|
224
|
-
n.childrenIds =
|
|
301
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
225
302
|
return id;
|
|
226
303
|
}
|
|
227
304
|
function unmarshalerBrackGroupArgcNode(node, ctx, parentId) {
|
|
228
305
|
const id = v4();
|
|
306
|
+
const namedChildren = node.namedChildren;
|
|
229
307
|
const n = {
|
|
230
308
|
id,
|
|
231
309
|
parentId,
|
|
232
310
|
type: "brack_group_argc",
|
|
233
|
-
text: node.text,
|
|
311
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
312
|
+
startIndex: node.startIndex,
|
|
313
|
+
endIndex: node.endIndex,
|
|
234
314
|
};
|
|
235
315
|
ctx.nodes.set(id, n);
|
|
236
|
-
n.
|
|
237
|
-
|
|
238
|
-
|
|
316
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
317
|
+
{
|
|
318
|
+
const _fc = node.childForFieldName("value");
|
|
319
|
+
n.value = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
320
|
+
}
|
|
239
321
|
return id;
|
|
240
322
|
}
|
|
241
323
|
function unmarshalerBrackGroupKeyValueNode(node, ctx, parentId) {
|
|
242
324
|
const id = v4();
|
|
325
|
+
const namedChildren = node.namedChildren;
|
|
243
326
|
const n = {
|
|
244
327
|
id,
|
|
245
328
|
parentId,
|
|
246
329
|
type: "brack_group_key_value",
|
|
247
|
-
text: node.text,
|
|
330
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
331
|
+
startIndex: node.startIndex,
|
|
332
|
+
endIndex: node.endIndex,
|
|
248
333
|
};
|
|
249
334
|
ctx.nodes.set(id, n);
|
|
250
|
-
n.
|
|
251
|
-
|
|
252
|
-
|
|
335
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
336
|
+
n.pair = node
|
|
337
|
+
.childrenForFieldName("pair")
|
|
338
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
339
|
+
.filter((id) => id !== undefined);
|
|
253
340
|
return id;
|
|
254
341
|
}
|
|
255
342
|
function unmarshalerBrackGroupTextNode(node, ctx, parentId) {
|
|
256
343
|
const id = v4();
|
|
344
|
+
const namedChildren = node.namedChildren;
|
|
257
345
|
const n = {
|
|
258
346
|
id,
|
|
259
347
|
parentId,
|
|
260
348
|
type: "brack_group_text",
|
|
261
|
-
text: node.text,
|
|
349
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
350
|
+
startIndex: node.startIndex,
|
|
351
|
+
endIndex: node.endIndex,
|
|
262
352
|
};
|
|
263
353
|
ctx.nodes.set(id, n);
|
|
264
|
-
n.
|
|
265
|
-
const fieldNodes = new Set([node.childForFieldName("text").id].filter((id) => id !== undefined));
|
|
266
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
354
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
267
355
|
return id;
|
|
268
356
|
}
|
|
269
357
|
function unmarshalerBrackGroupWordNode(node, ctx, parentId) {
|
|
270
358
|
const id = v4();
|
|
359
|
+
const namedChildren = node.namedChildren;
|
|
271
360
|
const n = {
|
|
272
361
|
id,
|
|
273
362
|
parentId,
|
|
274
363
|
type: "brack_group_word",
|
|
275
|
-
text: node.text,
|
|
364
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
365
|
+
startIndex: node.startIndex,
|
|
366
|
+
endIndex: node.endIndex,
|
|
276
367
|
};
|
|
277
368
|
ctx.nodes.set(id, n);
|
|
278
|
-
n.
|
|
279
|
-
|
|
280
|
-
|
|
369
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
370
|
+
{
|
|
371
|
+
const _fc = node.childForFieldName("word");
|
|
372
|
+
n.word = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
373
|
+
}
|
|
281
374
|
return id;
|
|
282
375
|
}
|
|
283
376
|
function unmarshalerCaptionNode(node, ctx, parentId) {
|
|
284
377
|
const id = v4();
|
|
378
|
+
const namedChildren = node.namedChildren;
|
|
285
379
|
const n = {
|
|
286
380
|
id,
|
|
287
381
|
parentId,
|
|
288
382
|
type: "caption",
|
|
289
|
-
text: node.text,
|
|
383
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
384
|
+
startIndex: node.startIndex,
|
|
385
|
+
endIndex: node.endIndex,
|
|
290
386
|
};
|
|
291
387
|
ctx.nodes.set(id, n);
|
|
292
|
-
n.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
node.childForFieldName("long")
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
388
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
389
|
+
{
|
|
390
|
+
const _fc = node.childForFieldName("command");
|
|
391
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
392
|
+
}
|
|
393
|
+
{
|
|
394
|
+
const _fc = node.childForFieldName("long");
|
|
395
|
+
n.long = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
396
|
+
}
|
|
397
|
+
{
|
|
398
|
+
const _fc = node.childForFieldName("short");
|
|
399
|
+
n.short = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
400
|
+
}
|
|
302
401
|
return id;
|
|
303
402
|
}
|
|
304
403
|
function unmarshalerChangesReplacedNode(node, ctx, parentId) {
|
|
305
404
|
const id = v4();
|
|
405
|
+
const namedChildren = node.namedChildren;
|
|
306
406
|
const n = {
|
|
307
407
|
id,
|
|
308
408
|
parentId,
|
|
309
409
|
type: "changes_replaced",
|
|
310
|
-
text: node.text,
|
|
410
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
411
|
+
startIndex: node.startIndex,
|
|
412
|
+
endIndex: node.endIndex,
|
|
311
413
|
};
|
|
312
414
|
ctx.nodes.set(id, n);
|
|
313
|
-
n.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
node.childForFieldName("
|
|
320
|
-
|
|
321
|
-
|
|
415
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
416
|
+
{
|
|
417
|
+
const _fc = node.childForFieldName("command");
|
|
418
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
419
|
+
}
|
|
420
|
+
{
|
|
421
|
+
const _fc = node.childForFieldName("text_added");
|
|
422
|
+
n.text_added = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
423
|
+
}
|
|
424
|
+
{
|
|
425
|
+
const _fc = node.childForFieldName("text_deleted");
|
|
426
|
+
n.text_deleted = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
427
|
+
}
|
|
322
428
|
return id;
|
|
323
429
|
}
|
|
324
430
|
function unmarshalerChapterNode(node, ctx, parentId) {
|
|
325
431
|
const id = v4();
|
|
432
|
+
const namedChildren = node.namedChildren;
|
|
326
433
|
const n = {
|
|
327
434
|
id,
|
|
328
435
|
parentId,
|
|
329
436
|
type: "chapter",
|
|
330
|
-
text: node.text,
|
|
437
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
438
|
+
startIndex: node.startIndex,
|
|
439
|
+
endIndex: node.endIndex,
|
|
331
440
|
};
|
|
332
441
|
ctx.nodes.set(id, n);
|
|
333
|
-
n.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
node.childForFieldName("
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
].filter((id) => id !== undefined));
|
|
343
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
442
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
443
|
+
{
|
|
444
|
+
const _fc = node.childForFieldName("command");
|
|
445
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
446
|
+
}
|
|
447
|
+
{
|
|
448
|
+
const _fc = node.childForFieldName("toc");
|
|
449
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
450
|
+
}
|
|
344
451
|
return id;
|
|
345
452
|
}
|
|
346
453
|
function unmarshalerCitationNode(node, ctx, parentId) {
|
|
347
454
|
const id = v4();
|
|
455
|
+
const namedChildren = node.namedChildren;
|
|
348
456
|
const n = {
|
|
349
457
|
id,
|
|
350
458
|
parentId,
|
|
351
459
|
type: "citation",
|
|
352
|
-
text: node.text,
|
|
460
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
461
|
+
startIndex: node.startIndex,
|
|
462
|
+
endIndex: node.endIndex,
|
|
353
463
|
};
|
|
354
464
|
ctx.nodes.set(id, n);
|
|
355
|
-
n.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
465
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
466
|
+
{
|
|
467
|
+
const _fc = node.childForFieldName("command");
|
|
468
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
469
|
+
}
|
|
470
|
+
{
|
|
471
|
+
const _fc = node.childForFieldName("keys");
|
|
472
|
+
n.keys = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
473
|
+
}
|
|
474
|
+
{
|
|
475
|
+
const _fc = node.childForFieldName("postnote");
|
|
476
|
+
n.postnote = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
477
|
+
}
|
|
478
|
+
{
|
|
479
|
+
const _fc = node.childForFieldName("prenote");
|
|
480
|
+
n.prenote = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
481
|
+
}
|
|
368
482
|
return id;
|
|
369
483
|
}
|
|
370
484
|
function unmarshalerClassIncludeNode(node, ctx, parentId) {
|
|
371
485
|
const id = v4();
|
|
486
|
+
const namedChildren = node.namedChildren;
|
|
372
487
|
const n = {
|
|
373
488
|
id,
|
|
374
489
|
parentId,
|
|
375
490
|
type: "class_include",
|
|
376
|
-
text: node.text,
|
|
491
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
492
|
+
startIndex: node.startIndex,
|
|
493
|
+
endIndex: node.endIndex,
|
|
377
494
|
};
|
|
378
495
|
ctx.nodes.set(id, n);
|
|
379
|
-
n.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
496
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
497
|
+
{
|
|
498
|
+
const _fc = node.childForFieldName("command");
|
|
499
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
500
|
+
}
|
|
501
|
+
{
|
|
502
|
+
const _fc = node.childForFieldName("options");
|
|
503
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
504
|
+
}
|
|
505
|
+
{
|
|
506
|
+
const _fc = node.childForFieldName("path");
|
|
507
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
508
|
+
}
|
|
389
509
|
return id;
|
|
390
510
|
}
|
|
391
511
|
function unmarshalerColorDefinitionNode(node, ctx, parentId) {
|
|
392
512
|
const id = v4();
|
|
513
|
+
const namedChildren = node.namedChildren;
|
|
393
514
|
const n = {
|
|
394
515
|
id,
|
|
395
516
|
parentId,
|
|
396
517
|
type: "color_definition",
|
|
397
|
-
text: node.text,
|
|
518
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
519
|
+
startIndex: node.startIndex,
|
|
520
|
+
endIndex: node.endIndex,
|
|
398
521
|
};
|
|
399
522
|
ctx.nodes.set(id, n);
|
|
400
|
-
n.
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
node.childForFieldName("model")
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
523
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
524
|
+
{
|
|
525
|
+
const _fc = node.childForFieldName("command");
|
|
526
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
527
|
+
}
|
|
528
|
+
{
|
|
529
|
+
const _fc = node.childForFieldName("model");
|
|
530
|
+
n.model = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
531
|
+
}
|
|
532
|
+
{
|
|
533
|
+
const _fc = node.childForFieldName("name");
|
|
534
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
535
|
+
}
|
|
536
|
+
{
|
|
537
|
+
const _fc = node.childForFieldName("spec");
|
|
538
|
+
n.spec = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
539
|
+
}
|
|
411
540
|
return id;
|
|
412
541
|
}
|
|
413
542
|
function unmarshalerColorReferenceNode(node, ctx, parentId) {
|
|
414
543
|
const id = v4();
|
|
544
|
+
const namedChildren = node.namedChildren;
|
|
415
545
|
const n = {
|
|
416
546
|
id,
|
|
417
547
|
parentId,
|
|
418
548
|
type: "color_reference",
|
|
419
|
-
text: node.text,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
n.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
549
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
550
|
+
startIndex: node.startIndex,
|
|
551
|
+
endIndex: node.endIndex,
|
|
552
|
+
};
|
|
553
|
+
ctx.nodes.set(id, n);
|
|
554
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
555
|
+
{
|
|
556
|
+
const _fc = node.childForFieldName("command");
|
|
557
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
558
|
+
}
|
|
559
|
+
{
|
|
560
|
+
const _fc = node.childForFieldName("model");
|
|
561
|
+
n.model = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
562
|
+
}
|
|
563
|
+
{
|
|
564
|
+
const _fc = node.childForFieldName("name");
|
|
565
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
566
|
+
}
|
|
567
|
+
{
|
|
568
|
+
const _fc = node.childForFieldName("spec");
|
|
569
|
+
n.spec = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
570
|
+
}
|
|
439
571
|
return id;
|
|
440
572
|
}
|
|
441
573
|
function unmarshalerColorSetDefinitionNode(node, ctx, parentId) {
|
|
442
574
|
const id = v4();
|
|
575
|
+
const namedChildren = node.namedChildren;
|
|
443
576
|
const n = {
|
|
444
577
|
id,
|
|
445
578
|
parentId,
|
|
446
579
|
type: "color_set_definition",
|
|
447
|
-
text: node.text,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
n.
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
node.childForFieldName("
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
node.childForFieldName("
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
580
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
581
|
+
startIndex: node.startIndex,
|
|
582
|
+
endIndex: node.endIndex,
|
|
583
|
+
};
|
|
584
|
+
ctx.nodes.set(id, n);
|
|
585
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
586
|
+
{
|
|
587
|
+
const _fc = node.childForFieldName("command");
|
|
588
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
589
|
+
}
|
|
590
|
+
{
|
|
591
|
+
const _fc = node.childForFieldName("head");
|
|
592
|
+
n.head = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
593
|
+
}
|
|
594
|
+
{
|
|
595
|
+
const _fc = node.childForFieldName("model");
|
|
596
|
+
n.model = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
597
|
+
}
|
|
598
|
+
{
|
|
599
|
+
const _fc = node.childForFieldName("spec");
|
|
600
|
+
n.spec = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
601
|
+
}
|
|
602
|
+
{
|
|
603
|
+
const _fc = node.childForFieldName("tail");
|
|
604
|
+
n.tail = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
605
|
+
}
|
|
606
|
+
{
|
|
607
|
+
const _fc = node.childForFieldName("ty");
|
|
608
|
+
n.ty = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
609
|
+
}
|
|
466
610
|
return id;
|
|
467
611
|
}
|
|
468
612
|
function unmarshalerCommentEnvironmentNode(node, ctx, parentId) {
|
|
469
613
|
const id = v4();
|
|
614
|
+
const namedChildren = node.namedChildren;
|
|
470
615
|
const n = {
|
|
471
616
|
id,
|
|
472
617
|
parentId,
|
|
473
618
|
type: "comment_environment",
|
|
474
|
-
text: node.text,
|
|
619
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
620
|
+
startIndex: node.startIndex,
|
|
621
|
+
endIndex: node.endIndex,
|
|
475
622
|
};
|
|
476
623
|
ctx.nodes.set(id, n);
|
|
477
|
-
n.
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
node.childForFieldName("
|
|
484
|
-
|
|
485
|
-
|
|
624
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
625
|
+
{
|
|
626
|
+
const _fc = node.childForFieldName("begin");
|
|
627
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
628
|
+
}
|
|
629
|
+
{
|
|
630
|
+
const _fc = node.childForFieldName("comment");
|
|
631
|
+
n.comment = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
632
|
+
}
|
|
633
|
+
{
|
|
634
|
+
const _fc = node.childForFieldName("end");
|
|
635
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
636
|
+
}
|
|
486
637
|
return id;
|
|
487
638
|
}
|
|
488
639
|
function unmarshalerCounterAdditionNode(node, ctx, parentId) {
|
|
489
640
|
const id = v4();
|
|
641
|
+
const namedChildren = node.namedChildren;
|
|
490
642
|
const n = {
|
|
491
643
|
id,
|
|
492
644
|
parentId,
|
|
493
645
|
type: "counter_addition",
|
|
494
|
-
text: node.text,
|
|
646
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
647
|
+
startIndex: node.startIndex,
|
|
648
|
+
endIndex: node.endIndex,
|
|
495
649
|
};
|
|
496
650
|
ctx.nodes.set(id, n);
|
|
497
|
-
n.
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
651
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
652
|
+
{
|
|
653
|
+
const _fc = node.childForFieldName("command");
|
|
654
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
655
|
+
}
|
|
656
|
+
{
|
|
657
|
+
const _fc = node.childForFieldName("counter");
|
|
658
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
659
|
+
}
|
|
660
|
+
n.value = node
|
|
661
|
+
.childrenForFieldName("value")
|
|
662
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
663
|
+
.filter((id) => id !== undefined);
|
|
506
664
|
return id;
|
|
507
665
|
}
|
|
508
666
|
function unmarshalerCounterDeclarationNode(node, ctx, parentId) {
|
|
509
667
|
const id = v4();
|
|
668
|
+
const namedChildren = node.namedChildren;
|
|
510
669
|
const n = {
|
|
511
670
|
id,
|
|
512
671
|
parentId,
|
|
513
672
|
type: "counter_declaration",
|
|
514
|
-
text: node.text,
|
|
673
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
674
|
+
startIndex: node.startIndex,
|
|
675
|
+
endIndex: node.endIndex,
|
|
515
676
|
};
|
|
516
677
|
ctx.nodes.set(id, n);
|
|
517
|
-
n.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
node.childForFieldName("counter")
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
678
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
679
|
+
{
|
|
680
|
+
const _fc = node.childForFieldName("command");
|
|
681
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
682
|
+
}
|
|
683
|
+
{
|
|
684
|
+
const _fc = node.childForFieldName("counter");
|
|
685
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
686
|
+
}
|
|
687
|
+
{
|
|
688
|
+
const _fc = node.childForFieldName("supercounter");
|
|
689
|
+
n.supercounter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
690
|
+
}
|
|
527
691
|
return id;
|
|
528
692
|
}
|
|
529
693
|
function unmarshalerCounterDefinitionNode(node, ctx, parentId) {
|
|
530
694
|
const id = v4();
|
|
695
|
+
const namedChildren = node.namedChildren;
|
|
531
696
|
const n = {
|
|
532
697
|
id,
|
|
533
698
|
parentId,
|
|
534
699
|
type: "counter_definition",
|
|
535
|
-
text: node.text,
|
|
700
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
701
|
+
startIndex: node.startIndex,
|
|
702
|
+
endIndex: node.endIndex,
|
|
536
703
|
};
|
|
537
704
|
ctx.nodes.set(id, n);
|
|
538
|
-
n.
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
705
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
706
|
+
{
|
|
707
|
+
const _fc = node.childForFieldName("command");
|
|
708
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
709
|
+
}
|
|
710
|
+
{
|
|
711
|
+
const _fc = node.childForFieldName("counter");
|
|
712
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
713
|
+
}
|
|
714
|
+
n.value = node
|
|
715
|
+
.childrenForFieldName("value")
|
|
716
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
717
|
+
.filter((id) => id !== undefined);
|
|
547
718
|
return id;
|
|
548
719
|
}
|
|
549
720
|
function unmarshalerCounterIncrementNode(node, ctx, parentId) {
|
|
550
721
|
const id = v4();
|
|
722
|
+
const namedChildren = node.namedChildren;
|
|
551
723
|
const n = {
|
|
552
724
|
id,
|
|
553
725
|
parentId,
|
|
554
726
|
type: "counter_increment",
|
|
555
|
-
text: node.text,
|
|
727
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
728
|
+
startIndex: node.startIndex,
|
|
729
|
+
endIndex: node.endIndex,
|
|
556
730
|
};
|
|
557
731
|
ctx.nodes.set(id, n);
|
|
558
|
-
n.
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
732
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
733
|
+
{
|
|
734
|
+
const _fc = node.childForFieldName("command");
|
|
735
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
736
|
+
}
|
|
737
|
+
{
|
|
738
|
+
const _fc = node.childForFieldName("counter");
|
|
739
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
740
|
+
}
|
|
562
741
|
return id;
|
|
563
742
|
}
|
|
564
743
|
function unmarshalerCounterTypesettingNode(node, ctx, parentId) {
|
|
565
744
|
const id = v4();
|
|
745
|
+
const namedChildren = node.namedChildren;
|
|
566
746
|
const n = {
|
|
567
747
|
id,
|
|
568
748
|
parentId,
|
|
569
749
|
type: "counter_typesetting",
|
|
570
|
-
text: node.text,
|
|
750
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
751
|
+
startIndex: node.startIndex,
|
|
752
|
+
endIndex: node.endIndex,
|
|
571
753
|
};
|
|
572
754
|
ctx.nodes.set(id, n);
|
|
573
|
-
n.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
755
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
756
|
+
{
|
|
757
|
+
const _fc = node.childForFieldName("command");
|
|
758
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
759
|
+
}
|
|
760
|
+
{
|
|
761
|
+
const _fc = node.childForFieldName("counter");
|
|
762
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
763
|
+
}
|
|
577
764
|
return id;
|
|
578
765
|
}
|
|
579
766
|
function unmarshalerCounterValueNode(node, ctx, parentId) {
|
|
580
767
|
const id = v4();
|
|
768
|
+
const namedChildren = node.namedChildren;
|
|
581
769
|
const n = {
|
|
582
770
|
id,
|
|
583
771
|
parentId,
|
|
584
772
|
type: "counter_value",
|
|
585
|
-
text: node.text,
|
|
773
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
774
|
+
startIndex: node.startIndex,
|
|
775
|
+
endIndex: node.endIndex,
|
|
586
776
|
};
|
|
587
777
|
ctx.nodes.set(id, n);
|
|
588
|
-
n.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
778
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
779
|
+
{
|
|
780
|
+
const _fc = node.childForFieldName("command");
|
|
781
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
782
|
+
}
|
|
783
|
+
{
|
|
784
|
+
const _fc = node.childForFieldName("counter");
|
|
785
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
786
|
+
}
|
|
592
787
|
return id;
|
|
593
788
|
}
|
|
594
789
|
function unmarshalerCounterWithinDeclarationNode(node, ctx, parentId) {
|
|
595
790
|
const id = v4();
|
|
791
|
+
const namedChildren = node.namedChildren;
|
|
596
792
|
const n = {
|
|
597
793
|
id,
|
|
598
794
|
parentId,
|
|
599
795
|
type: "counter_within_declaration",
|
|
600
|
-
text: node.text,
|
|
796
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
797
|
+
startIndex: node.startIndex,
|
|
798
|
+
endIndex: node.endIndex,
|
|
601
799
|
};
|
|
602
800
|
ctx.nodes.set(id, n);
|
|
603
|
-
n.
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
node.childForFieldName("
|
|
610
|
-
|
|
611
|
-
|
|
801
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
802
|
+
{
|
|
803
|
+
const _fc = node.childForFieldName("command");
|
|
804
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
805
|
+
}
|
|
806
|
+
{
|
|
807
|
+
const _fc = node.childForFieldName("counter");
|
|
808
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
809
|
+
}
|
|
810
|
+
{
|
|
811
|
+
const _fc = node.childForFieldName("supercounter");
|
|
812
|
+
n.supercounter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
813
|
+
}
|
|
612
814
|
return id;
|
|
613
815
|
}
|
|
614
816
|
function unmarshalerCounterWithoutDeclarationNode(node, ctx, parentId) {
|
|
615
817
|
const id = v4();
|
|
818
|
+
const namedChildren = node.namedChildren;
|
|
616
819
|
const n = {
|
|
617
820
|
id,
|
|
618
821
|
parentId,
|
|
619
822
|
type: "counter_without_declaration",
|
|
620
|
-
text: node.text,
|
|
823
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
824
|
+
startIndex: node.startIndex,
|
|
825
|
+
endIndex: node.endIndex,
|
|
621
826
|
};
|
|
622
827
|
ctx.nodes.set(id, n);
|
|
623
|
-
n.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
node.childForFieldName("
|
|
630
|
-
|
|
631
|
-
|
|
828
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
829
|
+
{
|
|
830
|
+
const _fc = node.childForFieldName("command");
|
|
831
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
832
|
+
}
|
|
833
|
+
{
|
|
834
|
+
const _fc = node.childForFieldName("counter");
|
|
835
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
836
|
+
}
|
|
837
|
+
{
|
|
838
|
+
const _fc = node.childForFieldName("supercounter");
|
|
839
|
+
n.supercounter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
840
|
+
}
|
|
632
841
|
return id;
|
|
633
842
|
}
|
|
634
843
|
function unmarshalerCurlyGroupNode(node, ctx, parentId) {
|
|
635
844
|
const id = v4();
|
|
845
|
+
const namedChildren = node.namedChildren;
|
|
636
846
|
const n = {
|
|
637
847
|
id,
|
|
638
848
|
parentId,
|
|
639
849
|
type: "curly_group",
|
|
640
|
-
text: node.text,
|
|
850
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
851
|
+
startIndex: node.startIndex,
|
|
852
|
+
endIndex: node.endIndex,
|
|
641
853
|
};
|
|
642
854
|
ctx.nodes.set(id, n);
|
|
643
|
-
n.childrenIds =
|
|
855
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
644
856
|
return id;
|
|
645
857
|
}
|
|
646
858
|
function unmarshalerCurlyGroupAuthorListNode(node, ctx, parentId) {
|
|
647
859
|
const id = v4();
|
|
860
|
+
const namedChildren = node.namedChildren;
|
|
648
861
|
const n = {
|
|
649
862
|
id,
|
|
650
863
|
parentId,
|
|
651
864
|
type: "curly_group_author_list",
|
|
652
|
-
text: node.text,
|
|
865
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
866
|
+
startIndex: node.startIndex,
|
|
867
|
+
endIndex: node.endIndex,
|
|
653
868
|
};
|
|
654
869
|
ctx.nodes.set(id, n);
|
|
655
|
-
n.childrenIds =
|
|
870
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
656
871
|
return id;
|
|
657
872
|
}
|
|
658
873
|
function unmarshalerCurlyGroupCommandNameNode(node, ctx, parentId) {
|
|
659
874
|
const id = v4();
|
|
875
|
+
const namedChildren = node.namedChildren;
|
|
660
876
|
const n = {
|
|
661
877
|
id,
|
|
662
878
|
parentId,
|
|
663
879
|
type: "curly_group_command_name",
|
|
664
|
-
text: node.text,
|
|
880
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
881
|
+
startIndex: node.startIndex,
|
|
882
|
+
endIndex: node.endIndex,
|
|
665
883
|
};
|
|
666
884
|
ctx.nodes.set(id, n);
|
|
667
|
-
n.
|
|
668
|
-
|
|
669
|
-
|
|
885
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
886
|
+
{
|
|
887
|
+
const _fc = node.childForFieldName("command");
|
|
888
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
889
|
+
}
|
|
670
890
|
return id;
|
|
671
891
|
}
|
|
672
892
|
function unmarshalerCurlyGroupGlobPatternNode(node, ctx, parentId) {
|
|
673
893
|
const id = v4();
|
|
894
|
+
const namedChildren = node.namedChildren;
|
|
674
895
|
const n = {
|
|
675
896
|
id,
|
|
676
897
|
parentId,
|
|
677
898
|
type: "curly_group_glob_pattern",
|
|
678
|
-
text: node.text,
|
|
899
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
900
|
+
startIndex: node.startIndex,
|
|
901
|
+
endIndex: node.endIndex,
|
|
679
902
|
};
|
|
680
903
|
ctx.nodes.set(id, n);
|
|
681
|
-
n.
|
|
682
|
-
|
|
683
|
-
|
|
904
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
905
|
+
{
|
|
906
|
+
const _fc = node.childForFieldName("pattern");
|
|
907
|
+
n.pattern = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
908
|
+
}
|
|
684
909
|
return id;
|
|
685
910
|
}
|
|
686
911
|
function unmarshalerCurlyGroupImplNode(node, ctx, parentId) {
|
|
687
912
|
const id = v4();
|
|
913
|
+
const namedChildren = node.namedChildren;
|
|
688
914
|
const n = {
|
|
689
915
|
id,
|
|
690
916
|
parentId,
|
|
691
917
|
type: "curly_group_impl",
|
|
692
|
-
text: node.text,
|
|
918
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
919
|
+
startIndex: node.startIndex,
|
|
920
|
+
endIndex: node.endIndex,
|
|
693
921
|
};
|
|
694
922
|
ctx.nodes.set(id, n);
|
|
695
|
-
n.childrenIds =
|
|
923
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
696
924
|
return id;
|
|
697
925
|
}
|
|
698
926
|
function unmarshalerCurlyGroupKeyValueNode(node, ctx, parentId) {
|
|
699
927
|
const id = v4();
|
|
928
|
+
const namedChildren = node.namedChildren;
|
|
700
929
|
const n = {
|
|
701
930
|
id,
|
|
702
931
|
parentId,
|
|
703
932
|
type: "curly_group_key_value",
|
|
704
|
-
text: node.text,
|
|
933
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
934
|
+
startIndex: node.startIndex,
|
|
935
|
+
endIndex: node.endIndex,
|
|
705
936
|
};
|
|
706
937
|
ctx.nodes.set(id, n);
|
|
707
|
-
n.
|
|
708
|
-
|
|
709
|
-
|
|
938
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
939
|
+
n.pair = node
|
|
940
|
+
.childrenForFieldName("pair")
|
|
941
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
942
|
+
.filter((id) => id !== undefined);
|
|
710
943
|
return id;
|
|
711
944
|
}
|
|
712
945
|
function unmarshalerCurlyGroupLabelNode(node, ctx, parentId) {
|
|
713
946
|
const id = v4();
|
|
947
|
+
const namedChildren = node.namedChildren;
|
|
714
948
|
const n = {
|
|
715
949
|
id,
|
|
716
950
|
parentId,
|
|
717
951
|
type: "curly_group_label",
|
|
718
|
-
text: node.text,
|
|
952
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
953
|
+
startIndex: node.startIndex,
|
|
954
|
+
endIndex: node.endIndex,
|
|
719
955
|
};
|
|
720
956
|
ctx.nodes.set(id, n);
|
|
721
|
-
n.
|
|
722
|
-
|
|
723
|
-
|
|
957
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
958
|
+
{
|
|
959
|
+
const _fc = node.childForFieldName("label");
|
|
960
|
+
n.label = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
961
|
+
}
|
|
724
962
|
return id;
|
|
725
963
|
}
|
|
726
964
|
function unmarshalerCurlyGroupLabelListNode(node, ctx, parentId) {
|
|
727
965
|
const id = v4();
|
|
966
|
+
const namedChildren = node.namedChildren;
|
|
728
967
|
const n = {
|
|
729
968
|
id,
|
|
730
969
|
parentId,
|
|
731
970
|
type: "curly_group_label_list",
|
|
732
|
-
text: node.text,
|
|
971
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
972
|
+
startIndex: node.startIndex,
|
|
973
|
+
endIndex: node.endIndex,
|
|
733
974
|
};
|
|
734
975
|
ctx.nodes.set(id, n);
|
|
735
|
-
n.
|
|
736
|
-
|
|
737
|
-
|
|
976
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
977
|
+
n.label = node
|
|
978
|
+
.childrenForFieldName("label")
|
|
979
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
980
|
+
.filter((id) => id !== undefined);
|
|
738
981
|
return id;
|
|
739
982
|
}
|
|
740
983
|
function unmarshalerCurlyGroupPathNode(node, ctx, parentId) {
|
|
741
984
|
const id = v4();
|
|
985
|
+
const namedChildren = node.namedChildren;
|
|
742
986
|
const n = {
|
|
743
987
|
id,
|
|
744
988
|
parentId,
|
|
745
989
|
type: "curly_group_path",
|
|
746
|
-
text: node.text,
|
|
990
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
991
|
+
startIndex: node.startIndex,
|
|
992
|
+
endIndex: node.endIndex,
|
|
747
993
|
};
|
|
748
994
|
ctx.nodes.set(id, n);
|
|
749
|
-
n.
|
|
750
|
-
|
|
751
|
-
|
|
995
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
996
|
+
{
|
|
997
|
+
const _fc = node.childForFieldName("path");
|
|
998
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
999
|
+
}
|
|
752
1000
|
return id;
|
|
753
1001
|
}
|
|
754
1002
|
function unmarshalerCurlyGroupPathListNode(node, ctx, parentId) {
|
|
755
1003
|
const id = v4();
|
|
1004
|
+
const namedChildren = node.namedChildren;
|
|
756
1005
|
const n = {
|
|
757
1006
|
id,
|
|
758
1007
|
parentId,
|
|
759
1008
|
type: "curly_group_path_list",
|
|
760
|
-
text: node.text,
|
|
1009
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1010
|
+
startIndex: node.startIndex,
|
|
1011
|
+
endIndex: node.endIndex,
|
|
761
1012
|
};
|
|
762
1013
|
ctx.nodes.set(id, n);
|
|
763
|
-
n.
|
|
764
|
-
|
|
765
|
-
|
|
1014
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1015
|
+
n.path = node
|
|
1016
|
+
.childrenForFieldName("path")
|
|
1017
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
1018
|
+
.filter((id) => id !== undefined);
|
|
766
1019
|
return id;
|
|
767
1020
|
}
|
|
768
1021
|
function unmarshalerCurlyGroupSpecNode(node, ctx, parentId) {
|
|
769
1022
|
const id = v4();
|
|
1023
|
+
const namedChildren = node.namedChildren;
|
|
770
1024
|
const n = {
|
|
771
1025
|
id,
|
|
772
1026
|
parentId,
|
|
773
1027
|
type: "curly_group_spec",
|
|
774
|
-
text: node.text,
|
|
1028
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1029
|
+
startIndex: node.startIndex,
|
|
1030
|
+
endIndex: node.endIndex,
|
|
775
1031
|
};
|
|
776
1032
|
ctx.nodes.set(id, n);
|
|
777
|
-
n.childrenIds =
|
|
1033
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
778
1034
|
return id;
|
|
779
1035
|
}
|
|
780
1036
|
function unmarshalerCurlyGroupTextNode(node, ctx, parentId) {
|
|
781
1037
|
const id = v4();
|
|
1038
|
+
const namedChildren = node.namedChildren;
|
|
782
1039
|
const n = {
|
|
783
1040
|
id,
|
|
784
1041
|
parentId,
|
|
785
1042
|
type: "curly_group_text",
|
|
786
|
-
text: node.text,
|
|
1043
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1044
|
+
startIndex: node.startIndex,
|
|
1045
|
+
endIndex: node.endIndex,
|
|
787
1046
|
};
|
|
788
1047
|
ctx.nodes.set(id, n);
|
|
789
|
-
n.
|
|
790
|
-
const fieldNodes = new Set([node.childForFieldName("text").id].filter((id) => id !== undefined));
|
|
791
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
1048
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
792
1049
|
return id;
|
|
793
1050
|
}
|
|
794
1051
|
function unmarshalerCurlyGroupTextListNode(node, ctx, parentId) {
|
|
795
1052
|
const id = v4();
|
|
1053
|
+
const namedChildren = node.namedChildren;
|
|
796
1054
|
const n = {
|
|
797
1055
|
id,
|
|
798
1056
|
parentId,
|
|
799
1057
|
type: "curly_group_text_list",
|
|
800
|
-
text: node.text,
|
|
1058
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1059
|
+
startIndex: node.startIndex,
|
|
1060
|
+
endIndex: node.endIndex,
|
|
801
1061
|
};
|
|
802
1062
|
ctx.nodes.set(id, n);
|
|
803
|
-
n.
|
|
804
|
-
const fieldNodes = new Set([...node.childrenForFieldName("text").map((n) => n.id)].filter((id) => id !== undefined));
|
|
805
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
1063
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
806
1064
|
return id;
|
|
807
1065
|
}
|
|
808
1066
|
function unmarshalerCurlyGroupUriNode(node, ctx, parentId) {
|
|
809
1067
|
const id = v4();
|
|
1068
|
+
const namedChildren = node.namedChildren;
|
|
810
1069
|
const n = {
|
|
811
1070
|
id,
|
|
812
1071
|
parentId,
|
|
813
1072
|
type: "curly_group_uri",
|
|
814
|
-
text: node.text,
|
|
1073
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1074
|
+
startIndex: node.startIndex,
|
|
1075
|
+
endIndex: node.endIndex,
|
|
815
1076
|
};
|
|
816
1077
|
ctx.nodes.set(id, n);
|
|
817
|
-
n.
|
|
818
|
-
|
|
819
|
-
|
|
1078
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1079
|
+
{
|
|
1080
|
+
const _fc = node.childForFieldName("uri");
|
|
1081
|
+
n.uri = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1082
|
+
}
|
|
820
1083
|
return id;
|
|
821
1084
|
}
|
|
822
1085
|
function unmarshalerCurlyGroupValueNode(node, ctx, parentId) {
|
|
823
1086
|
const id = v4();
|
|
1087
|
+
const namedChildren = node.namedChildren;
|
|
824
1088
|
const n = {
|
|
825
1089
|
id,
|
|
826
1090
|
parentId,
|
|
827
1091
|
type: "curly_group_value",
|
|
828
|
-
text: node.text,
|
|
1092
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1093
|
+
startIndex: node.startIndex,
|
|
1094
|
+
endIndex: node.endIndex,
|
|
829
1095
|
};
|
|
830
1096
|
ctx.nodes.set(id, n);
|
|
831
|
-
n.
|
|
832
|
-
|
|
833
|
-
|
|
1097
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1098
|
+
{
|
|
1099
|
+
const _fc = node.childForFieldName("value");
|
|
1100
|
+
n.value = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1101
|
+
}
|
|
834
1102
|
return id;
|
|
835
1103
|
}
|
|
836
1104
|
function unmarshalerCurlyGroupWordNode(node, ctx, parentId) {
|
|
837
1105
|
const id = v4();
|
|
1106
|
+
const namedChildren = node.namedChildren;
|
|
838
1107
|
const n = {
|
|
839
1108
|
id,
|
|
840
1109
|
parentId,
|
|
841
1110
|
type: "curly_group_word",
|
|
842
|
-
text: node.text,
|
|
1111
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1112
|
+
startIndex: node.startIndex,
|
|
1113
|
+
endIndex: node.endIndex,
|
|
843
1114
|
};
|
|
844
1115
|
ctx.nodes.set(id, n);
|
|
845
|
-
n.
|
|
846
|
-
|
|
847
|
-
|
|
1116
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1117
|
+
{
|
|
1118
|
+
const _fc = node.childForFieldName("word");
|
|
1119
|
+
n.word = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1120
|
+
}
|
|
848
1121
|
return id;
|
|
849
1122
|
}
|
|
850
1123
|
function unmarshalerDisplayedEquationNode(node, ctx, parentId) {
|
|
851
1124
|
const id = v4();
|
|
1125
|
+
const namedChildren = node.namedChildren;
|
|
852
1126
|
const n = {
|
|
853
1127
|
id,
|
|
854
1128
|
parentId,
|
|
855
1129
|
type: "displayed_equation",
|
|
856
|
-
text: node.text,
|
|
1130
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1131
|
+
startIndex: node.startIndex,
|
|
1132
|
+
endIndex: node.endIndex,
|
|
857
1133
|
};
|
|
858
1134
|
ctx.nodes.set(id, n);
|
|
859
|
-
n.childrenIds =
|
|
1135
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
860
1136
|
return id;
|
|
861
1137
|
}
|
|
862
1138
|
function unmarshalerEndNode(node, ctx, parentId) {
|
|
863
1139
|
const id = v4();
|
|
1140
|
+
const namedChildren = node.namedChildren;
|
|
864
1141
|
const n = {
|
|
865
1142
|
id,
|
|
866
1143
|
parentId,
|
|
867
1144
|
type: "end",
|
|
868
|
-
text: node.text,
|
|
1145
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1146
|
+
startIndex: node.startIndex,
|
|
1147
|
+
endIndex: node.endIndex,
|
|
869
1148
|
};
|
|
870
1149
|
ctx.nodes.set(id, n);
|
|
871
|
-
n.
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1150
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1151
|
+
{
|
|
1152
|
+
const _fc = node.childForFieldName("command");
|
|
1153
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1154
|
+
}
|
|
1155
|
+
{
|
|
1156
|
+
const _fc = node.childForFieldName("name");
|
|
1157
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1158
|
+
}
|
|
875
1159
|
return id;
|
|
876
1160
|
}
|
|
877
1161
|
function unmarshalerEnumItemNode(node, ctx, parentId) {
|
|
878
1162
|
const id = v4();
|
|
1163
|
+
const namedChildren = node.namedChildren;
|
|
879
1164
|
const n = {
|
|
880
1165
|
id,
|
|
881
1166
|
parentId,
|
|
882
1167
|
type: "enum_item",
|
|
883
|
-
text: node.text,
|
|
1168
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1169
|
+
startIndex: node.startIndex,
|
|
1170
|
+
endIndex: node.endIndex,
|
|
884
1171
|
};
|
|
885
1172
|
ctx.nodes.set(id, n);
|
|
886
|
-
n.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1173
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1174
|
+
{
|
|
1175
|
+
const _fc = node.childForFieldName("command");
|
|
1176
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1177
|
+
}
|
|
1178
|
+
{
|
|
1179
|
+
const _fc = node.childForFieldName("label");
|
|
1180
|
+
n.label = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1181
|
+
}
|
|
891
1182
|
return id;
|
|
892
1183
|
}
|
|
893
1184
|
function unmarshalerEnvironmentDefinitionNode(node, ctx, parentId) {
|
|
894
1185
|
const id = v4();
|
|
1186
|
+
const namedChildren = node.namedChildren;
|
|
895
1187
|
const n = {
|
|
896
1188
|
id,
|
|
897
1189
|
parentId,
|
|
898
1190
|
type: "environment_definition",
|
|
899
|
-
text: node.text,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1191
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1192
|
+
startIndex: node.startIndex,
|
|
1193
|
+
endIndex: node.endIndex,
|
|
1194
|
+
};
|
|
1195
|
+
ctx.nodes.set(id, n);
|
|
1196
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1197
|
+
{
|
|
1198
|
+
const _fc = node.childForFieldName("argc");
|
|
1199
|
+
n.argc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1200
|
+
}
|
|
1201
|
+
{
|
|
1202
|
+
const _fc = node.childForFieldName("begin");
|
|
1203
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1204
|
+
}
|
|
1205
|
+
{
|
|
1206
|
+
const _fc = node.childForFieldName("command");
|
|
1207
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1208
|
+
}
|
|
1209
|
+
{
|
|
1210
|
+
const _fc = node.childForFieldName("end");
|
|
1211
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1212
|
+
}
|
|
1213
|
+
n.name = node
|
|
1214
|
+
.childrenForFieldName("name")
|
|
1215
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
1216
|
+
.filter((id) => id !== undefined);
|
|
1217
|
+
{
|
|
1218
|
+
const _fc = node.childForFieldName("spec");
|
|
1219
|
+
n.spec = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1220
|
+
}
|
|
921
1221
|
return id;
|
|
922
1222
|
}
|
|
923
1223
|
function unmarshalerGenericCommandNode(node, ctx, parentId) {
|
|
924
1224
|
const id = v4();
|
|
1225
|
+
const namedChildren = node.namedChildren;
|
|
925
1226
|
const n = {
|
|
926
1227
|
id,
|
|
927
1228
|
parentId,
|
|
928
1229
|
type: "generic_command",
|
|
929
|
-
text: node.text,
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
n.
|
|
1230
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1231
|
+
startIndex: node.startIndex,
|
|
1232
|
+
endIndex: node.endIndex,
|
|
1233
|
+
};
|
|
1234
|
+
ctx.nodes.set(id, n);
|
|
1235
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1236
|
+
n.arg = node
|
|
1237
|
+
.childrenForFieldName("arg")
|
|
1238
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
1239
|
+
.filter((id) => id !== undefined);
|
|
1240
|
+
{
|
|
1241
|
+
const _fc = node.childForFieldName("command");
|
|
1242
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1243
|
+
}
|
|
936
1244
|
return id;
|
|
937
1245
|
}
|
|
938
1246
|
function unmarshalerGenericEnvironmentNode(node, ctx, parentId) {
|
|
939
1247
|
const id = v4();
|
|
1248
|
+
const namedChildren = node.namedChildren;
|
|
940
1249
|
const n = {
|
|
941
1250
|
id,
|
|
942
1251
|
parentId,
|
|
943
1252
|
type: "generic_environment",
|
|
944
|
-
text: node.text,
|
|
1253
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1254
|
+
startIndex: node.startIndex,
|
|
1255
|
+
endIndex: node.endIndex,
|
|
945
1256
|
};
|
|
946
1257
|
ctx.nodes.set(id, n);
|
|
947
|
-
n.
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1258
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1259
|
+
{
|
|
1260
|
+
const _fc = node.childForFieldName("begin");
|
|
1261
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1262
|
+
}
|
|
1263
|
+
{
|
|
1264
|
+
const _fc = node.childForFieldName("end");
|
|
1265
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1266
|
+
}
|
|
951
1267
|
return id;
|
|
952
1268
|
}
|
|
953
1269
|
function unmarshalerGlobPatternNode(node, ctx, parentId) {
|
|
954
1270
|
const id = v4();
|
|
1271
|
+
const namedChildren = node.namedChildren;
|
|
955
1272
|
const n = {
|
|
956
1273
|
id,
|
|
957
1274
|
parentId,
|
|
958
1275
|
type: "glob_pattern",
|
|
959
|
-
text: node.text,
|
|
1276
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1277
|
+
startIndex: node.startIndex,
|
|
1278
|
+
endIndex: node.endIndex,
|
|
960
1279
|
};
|
|
961
1280
|
ctx.nodes.set(id, n);
|
|
962
|
-
n.childrenIds =
|
|
1281
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
963
1282
|
return id;
|
|
964
1283
|
}
|
|
965
1284
|
function unmarshalerGlossaryEntryDefinitionNode(node, ctx, parentId) {
|
|
966
1285
|
const id = v4();
|
|
1286
|
+
const namedChildren = node.namedChildren;
|
|
967
1287
|
const n = {
|
|
968
1288
|
id,
|
|
969
1289
|
parentId,
|
|
970
1290
|
type: "glossary_entry_definition",
|
|
971
|
-
text: node.text,
|
|
1291
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1292
|
+
startIndex: node.startIndex,
|
|
1293
|
+
endIndex: node.endIndex,
|
|
972
1294
|
};
|
|
973
1295
|
ctx.nodes.set(id, n);
|
|
974
|
-
n.
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
node.childForFieldName("
|
|
981
|
-
|
|
982
|
-
|
|
1296
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1297
|
+
{
|
|
1298
|
+
const _fc = node.childForFieldName("command");
|
|
1299
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1300
|
+
}
|
|
1301
|
+
{
|
|
1302
|
+
const _fc = node.childForFieldName("name");
|
|
1303
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1304
|
+
}
|
|
1305
|
+
{
|
|
1306
|
+
const _fc = node.childForFieldName("options");
|
|
1307
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1308
|
+
}
|
|
983
1309
|
return id;
|
|
984
1310
|
}
|
|
985
1311
|
function unmarshalerGlossaryEntryReferenceNode(node, ctx, parentId) {
|
|
986
1312
|
const id = v4();
|
|
1313
|
+
const namedChildren = node.namedChildren;
|
|
987
1314
|
const n = {
|
|
988
1315
|
id,
|
|
989
1316
|
parentId,
|
|
990
1317
|
type: "glossary_entry_reference",
|
|
991
|
-
text: node.text,
|
|
1318
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1319
|
+
startIndex: node.startIndex,
|
|
1320
|
+
endIndex: node.endIndex,
|
|
992
1321
|
};
|
|
993
1322
|
ctx.nodes.set(id, n);
|
|
994
|
-
n.
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
node.childForFieldName("name")
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1323
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1324
|
+
{
|
|
1325
|
+
const _fc = node.childForFieldName("command");
|
|
1326
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1327
|
+
}
|
|
1328
|
+
{
|
|
1329
|
+
const _fc = node.childForFieldName("name");
|
|
1330
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1331
|
+
}
|
|
1332
|
+
{
|
|
1333
|
+
const _fc = node.childForFieldName("options");
|
|
1334
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1335
|
+
}
|
|
1004
1336
|
return id;
|
|
1005
1337
|
}
|
|
1006
1338
|
function unmarshalerGraphicsIncludeNode(node, ctx, parentId) {
|
|
1007
1339
|
const id = v4();
|
|
1340
|
+
const namedChildren = node.namedChildren;
|
|
1008
1341
|
const n = {
|
|
1009
1342
|
id,
|
|
1010
1343
|
parentId,
|
|
1011
1344
|
type: "graphics_include",
|
|
1012
|
-
text: node.text,
|
|
1345
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1346
|
+
startIndex: node.startIndex,
|
|
1347
|
+
endIndex: node.endIndex,
|
|
1013
1348
|
};
|
|
1014
1349
|
ctx.nodes.set(id, n);
|
|
1015
|
-
n.
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1350
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1351
|
+
{
|
|
1352
|
+
const _fc = node.childForFieldName("command");
|
|
1353
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1354
|
+
}
|
|
1355
|
+
{
|
|
1356
|
+
const _fc = node.childForFieldName("options");
|
|
1357
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1358
|
+
}
|
|
1359
|
+
{
|
|
1360
|
+
const _fc = node.childForFieldName("path");
|
|
1361
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1362
|
+
}
|
|
1025
1363
|
return id;
|
|
1026
1364
|
}
|
|
1027
1365
|
function unmarshalerHyperlinkNode(node, ctx, parentId) {
|
|
1028
1366
|
const id = v4();
|
|
1367
|
+
const namedChildren = node.namedChildren;
|
|
1029
1368
|
const n = {
|
|
1030
1369
|
id,
|
|
1031
1370
|
parentId,
|
|
1032
1371
|
type: "hyperlink",
|
|
1033
|
-
text: node.text,
|
|
1372
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1373
|
+
startIndex: node.startIndex,
|
|
1374
|
+
endIndex: node.endIndex,
|
|
1034
1375
|
};
|
|
1035
1376
|
ctx.nodes.set(id, n);
|
|
1036
|
-
n.
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1377
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1378
|
+
{
|
|
1379
|
+
const _fc = node.childForFieldName("command");
|
|
1380
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1381
|
+
}
|
|
1382
|
+
{
|
|
1383
|
+
const _fc = node.childForFieldName("label");
|
|
1384
|
+
n.label = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1385
|
+
}
|
|
1386
|
+
{
|
|
1387
|
+
const _fc = node.childForFieldName("uri");
|
|
1388
|
+
n.uri = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1389
|
+
}
|
|
1046
1390
|
return id;
|
|
1047
1391
|
}
|
|
1048
1392
|
function unmarshalerImportIncludeNode(node, ctx, parentId) {
|
|
1049
1393
|
const id = v4();
|
|
1394
|
+
const namedChildren = node.namedChildren;
|
|
1050
1395
|
const n = {
|
|
1051
1396
|
id,
|
|
1052
1397
|
parentId,
|
|
1053
1398
|
type: "import_include",
|
|
1054
|
-
text: node.text,
|
|
1399
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1400
|
+
startIndex: node.startIndex,
|
|
1401
|
+
endIndex: node.endIndex,
|
|
1055
1402
|
};
|
|
1056
1403
|
ctx.nodes.set(id, n);
|
|
1057
|
-
n.
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
node.childForFieldName("
|
|
1064
|
-
|
|
1065
|
-
|
|
1404
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1405
|
+
{
|
|
1406
|
+
const _fc = node.childForFieldName("command");
|
|
1407
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1408
|
+
}
|
|
1409
|
+
{
|
|
1410
|
+
const _fc = node.childForFieldName("directory");
|
|
1411
|
+
n.directory = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1412
|
+
}
|
|
1413
|
+
{
|
|
1414
|
+
const _fc = node.childForFieldName("file");
|
|
1415
|
+
n.file = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1416
|
+
}
|
|
1066
1417
|
return id;
|
|
1067
1418
|
}
|
|
1068
1419
|
function unmarshalerInkscapeIncludeNode(node, ctx, parentId) {
|
|
1069
1420
|
const id = v4();
|
|
1421
|
+
const namedChildren = node.namedChildren;
|
|
1070
1422
|
const n = {
|
|
1071
1423
|
id,
|
|
1072
1424
|
parentId,
|
|
1073
1425
|
type: "inkscape_include",
|
|
1074
|
-
text: node.text,
|
|
1426
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1427
|
+
startIndex: node.startIndex,
|
|
1428
|
+
endIndex: node.endIndex,
|
|
1075
1429
|
};
|
|
1076
1430
|
ctx.nodes.set(id, n);
|
|
1077
|
-
n.
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1431
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1432
|
+
{
|
|
1433
|
+
const _fc = node.childForFieldName("command");
|
|
1434
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1435
|
+
}
|
|
1436
|
+
{
|
|
1437
|
+
const _fc = node.childForFieldName("options");
|
|
1438
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1439
|
+
}
|
|
1440
|
+
{
|
|
1441
|
+
const _fc = node.childForFieldName("path");
|
|
1442
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1443
|
+
}
|
|
1087
1444
|
return id;
|
|
1088
1445
|
}
|
|
1089
1446
|
function unmarshalerInlineFormulaNode(node, ctx, parentId) {
|
|
1090
1447
|
const id = v4();
|
|
1448
|
+
const namedChildren = node.namedChildren;
|
|
1091
1449
|
const n = {
|
|
1092
1450
|
id,
|
|
1093
1451
|
parentId,
|
|
1094
1452
|
type: "inline_formula",
|
|
1095
|
-
text: node.text,
|
|
1453
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1454
|
+
startIndex: node.startIndex,
|
|
1455
|
+
endIndex: node.endIndex,
|
|
1096
1456
|
};
|
|
1097
1457
|
ctx.nodes.set(id, n);
|
|
1098
|
-
n.childrenIds =
|
|
1458
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1099
1459
|
return id;
|
|
1100
1460
|
}
|
|
1101
1461
|
function unmarshalerKeyValuePairNode(node, ctx, parentId) {
|
|
1102
1462
|
const id = v4();
|
|
1463
|
+
const namedChildren = node.namedChildren;
|
|
1103
1464
|
const n = {
|
|
1104
1465
|
id,
|
|
1105
1466
|
parentId,
|
|
1106
1467
|
type: "key_value_pair",
|
|
1107
|
-
text: node.text,
|
|
1468
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1469
|
+
startIndex: node.startIndex,
|
|
1470
|
+
endIndex: node.endIndex,
|
|
1108
1471
|
};
|
|
1109
1472
|
ctx.nodes.set(id, n);
|
|
1110
|
-
n.
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1473
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1474
|
+
{
|
|
1475
|
+
const _fc = node.childForFieldName("key");
|
|
1476
|
+
n.key = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1477
|
+
}
|
|
1478
|
+
{
|
|
1479
|
+
const _fc = node.childForFieldName("value");
|
|
1480
|
+
n.value = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1481
|
+
}
|
|
1115
1482
|
return id;
|
|
1116
1483
|
}
|
|
1117
1484
|
function unmarshalerLabelDefinitionNode(node, ctx, parentId) {
|
|
1118
1485
|
const id = v4();
|
|
1486
|
+
const namedChildren = node.namedChildren;
|
|
1119
1487
|
const n = {
|
|
1120
1488
|
id,
|
|
1121
1489
|
parentId,
|
|
1122
1490
|
type: "label_definition",
|
|
1123
|
-
text: node.text,
|
|
1491
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1492
|
+
startIndex: node.startIndex,
|
|
1493
|
+
endIndex: node.endIndex,
|
|
1124
1494
|
};
|
|
1125
1495
|
ctx.nodes.set(id, n);
|
|
1126
|
-
n.
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1496
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1497
|
+
{
|
|
1498
|
+
const _fc = node.childForFieldName("command");
|
|
1499
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1500
|
+
}
|
|
1501
|
+
{
|
|
1502
|
+
const _fc = node.childForFieldName("name");
|
|
1503
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1504
|
+
}
|
|
1130
1505
|
return id;
|
|
1131
1506
|
}
|
|
1132
1507
|
function unmarshalerLabelNumberNode(node, ctx, parentId) {
|
|
1133
1508
|
const id = v4();
|
|
1509
|
+
const namedChildren = node.namedChildren;
|
|
1134
1510
|
const n = {
|
|
1135
1511
|
id,
|
|
1136
1512
|
parentId,
|
|
1137
1513
|
type: "label_number",
|
|
1138
|
-
text: node.text,
|
|
1514
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1515
|
+
startIndex: node.startIndex,
|
|
1516
|
+
endIndex: node.endIndex,
|
|
1139
1517
|
};
|
|
1140
1518
|
ctx.nodes.set(id, n);
|
|
1141
|
-
n.
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
node.childForFieldName("
|
|
1148
|
-
|
|
1149
|
-
|
|
1519
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1520
|
+
{
|
|
1521
|
+
const _fc = node.childForFieldName("command");
|
|
1522
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1523
|
+
}
|
|
1524
|
+
{
|
|
1525
|
+
const _fc = node.childForFieldName("name");
|
|
1526
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1527
|
+
}
|
|
1528
|
+
{
|
|
1529
|
+
const _fc = node.childForFieldName("number");
|
|
1530
|
+
n.number = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1531
|
+
}
|
|
1150
1532
|
return id;
|
|
1151
1533
|
}
|
|
1152
1534
|
function unmarshalerLabelReferenceNode(node, ctx, parentId) {
|
|
1153
1535
|
const id = v4();
|
|
1536
|
+
const namedChildren = node.namedChildren;
|
|
1154
1537
|
const n = {
|
|
1155
1538
|
id,
|
|
1156
1539
|
parentId,
|
|
1157
1540
|
type: "label_reference",
|
|
1158
|
-
text: node.text,
|
|
1541
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1542
|
+
startIndex: node.startIndex,
|
|
1543
|
+
endIndex: node.endIndex,
|
|
1159
1544
|
};
|
|
1160
1545
|
ctx.nodes.set(id, n);
|
|
1161
|
-
n.
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1546
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1547
|
+
{
|
|
1548
|
+
const _fc = node.childForFieldName("command");
|
|
1549
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1550
|
+
}
|
|
1551
|
+
{
|
|
1552
|
+
const _fc = node.childForFieldName("names");
|
|
1553
|
+
n.names = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1554
|
+
}
|
|
1165
1555
|
return id;
|
|
1166
1556
|
}
|
|
1167
1557
|
function unmarshalerLabelReferenceRangeNode(node, ctx, parentId) {
|
|
1168
1558
|
const id = v4();
|
|
1559
|
+
const namedChildren = node.namedChildren;
|
|
1169
1560
|
const n = {
|
|
1170
1561
|
id,
|
|
1171
1562
|
parentId,
|
|
1172
1563
|
type: "label_reference_range",
|
|
1173
|
-
text: node.text,
|
|
1564
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1565
|
+
startIndex: node.startIndex,
|
|
1566
|
+
endIndex: node.endIndex,
|
|
1174
1567
|
};
|
|
1175
1568
|
ctx.nodes.set(id, n);
|
|
1176
|
-
n.
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
node.childForFieldName("
|
|
1183
|
-
|
|
1184
|
-
|
|
1569
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1570
|
+
{
|
|
1571
|
+
const _fc = node.childForFieldName("command");
|
|
1572
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1573
|
+
}
|
|
1574
|
+
{
|
|
1575
|
+
const _fc = node.childForFieldName("from");
|
|
1576
|
+
n.from = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1577
|
+
}
|
|
1578
|
+
{
|
|
1579
|
+
const _fc = node.childForFieldName("to");
|
|
1580
|
+
n.to = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1581
|
+
}
|
|
1185
1582
|
return id;
|
|
1186
1583
|
}
|
|
1187
1584
|
function unmarshalerLatexIncludeNode(node, ctx, parentId) {
|
|
1188
1585
|
const id = v4();
|
|
1586
|
+
const namedChildren = node.namedChildren;
|
|
1189
1587
|
const n = {
|
|
1190
1588
|
id,
|
|
1191
1589
|
parentId,
|
|
1192
1590
|
type: "latex_include",
|
|
1193
|
-
text: node.text,
|
|
1591
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1592
|
+
startIndex: node.startIndex,
|
|
1593
|
+
endIndex: node.endIndex,
|
|
1194
1594
|
};
|
|
1195
1595
|
ctx.nodes.set(id, n);
|
|
1196
|
-
n.
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1596
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1597
|
+
{
|
|
1598
|
+
const _fc = node.childForFieldName("command");
|
|
1599
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1600
|
+
}
|
|
1601
|
+
{
|
|
1602
|
+
const _fc = node.childForFieldName("path");
|
|
1603
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1604
|
+
}
|
|
1200
1605
|
return id;
|
|
1201
1606
|
}
|
|
1202
1607
|
function unmarshalerLetCommandDefinitionNode(node, ctx, parentId) {
|
|
1203
1608
|
const id = v4();
|
|
1609
|
+
const namedChildren = node.namedChildren;
|
|
1204
1610
|
const n = {
|
|
1205
1611
|
id,
|
|
1206
1612
|
parentId,
|
|
1207
1613
|
type: "let_command_definition",
|
|
1208
|
-
text: node.text,
|
|
1614
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1615
|
+
startIndex: node.startIndex,
|
|
1616
|
+
endIndex: node.endIndex,
|
|
1209
1617
|
};
|
|
1210
1618
|
ctx.nodes.set(id, n);
|
|
1211
|
-
n.
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
node.childForFieldName("
|
|
1218
|
-
|
|
1219
|
-
|
|
1619
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1620
|
+
{
|
|
1621
|
+
const _fc = node.childForFieldName("command");
|
|
1622
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1623
|
+
}
|
|
1624
|
+
{
|
|
1625
|
+
const _fc = node.childForFieldName("declaration");
|
|
1626
|
+
n.declaration = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1627
|
+
}
|
|
1628
|
+
{
|
|
1629
|
+
const _fc = node.childForFieldName("implementation");
|
|
1630
|
+
n.implementation = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1631
|
+
}
|
|
1220
1632
|
return id;
|
|
1221
1633
|
}
|
|
1222
1634
|
function unmarshalerListingEnvironmentNode(node, ctx, parentId) {
|
|
1223
1635
|
const id = v4();
|
|
1636
|
+
const namedChildren = node.namedChildren;
|
|
1224
1637
|
const n = {
|
|
1225
1638
|
id,
|
|
1226
1639
|
parentId,
|
|
1227
1640
|
type: "listing_environment",
|
|
1228
|
-
text: node.text,
|
|
1641
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1642
|
+
startIndex: node.startIndex,
|
|
1643
|
+
endIndex: node.endIndex,
|
|
1229
1644
|
};
|
|
1230
1645
|
ctx.nodes.set(id, n);
|
|
1231
|
-
n.
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
node.childForFieldName("
|
|
1238
|
-
|
|
1239
|
-
|
|
1646
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1647
|
+
{
|
|
1648
|
+
const _fc = node.childForFieldName("begin");
|
|
1649
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1650
|
+
}
|
|
1651
|
+
{
|
|
1652
|
+
const _fc = node.childForFieldName("code");
|
|
1653
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1654
|
+
}
|
|
1655
|
+
{
|
|
1656
|
+
const _fc = node.childForFieldName("end");
|
|
1657
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1658
|
+
}
|
|
1240
1659
|
return id;
|
|
1241
1660
|
}
|
|
1242
1661
|
function unmarshalerLuacodeEnvironmentNode(node, ctx, parentId) {
|
|
1243
1662
|
const id = v4();
|
|
1663
|
+
const namedChildren = node.namedChildren;
|
|
1244
1664
|
const n = {
|
|
1245
1665
|
id,
|
|
1246
1666
|
parentId,
|
|
1247
1667
|
type: "luacode_environment",
|
|
1248
|
-
text: node.text,
|
|
1668
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1669
|
+
startIndex: node.startIndex,
|
|
1670
|
+
endIndex: node.endIndex,
|
|
1249
1671
|
};
|
|
1250
1672
|
ctx.nodes.set(id, n);
|
|
1251
|
-
n.
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
node.childForFieldName("
|
|
1258
|
-
|
|
1259
|
-
|
|
1673
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1674
|
+
{
|
|
1675
|
+
const _fc = node.childForFieldName("begin");
|
|
1676
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1677
|
+
}
|
|
1678
|
+
{
|
|
1679
|
+
const _fc = node.childForFieldName("code");
|
|
1680
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1681
|
+
}
|
|
1682
|
+
{
|
|
1683
|
+
const _fc = node.childForFieldName("end");
|
|
1684
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1685
|
+
}
|
|
1260
1686
|
return id;
|
|
1261
1687
|
}
|
|
1262
1688
|
function unmarshalerMathDelimiterNode(node, ctx, parentId) {
|
|
1263
1689
|
const id = v4();
|
|
1690
|
+
const namedChildren = node.namedChildren;
|
|
1264
1691
|
const n = {
|
|
1265
1692
|
id,
|
|
1266
1693
|
parentId,
|
|
1267
1694
|
type: "math_delimiter",
|
|
1268
|
-
text: node.text,
|
|
1695
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1696
|
+
startIndex: node.startIndex,
|
|
1697
|
+
endIndex: node.endIndex,
|
|
1269
1698
|
};
|
|
1270
1699
|
ctx.nodes.set(id, n);
|
|
1271
|
-
n.
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
node.childForFieldName("left_delimiter")
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1700
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1701
|
+
{
|
|
1702
|
+
const _fc = node.childForFieldName("left_command");
|
|
1703
|
+
n.left_command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1704
|
+
}
|
|
1705
|
+
{
|
|
1706
|
+
const _fc = node.childForFieldName("left_delimiter");
|
|
1707
|
+
n.left_delimiter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1708
|
+
}
|
|
1709
|
+
{
|
|
1710
|
+
const _fc = node.childForFieldName("right_command");
|
|
1711
|
+
n.right_command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1712
|
+
}
|
|
1713
|
+
{
|
|
1714
|
+
const _fc = node.childForFieldName("right_delimiter");
|
|
1715
|
+
n.right_delimiter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1716
|
+
}
|
|
1282
1717
|
return id;
|
|
1283
1718
|
}
|
|
1284
1719
|
function unmarshalerMathEnvironmentNode(node, ctx, parentId) {
|
|
1285
1720
|
const id = v4();
|
|
1721
|
+
const namedChildren = node.namedChildren;
|
|
1286
1722
|
const n = {
|
|
1287
1723
|
id,
|
|
1288
1724
|
parentId,
|
|
1289
1725
|
type: "math_environment",
|
|
1290
|
-
text: node.text,
|
|
1726
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1727
|
+
startIndex: node.startIndex,
|
|
1728
|
+
endIndex: node.endIndex,
|
|
1291
1729
|
};
|
|
1292
1730
|
ctx.nodes.set(id, n);
|
|
1293
|
-
n.
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1731
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1732
|
+
{
|
|
1733
|
+
const _fc = node.childForFieldName("begin");
|
|
1734
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1735
|
+
}
|
|
1736
|
+
{
|
|
1737
|
+
const _fc = node.childForFieldName("end");
|
|
1738
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1739
|
+
}
|
|
1297
1740
|
return id;
|
|
1298
1741
|
}
|
|
1299
1742
|
function unmarshalerMintedEnvironmentNode(node, ctx, parentId) {
|
|
1300
1743
|
const id = v4();
|
|
1744
|
+
const namedChildren = node.namedChildren;
|
|
1301
1745
|
const n = {
|
|
1302
1746
|
id,
|
|
1303
1747
|
parentId,
|
|
1304
1748
|
type: "minted_environment",
|
|
1305
|
-
text: node.text,
|
|
1749
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1750
|
+
startIndex: node.startIndex,
|
|
1751
|
+
endIndex: node.endIndex,
|
|
1306
1752
|
};
|
|
1307
1753
|
ctx.nodes.set(id, n);
|
|
1308
|
-
n.
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
node.childForFieldName("
|
|
1315
|
-
|
|
1316
|
-
|
|
1754
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1755
|
+
{
|
|
1756
|
+
const _fc = node.childForFieldName("begin");
|
|
1757
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1758
|
+
}
|
|
1759
|
+
{
|
|
1760
|
+
const _fc = node.childForFieldName("code");
|
|
1761
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1762
|
+
}
|
|
1763
|
+
{
|
|
1764
|
+
const _fc = node.childForFieldName("end");
|
|
1765
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1766
|
+
}
|
|
1317
1767
|
return id;
|
|
1318
1768
|
}
|
|
1319
1769
|
function unmarshalerNewCommandDefinitionNode(node, ctx, parentId) {
|
|
1320
1770
|
const id = v4();
|
|
1771
|
+
const namedChildren = node.namedChildren;
|
|
1321
1772
|
const n = {
|
|
1322
1773
|
id,
|
|
1323
1774
|
parentId,
|
|
1324
1775
|
type: "new_command_definition",
|
|
1325
|
-
text: node.text,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
n.
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
node.childForFieldName("declaration")
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1776
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1777
|
+
startIndex: node.startIndex,
|
|
1778
|
+
endIndex: node.endIndex,
|
|
1779
|
+
};
|
|
1780
|
+
ctx.nodes.set(id, n);
|
|
1781
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1782
|
+
{
|
|
1783
|
+
const _fc = node.childForFieldName("argc");
|
|
1784
|
+
n.argc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1785
|
+
}
|
|
1786
|
+
{
|
|
1787
|
+
const _fc = node.childForFieldName("command");
|
|
1788
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1789
|
+
}
|
|
1790
|
+
{
|
|
1791
|
+
const _fc = node.childForFieldName("declaration");
|
|
1792
|
+
n.declaration = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1793
|
+
}
|
|
1794
|
+
{
|
|
1795
|
+
const _fc = node.childForFieldName("default");
|
|
1796
|
+
n.default = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1797
|
+
}
|
|
1798
|
+
{
|
|
1799
|
+
const _fc = node.childForFieldName("implementation");
|
|
1800
|
+
n.implementation = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1801
|
+
}
|
|
1802
|
+
{
|
|
1803
|
+
const _fc = node.childForFieldName("spec");
|
|
1804
|
+
n.spec = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1805
|
+
}
|
|
1346
1806
|
return id;
|
|
1347
1807
|
}
|
|
1348
1808
|
function unmarshalerOldCommandDefinitionNode(node, ctx, parentId) {
|
|
1349
1809
|
const id = v4();
|
|
1810
|
+
const namedChildren = node.namedChildren;
|
|
1350
1811
|
const n = {
|
|
1351
1812
|
id,
|
|
1352
1813
|
parentId,
|
|
1353
1814
|
type: "old_command_definition",
|
|
1354
|
-
text: node.text,
|
|
1815
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1816
|
+
startIndex: node.startIndex,
|
|
1817
|
+
endIndex: node.endIndex,
|
|
1355
1818
|
};
|
|
1356
1819
|
ctx.nodes.set(id, n);
|
|
1357
|
-
n.
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1820
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1821
|
+
{
|
|
1822
|
+
const _fc = node.childForFieldName("command");
|
|
1823
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1824
|
+
}
|
|
1825
|
+
{
|
|
1826
|
+
const _fc = node.childForFieldName("declaration");
|
|
1827
|
+
n.declaration = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1828
|
+
}
|
|
1361
1829
|
return id;
|
|
1362
1830
|
}
|
|
1363
1831
|
function unmarshalerOperatorNode(node, ctx, parentId) {
|
|
1364
1832
|
const id = v4();
|
|
1833
|
+
const namedChildren = node.namedChildren;
|
|
1365
1834
|
const n = {
|
|
1366
1835
|
id,
|
|
1367
1836
|
parentId,
|
|
1368
1837
|
type: "operator",
|
|
1369
|
-
text: node.text,
|
|
1838
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1839
|
+
startIndex: node.startIndex,
|
|
1840
|
+
endIndex: node.endIndex,
|
|
1370
1841
|
};
|
|
1371
1842
|
ctx.nodes.set(id, n);
|
|
1372
|
-
n.childrenIds =
|
|
1843
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1373
1844
|
return id;
|
|
1374
1845
|
}
|
|
1375
1846
|
function unmarshalerPackageIncludeNode(node, ctx, parentId) {
|
|
1376
1847
|
const id = v4();
|
|
1848
|
+
const namedChildren = node.namedChildren;
|
|
1377
1849
|
const n = {
|
|
1378
1850
|
id,
|
|
1379
1851
|
parentId,
|
|
1380
1852
|
type: "package_include",
|
|
1381
|
-
text: node.text,
|
|
1853
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1854
|
+
startIndex: node.startIndex,
|
|
1855
|
+
endIndex: node.endIndex,
|
|
1382
1856
|
};
|
|
1383
1857
|
ctx.nodes.set(id, n);
|
|
1384
|
-
n.
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1858
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1859
|
+
{
|
|
1860
|
+
const _fc = node.childForFieldName("command");
|
|
1861
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1862
|
+
}
|
|
1863
|
+
{
|
|
1864
|
+
const _fc = node.childForFieldName("options");
|
|
1865
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1866
|
+
}
|
|
1867
|
+
{
|
|
1868
|
+
const _fc = node.childForFieldName("paths");
|
|
1869
|
+
n.paths = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1870
|
+
}
|
|
1394
1871
|
return id;
|
|
1395
1872
|
}
|
|
1396
1873
|
function unmarshalerPairedDelimiterDefinitionNode(node, ctx, parentId) {
|
|
1397
1874
|
const id = v4();
|
|
1875
|
+
const namedChildren = node.namedChildren;
|
|
1398
1876
|
const n = {
|
|
1399
1877
|
id,
|
|
1400
1878
|
parentId,
|
|
1401
1879
|
type: "paired_delimiter_definition",
|
|
1402
|
-
text: node.text,
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
node.childForFieldName("
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1880
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1881
|
+
startIndex: node.startIndex,
|
|
1882
|
+
endIndex: node.endIndex,
|
|
1883
|
+
};
|
|
1884
|
+
ctx.nodes.set(id, n);
|
|
1885
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1886
|
+
{
|
|
1887
|
+
const _fc = node.childForFieldName("argc");
|
|
1888
|
+
n.argc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1889
|
+
}
|
|
1890
|
+
{
|
|
1891
|
+
const _fc = node.childForFieldName("body");
|
|
1892
|
+
n.body = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1893
|
+
}
|
|
1894
|
+
{
|
|
1895
|
+
const _fc = node.childForFieldName("command");
|
|
1896
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1897
|
+
}
|
|
1898
|
+
{
|
|
1899
|
+
const _fc = node.childForFieldName("declaration");
|
|
1900
|
+
n.declaration = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1901
|
+
}
|
|
1902
|
+
{
|
|
1903
|
+
const _fc = node.childForFieldName("left");
|
|
1904
|
+
n.left = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1905
|
+
}
|
|
1906
|
+
{
|
|
1907
|
+
const _fc = node.childForFieldName("right");
|
|
1908
|
+
n.right = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1909
|
+
}
|
|
1422
1910
|
return id;
|
|
1423
1911
|
}
|
|
1424
1912
|
function unmarshalerParagraphNode(node, ctx, parentId) {
|
|
1425
1913
|
const id = v4();
|
|
1914
|
+
const namedChildren = node.namedChildren;
|
|
1426
1915
|
const n = {
|
|
1427
1916
|
id,
|
|
1428
1917
|
parentId,
|
|
1429
1918
|
type: "paragraph",
|
|
1430
|
-
text: node.text,
|
|
1919
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1920
|
+
startIndex: node.startIndex,
|
|
1921
|
+
endIndex: node.endIndex,
|
|
1431
1922
|
};
|
|
1432
1923
|
ctx.nodes.set(id, n);
|
|
1433
|
-
n.
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
node.childForFieldName("
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
].filter((id) => id !== undefined));
|
|
1443
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
1924
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1925
|
+
{
|
|
1926
|
+
const _fc = node.childForFieldName("command");
|
|
1927
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1928
|
+
}
|
|
1929
|
+
{
|
|
1930
|
+
const _fc = node.childForFieldName("toc");
|
|
1931
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1932
|
+
}
|
|
1444
1933
|
return id;
|
|
1445
1934
|
}
|
|
1446
1935
|
function unmarshalerPartNode(node, ctx, parentId) {
|
|
1447
1936
|
const id = v4();
|
|
1937
|
+
const namedChildren = node.namedChildren;
|
|
1448
1938
|
const n = {
|
|
1449
1939
|
id,
|
|
1450
1940
|
parentId,
|
|
1451
1941
|
type: "part",
|
|
1452
|
-
text: node.text,
|
|
1942
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1943
|
+
startIndex: node.startIndex,
|
|
1944
|
+
endIndex: node.endIndex,
|
|
1453
1945
|
};
|
|
1454
1946
|
ctx.nodes.set(id, n);
|
|
1455
|
-
n.
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
node.childForFieldName("
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
].filter((id) => id !== undefined));
|
|
1465
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
1947
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1948
|
+
{
|
|
1949
|
+
const _fc = node.childForFieldName("command");
|
|
1950
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1951
|
+
}
|
|
1952
|
+
{
|
|
1953
|
+
const _fc = node.childForFieldName("toc");
|
|
1954
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1955
|
+
}
|
|
1466
1956
|
return id;
|
|
1467
1957
|
}
|
|
1468
1958
|
function unmarshalerPycodeEnvironmentNode(node, ctx, parentId) {
|
|
1469
1959
|
const id = v4();
|
|
1960
|
+
const namedChildren = node.namedChildren;
|
|
1470
1961
|
const n = {
|
|
1471
1962
|
id,
|
|
1472
1963
|
parentId,
|
|
1473
1964
|
type: "pycode_environment",
|
|
1474
|
-
text: node.text,
|
|
1965
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1966
|
+
startIndex: node.startIndex,
|
|
1967
|
+
endIndex: node.endIndex,
|
|
1475
1968
|
};
|
|
1476
1969
|
ctx.nodes.set(id, n);
|
|
1477
|
-
n.
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
node.childForFieldName("
|
|
1484
|
-
|
|
1485
|
-
|
|
1970
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1971
|
+
{
|
|
1972
|
+
const _fc = node.childForFieldName("begin");
|
|
1973
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1974
|
+
}
|
|
1975
|
+
{
|
|
1976
|
+
const _fc = node.childForFieldName("code");
|
|
1977
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1978
|
+
}
|
|
1979
|
+
{
|
|
1980
|
+
const _fc = node.childForFieldName("end");
|
|
1981
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
1982
|
+
}
|
|
1486
1983
|
return id;
|
|
1487
1984
|
}
|
|
1488
1985
|
function unmarshalerSageblockEnvironmentNode(node, ctx, parentId) {
|
|
1489
1986
|
const id = v4();
|
|
1987
|
+
const namedChildren = node.namedChildren;
|
|
1490
1988
|
const n = {
|
|
1491
1989
|
id,
|
|
1492
1990
|
parentId,
|
|
1493
1991
|
type: "sageblock_environment",
|
|
1494
|
-
text: node.text,
|
|
1992
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
1993
|
+
startIndex: node.startIndex,
|
|
1994
|
+
endIndex: node.endIndex,
|
|
1495
1995
|
};
|
|
1496
1996
|
ctx.nodes.set(id, n);
|
|
1497
|
-
n.
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
node.childForFieldName("
|
|
1504
|
-
|
|
1505
|
-
|
|
1997
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1998
|
+
{
|
|
1999
|
+
const _fc = node.childForFieldName("begin");
|
|
2000
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2001
|
+
}
|
|
2002
|
+
{
|
|
2003
|
+
const _fc = node.childForFieldName("code");
|
|
2004
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2005
|
+
}
|
|
2006
|
+
{
|
|
2007
|
+
const _fc = node.childForFieldName("end");
|
|
2008
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2009
|
+
}
|
|
1506
2010
|
return id;
|
|
1507
2011
|
}
|
|
1508
2012
|
function unmarshalerSagesilentEnvironmentNode(node, ctx, parentId) {
|
|
1509
2013
|
const id = v4();
|
|
2014
|
+
const namedChildren = node.namedChildren;
|
|
1510
2015
|
const n = {
|
|
1511
2016
|
id,
|
|
1512
2017
|
parentId,
|
|
1513
2018
|
type: "sagesilent_environment",
|
|
1514
|
-
text: node.text,
|
|
2019
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2020
|
+
startIndex: node.startIndex,
|
|
2021
|
+
endIndex: node.endIndex,
|
|
1515
2022
|
};
|
|
1516
2023
|
ctx.nodes.set(id, n);
|
|
1517
|
-
n.
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
node.childForFieldName("
|
|
1524
|
-
|
|
1525
|
-
|
|
2024
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2025
|
+
{
|
|
2026
|
+
const _fc = node.childForFieldName("begin");
|
|
2027
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2028
|
+
}
|
|
2029
|
+
{
|
|
2030
|
+
const _fc = node.childForFieldName("code");
|
|
2031
|
+
n.code = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2032
|
+
}
|
|
2033
|
+
{
|
|
2034
|
+
const _fc = node.childForFieldName("end");
|
|
2035
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2036
|
+
}
|
|
1526
2037
|
return id;
|
|
1527
2038
|
}
|
|
1528
2039
|
function unmarshalerSectionNode(node, ctx, parentId) {
|
|
1529
2040
|
const id = v4();
|
|
2041
|
+
const namedChildren = node.namedChildren;
|
|
1530
2042
|
const n = {
|
|
1531
2043
|
id,
|
|
1532
2044
|
parentId,
|
|
1533
2045
|
type: "section",
|
|
1534
|
-
text: node.text,
|
|
2046
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2047
|
+
startIndex: node.startIndex,
|
|
2048
|
+
endIndex: node.endIndex,
|
|
1535
2049
|
};
|
|
1536
2050
|
ctx.nodes.set(id, n);
|
|
1537
|
-
n.
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
node.childForFieldName("
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
].filter((id) => id !== undefined));
|
|
1547
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
2051
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2052
|
+
{
|
|
2053
|
+
const _fc = node.childForFieldName("command");
|
|
2054
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2055
|
+
}
|
|
2056
|
+
{
|
|
2057
|
+
const _fc = node.childForFieldName("toc");
|
|
2058
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2059
|
+
}
|
|
1548
2060
|
return id;
|
|
1549
2061
|
}
|
|
1550
2062
|
function unmarshalerSourceFileNode(node, ctx, parentId) {
|
|
1551
2063
|
const id = v4();
|
|
2064
|
+
const namedChildren = node.namedChildren;
|
|
1552
2065
|
const n = {
|
|
1553
2066
|
id,
|
|
1554
2067
|
parentId,
|
|
1555
2068
|
type: "source_file",
|
|
1556
|
-
text: node.text,
|
|
2069
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2070
|
+
startIndex: node.startIndex,
|
|
2071
|
+
endIndex: node.endIndex,
|
|
1557
2072
|
};
|
|
1558
2073
|
ctx.nodes.set(id, n);
|
|
1559
|
-
n.childrenIds =
|
|
2074
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1560
2075
|
return id;
|
|
1561
2076
|
}
|
|
1562
2077
|
function unmarshalerSubparagraphNode(node, ctx, parentId) {
|
|
1563
2078
|
const id = v4();
|
|
2079
|
+
const namedChildren = node.namedChildren;
|
|
1564
2080
|
const n = {
|
|
1565
2081
|
id,
|
|
1566
2082
|
parentId,
|
|
1567
2083
|
type: "subparagraph",
|
|
1568
|
-
text: node.text,
|
|
2084
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2085
|
+
startIndex: node.startIndex,
|
|
2086
|
+
endIndex: node.endIndex,
|
|
1569
2087
|
};
|
|
1570
2088
|
ctx.nodes.set(id, n);
|
|
1571
|
-
n.
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
node.childForFieldName("
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
].filter((id) => id !== undefined));
|
|
1581
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
2089
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2090
|
+
{
|
|
2091
|
+
const _fc = node.childForFieldName("command");
|
|
2092
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2093
|
+
}
|
|
2094
|
+
{
|
|
2095
|
+
const _fc = node.childForFieldName("toc");
|
|
2096
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2097
|
+
}
|
|
1582
2098
|
return id;
|
|
1583
2099
|
}
|
|
1584
2100
|
function unmarshalerSubscriptNode(node, ctx, parentId) {
|
|
1585
2101
|
const id = v4();
|
|
2102
|
+
const namedChildren = node.namedChildren;
|
|
1586
2103
|
const n = {
|
|
1587
2104
|
id,
|
|
1588
2105
|
parentId,
|
|
1589
2106
|
type: "subscript",
|
|
1590
|
-
text: node.text,
|
|
2107
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2108
|
+
startIndex: node.startIndex,
|
|
2109
|
+
endIndex: node.endIndex,
|
|
1591
2110
|
};
|
|
1592
2111
|
ctx.nodes.set(id, n);
|
|
1593
|
-
n.
|
|
1594
|
-
|
|
1595
|
-
|
|
2112
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2113
|
+
{
|
|
2114
|
+
const _fc = node.childForFieldName("subscript");
|
|
2115
|
+
n.subscript = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2116
|
+
}
|
|
1596
2117
|
return id;
|
|
1597
2118
|
}
|
|
1598
2119
|
function unmarshalerSubsectionNode(node, ctx, parentId) {
|
|
1599
2120
|
const id = v4();
|
|
2121
|
+
const namedChildren = node.namedChildren;
|
|
1600
2122
|
const n = {
|
|
1601
2123
|
id,
|
|
1602
2124
|
parentId,
|
|
1603
2125
|
type: "subsection",
|
|
1604
|
-
text: node.text,
|
|
2126
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2127
|
+
startIndex: node.startIndex,
|
|
2128
|
+
endIndex: node.endIndex,
|
|
1605
2129
|
};
|
|
1606
2130
|
ctx.nodes.set(id, n);
|
|
1607
|
-
n.
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
node.childForFieldName("
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
].filter((id) => id !== undefined));
|
|
1617
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
2131
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2132
|
+
{
|
|
2133
|
+
const _fc = node.childForFieldName("command");
|
|
2134
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2135
|
+
}
|
|
2136
|
+
{
|
|
2137
|
+
const _fc = node.childForFieldName("toc");
|
|
2138
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2139
|
+
}
|
|
1618
2140
|
return id;
|
|
1619
2141
|
}
|
|
1620
2142
|
function unmarshalerSubsubsectionNode(node, ctx, parentId) {
|
|
1621
2143
|
const id = v4();
|
|
2144
|
+
const namedChildren = node.namedChildren;
|
|
1622
2145
|
const n = {
|
|
1623
2146
|
id,
|
|
1624
2147
|
parentId,
|
|
1625
2148
|
type: "subsubsection",
|
|
1626
|
-
text: node.text,
|
|
2149
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2150
|
+
startIndex: node.startIndex,
|
|
2151
|
+
endIndex: node.endIndex,
|
|
1627
2152
|
};
|
|
1628
2153
|
ctx.nodes.set(id, n);
|
|
1629
|
-
n.
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
node.childForFieldName("
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
].filter((id) => id !== undefined));
|
|
1639
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
2154
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2155
|
+
{
|
|
2156
|
+
const _fc = node.childForFieldName("command");
|
|
2157
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2158
|
+
}
|
|
2159
|
+
{
|
|
2160
|
+
const _fc = node.childForFieldName("toc");
|
|
2161
|
+
n.toc = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2162
|
+
}
|
|
1640
2163
|
return id;
|
|
1641
2164
|
}
|
|
1642
2165
|
function unmarshalerSuperscriptNode(node, ctx, parentId) {
|
|
1643
2166
|
const id = v4();
|
|
2167
|
+
const namedChildren = node.namedChildren;
|
|
1644
2168
|
const n = {
|
|
1645
2169
|
id,
|
|
1646
2170
|
parentId,
|
|
1647
2171
|
type: "superscript",
|
|
1648
|
-
text: node.text,
|
|
2172
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2173
|
+
startIndex: node.startIndex,
|
|
2174
|
+
endIndex: node.endIndex,
|
|
1649
2175
|
};
|
|
1650
2176
|
ctx.nodes.set(id, n);
|
|
1651
|
-
n.
|
|
1652
|
-
|
|
1653
|
-
|
|
2177
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2178
|
+
{
|
|
2179
|
+
const _fc = node.childForFieldName("superscript");
|
|
2180
|
+
n.superscript = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2181
|
+
}
|
|
1654
2182
|
return id;
|
|
1655
2183
|
}
|
|
1656
2184
|
function unmarshalerSvgIncludeNode(node, ctx, parentId) {
|
|
1657
2185
|
const id = v4();
|
|
2186
|
+
const namedChildren = node.namedChildren;
|
|
1658
2187
|
const n = {
|
|
1659
2188
|
id,
|
|
1660
2189
|
parentId,
|
|
1661
2190
|
type: "svg_include",
|
|
1662
|
-
text: node.text,
|
|
2191
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2192
|
+
startIndex: node.startIndex,
|
|
2193
|
+
endIndex: node.endIndex,
|
|
1663
2194
|
};
|
|
1664
2195
|
ctx.nodes.set(id, n);
|
|
1665
|
-
n.
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
2196
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2197
|
+
{
|
|
2198
|
+
const _fc = node.childForFieldName("command");
|
|
2199
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2200
|
+
}
|
|
2201
|
+
{
|
|
2202
|
+
const _fc = node.childForFieldName("options");
|
|
2203
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2204
|
+
}
|
|
2205
|
+
{
|
|
2206
|
+
const _fc = node.childForFieldName("path");
|
|
2207
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2208
|
+
}
|
|
1675
2209
|
return id;
|
|
1676
2210
|
}
|
|
1677
2211
|
function unmarshalerTextNode(node, ctx, parentId) {
|
|
1678
2212
|
const id = v4();
|
|
2213
|
+
const namedChildren = node.namedChildren;
|
|
1679
2214
|
const n = {
|
|
1680
2215
|
id,
|
|
1681
2216
|
parentId,
|
|
1682
2217
|
type: "text",
|
|
1683
|
-
text: node.text,
|
|
2218
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2219
|
+
startIndex: node.startIndex,
|
|
2220
|
+
endIndex: node.endIndex,
|
|
1684
2221
|
};
|
|
1685
2222
|
ctx.nodes.set(id, n);
|
|
1686
|
-
n.
|
|
1687
|
-
|
|
1688
|
-
|
|
2223
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2224
|
+
n.word = node
|
|
2225
|
+
.childrenForFieldName("word")
|
|
2226
|
+
.map((child) => n.childrenIds[node.namedChildren.indexOf(child)])
|
|
2227
|
+
.filter((id) => id !== undefined);
|
|
1689
2228
|
return id;
|
|
1690
2229
|
}
|
|
1691
2230
|
function unmarshalerTextModeNode(node, ctx, parentId) {
|
|
1692
2231
|
const id = v4();
|
|
2232
|
+
const namedChildren = node.namedChildren;
|
|
1693
2233
|
const n = {
|
|
1694
2234
|
id,
|
|
1695
2235
|
parentId,
|
|
1696
2236
|
type: "text_mode",
|
|
1697
|
-
text: node.text,
|
|
2237
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2238
|
+
startIndex: node.startIndex,
|
|
2239
|
+
endIndex: node.endIndex,
|
|
1698
2240
|
};
|
|
1699
2241
|
ctx.nodes.set(id, n);
|
|
1700
|
-
n.
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
2242
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2243
|
+
{
|
|
2244
|
+
const _fc = node.childForFieldName("command");
|
|
2245
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2246
|
+
}
|
|
2247
|
+
{
|
|
2248
|
+
const _fc = node.childForFieldName("content");
|
|
2249
|
+
n.content = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2250
|
+
}
|
|
1704
2251
|
return id;
|
|
1705
2252
|
}
|
|
1706
2253
|
function unmarshalerTheoremDefinitionNode(node, ctx, parentId) {
|
|
1707
2254
|
const id = v4();
|
|
2255
|
+
const namedChildren = node.namedChildren;
|
|
1708
2256
|
const n = {
|
|
1709
2257
|
id,
|
|
1710
2258
|
parentId,
|
|
1711
2259
|
type: "theorem_definition",
|
|
1712
|
-
text: node.text,
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
n.
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
2260
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2261
|
+
startIndex: node.startIndex,
|
|
2262
|
+
endIndex: node.endIndex,
|
|
2263
|
+
};
|
|
2264
|
+
ctx.nodes.set(id, n);
|
|
2265
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2266
|
+
{
|
|
2267
|
+
const _fc = node.childForFieldName("command");
|
|
2268
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2269
|
+
}
|
|
2270
|
+
{
|
|
2271
|
+
const _fc = node.childForFieldName("counter");
|
|
2272
|
+
n.counter = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2273
|
+
}
|
|
2274
|
+
{
|
|
2275
|
+
const _fc = node.childForFieldName("name");
|
|
2276
|
+
n.name = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2277
|
+
}
|
|
2278
|
+
{
|
|
2279
|
+
const _fc = node.childForFieldName("options");
|
|
2280
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2281
|
+
}
|
|
2282
|
+
{
|
|
2283
|
+
const _fc = node.childForFieldName("title");
|
|
2284
|
+
n.title = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2285
|
+
}
|
|
1731
2286
|
return id;
|
|
1732
2287
|
}
|
|
1733
2288
|
function unmarshalerTikzLibraryImportNode(node, ctx, parentId) {
|
|
1734
2289
|
const id = v4();
|
|
2290
|
+
const namedChildren = node.namedChildren;
|
|
1735
2291
|
const n = {
|
|
1736
2292
|
id,
|
|
1737
2293
|
parentId,
|
|
1738
2294
|
type: "tikz_library_import",
|
|
1739
|
-
text: node.text,
|
|
2295
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2296
|
+
startIndex: node.startIndex,
|
|
2297
|
+
endIndex: node.endIndex,
|
|
1740
2298
|
};
|
|
1741
2299
|
ctx.nodes.set(id, n);
|
|
1742
|
-
n.
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
2300
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2301
|
+
{
|
|
2302
|
+
const _fc = node.childForFieldName("command");
|
|
2303
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2304
|
+
}
|
|
2305
|
+
{
|
|
2306
|
+
const _fc = node.childForFieldName("paths");
|
|
2307
|
+
n.paths = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2308
|
+
}
|
|
1746
2309
|
return id;
|
|
1747
2310
|
}
|
|
1748
2311
|
function unmarshalerTitleDeclarationNode(node, ctx, parentId) {
|
|
1749
2312
|
const id = v4();
|
|
2313
|
+
const namedChildren = node.namedChildren;
|
|
1750
2314
|
const n = {
|
|
1751
2315
|
id,
|
|
1752
2316
|
parentId,
|
|
1753
2317
|
type: "title_declaration",
|
|
1754
|
-
text: node.text,
|
|
2318
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2319
|
+
startIndex: node.startIndex,
|
|
2320
|
+
endIndex: node.endIndex,
|
|
1755
2321
|
};
|
|
1756
2322
|
ctx.nodes.set(id, n);
|
|
1757
|
-
n.
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
n.childrenIds = node.namedChildren.filter((n) => !fieldNodes.has(n.id)).map((n) => unmarshalNode(n, ctx, id));
|
|
2323
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2324
|
+
{
|
|
2325
|
+
const _fc = node.childForFieldName("command");
|
|
2326
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2327
|
+
}
|
|
2328
|
+
{
|
|
2329
|
+
const _fc = node.childForFieldName("options");
|
|
2330
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2331
|
+
}
|
|
1767
2332
|
return id;
|
|
1768
2333
|
}
|
|
1769
2334
|
function unmarshalerTodoNode(node, ctx, parentId) {
|
|
1770
2335
|
const id = v4();
|
|
2336
|
+
const namedChildren = node.namedChildren;
|
|
1771
2337
|
const n = {
|
|
1772
2338
|
id,
|
|
1773
2339
|
parentId,
|
|
1774
2340
|
type: "todo",
|
|
1775
|
-
text: node.text,
|
|
2341
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2342
|
+
startIndex: node.startIndex,
|
|
2343
|
+
endIndex: node.endIndex,
|
|
1776
2344
|
};
|
|
1777
2345
|
ctx.nodes.set(id, n);
|
|
1778
|
-
n.
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
node.childForFieldName("command")
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
2346
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2347
|
+
{
|
|
2348
|
+
const _fc = node.childForFieldName("arg");
|
|
2349
|
+
n.arg = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2350
|
+
}
|
|
2351
|
+
{
|
|
2352
|
+
const _fc = node.childForFieldName("command");
|
|
2353
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2354
|
+
}
|
|
2355
|
+
{
|
|
2356
|
+
const _fc = node.childForFieldName("options");
|
|
2357
|
+
n.options = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2358
|
+
}
|
|
1788
2359
|
return id;
|
|
1789
2360
|
}
|
|
1790
2361
|
function unmarshalerValueNode(node, ctx, parentId) {
|
|
1791
2362
|
const id = v4();
|
|
2363
|
+
const namedChildren = node.namedChildren;
|
|
1792
2364
|
const n = {
|
|
1793
2365
|
id,
|
|
1794
2366
|
parentId,
|
|
1795
2367
|
type: "value",
|
|
1796
|
-
text: node.text,
|
|
2368
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2369
|
+
startIndex: node.startIndex,
|
|
2370
|
+
endIndex: node.endIndex,
|
|
1797
2371
|
};
|
|
1798
2372
|
ctx.nodes.set(id, n);
|
|
1799
|
-
n.childrenIds =
|
|
2373
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1800
2374
|
return id;
|
|
1801
2375
|
}
|
|
1802
2376
|
function unmarshalerVerbatimEnvironmentNode(node, ctx, parentId) {
|
|
1803
2377
|
const id = v4();
|
|
2378
|
+
const namedChildren = node.namedChildren;
|
|
1804
2379
|
const n = {
|
|
1805
2380
|
id,
|
|
1806
2381
|
parentId,
|
|
1807
2382
|
type: "verbatim_environment",
|
|
1808
|
-
text: node.text,
|
|
2383
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2384
|
+
startIndex: node.startIndex,
|
|
2385
|
+
endIndex: node.endIndex,
|
|
1809
2386
|
};
|
|
1810
2387
|
ctx.nodes.set(id, n);
|
|
1811
|
-
n.
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
node.childForFieldName("
|
|
1818
|
-
|
|
1819
|
-
|
|
2388
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2389
|
+
{
|
|
2390
|
+
const _fc = node.childForFieldName("begin");
|
|
2391
|
+
n.begin = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2392
|
+
}
|
|
2393
|
+
{
|
|
2394
|
+
const _fc = node.childForFieldName("end");
|
|
2395
|
+
n.end = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2396
|
+
}
|
|
2397
|
+
{
|
|
2398
|
+
const _fc = node.childForFieldName("verbatim");
|
|
2399
|
+
n.verbatim = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2400
|
+
}
|
|
1820
2401
|
return id;
|
|
1821
2402
|
}
|
|
1822
2403
|
function unmarshalerVerbatimIncludeNode(node, ctx, parentId) {
|
|
1823
2404
|
const id = v4();
|
|
2405
|
+
const namedChildren = node.namedChildren;
|
|
1824
2406
|
const n = {
|
|
1825
2407
|
id,
|
|
1826
2408
|
parentId,
|
|
1827
2409
|
type: "verbatim_include",
|
|
1828
|
-
text: node.text,
|
|
2410
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2411
|
+
startIndex: node.startIndex,
|
|
2412
|
+
endIndex: node.endIndex,
|
|
1829
2413
|
};
|
|
1830
2414
|
ctx.nodes.set(id, n);
|
|
1831
|
-
n.
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
2415
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2416
|
+
{
|
|
2417
|
+
const _fc = node.childForFieldName("command");
|
|
2418
|
+
n.command = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2419
|
+
}
|
|
2420
|
+
{
|
|
2421
|
+
const _fc = node.childForFieldName("path");
|
|
2422
|
+
n.path = _fc ? n.childrenIds[namedChildren.indexOf(_fc)] : undefined;
|
|
2423
|
+
}
|
|
1835
2424
|
return id;
|
|
1836
2425
|
}
|
|
1837
2426
|
function unmarshalerArgcNode(node, ctx, parentId) {
|
|
1838
2427
|
const id = v4();
|
|
2428
|
+
const namedChildren = node.namedChildren;
|
|
1839
2429
|
const n = {
|
|
1840
2430
|
id,
|
|
1841
2431
|
parentId,
|
|
1842
2432
|
type: "argc",
|
|
1843
|
-
text: node.text,
|
|
2433
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2434
|
+
startIndex: node.startIndex,
|
|
2435
|
+
endIndex: node.endIndex,
|
|
1844
2436
|
};
|
|
1845
2437
|
ctx.nodes.set(id, n);
|
|
1846
|
-
n.childrenIds =
|
|
2438
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1847
2439
|
return id;
|
|
1848
2440
|
}
|
|
1849
2441
|
function unmarshalerCommandNameNode(node, ctx, parentId) {
|
|
1850
2442
|
const id = v4();
|
|
2443
|
+
const namedChildren = node.namedChildren;
|
|
1851
2444
|
const n = {
|
|
1852
2445
|
id,
|
|
1853
2446
|
parentId,
|
|
1854
2447
|
type: "command_name",
|
|
1855
|
-
text: node.text,
|
|
2448
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2449
|
+
startIndex: node.startIndex,
|
|
2450
|
+
endIndex: node.endIndex,
|
|
1856
2451
|
};
|
|
1857
2452
|
ctx.nodes.set(id, n);
|
|
1858
|
-
n.childrenIds =
|
|
2453
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1859
2454
|
return id;
|
|
1860
2455
|
}
|
|
1861
2456
|
function unmarshalerCommentNode(node, ctx, parentId) {
|
|
1862
2457
|
const id = v4();
|
|
2458
|
+
const namedChildren = node.namedChildren;
|
|
1863
2459
|
const n = {
|
|
1864
2460
|
id,
|
|
1865
2461
|
parentId,
|
|
1866
2462
|
type: "comment",
|
|
1867
|
-
text: node.text,
|
|
2463
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2464
|
+
startIndex: node.startIndex,
|
|
2465
|
+
endIndex: node.endIndex,
|
|
1868
2466
|
};
|
|
1869
2467
|
ctx.nodes.set(id, n);
|
|
1870
|
-
n.childrenIds =
|
|
2468
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1871
2469
|
return id;
|
|
1872
2470
|
}
|
|
1873
2471
|
function unmarshalerDelimiterNode(node, ctx, parentId) {
|
|
1874
2472
|
const id = v4();
|
|
2473
|
+
const namedChildren = node.namedChildren;
|
|
1875
2474
|
const n = {
|
|
1876
2475
|
id,
|
|
1877
2476
|
parentId,
|
|
1878
2477
|
type: "delimiter",
|
|
1879
|
-
text: node.text,
|
|
2478
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2479
|
+
startIndex: node.startIndex,
|
|
2480
|
+
endIndex: node.endIndex,
|
|
1880
2481
|
};
|
|
1881
2482
|
ctx.nodes.set(id, n);
|
|
1882
|
-
n.childrenIds =
|
|
2483
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1883
2484
|
return id;
|
|
1884
2485
|
}
|
|
1885
2486
|
function unmarshalerLabelNode(node, ctx, parentId) {
|
|
1886
2487
|
const id = v4();
|
|
2488
|
+
const namedChildren = node.namedChildren;
|
|
1887
2489
|
const n = {
|
|
1888
2490
|
id,
|
|
1889
2491
|
parentId,
|
|
1890
2492
|
type: "label",
|
|
1891
|
-
text: node.text,
|
|
2493
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2494
|
+
startIndex: node.startIndex,
|
|
2495
|
+
endIndex: node.endIndex,
|
|
1892
2496
|
};
|
|
1893
2497
|
ctx.nodes.set(id, n);
|
|
1894
|
-
n.childrenIds =
|
|
2498
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1895
2499
|
return id;
|
|
1896
2500
|
}
|
|
1897
2501
|
function unmarshalerLetterNode(node, ctx, parentId) {
|
|
1898
2502
|
const id = v4();
|
|
2503
|
+
const namedChildren = node.namedChildren;
|
|
1899
2504
|
const n = {
|
|
1900
2505
|
id,
|
|
1901
2506
|
parentId,
|
|
1902
2507
|
type: "letter",
|
|
1903
|
-
text: node.text,
|
|
2508
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2509
|
+
startIndex: node.startIndex,
|
|
2510
|
+
endIndex: node.endIndex,
|
|
1904
2511
|
};
|
|
1905
2512
|
ctx.nodes.set(id, n);
|
|
1906
|
-
n.childrenIds =
|
|
2513
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1907
2514
|
return id;
|
|
1908
2515
|
}
|
|
1909
2516
|
function unmarshalerLineCommentNode(node, ctx, parentId) {
|
|
1910
2517
|
const id = v4();
|
|
2518
|
+
const namedChildren = node.namedChildren;
|
|
1911
2519
|
const n = {
|
|
1912
2520
|
id,
|
|
1913
2521
|
parentId,
|
|
1914
2522
|
type: "line_comment",
|
|
1915
|
-
text: node.text,
|
|
2523
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2524
|
+
startIndex: node.startIndex,
|
|
2525
|
+
endIndex: node.endIndex,
|
|
1916
2526
|
};
|
|
1917
2527
|
ctx.nodes.set(id, n);
|
|
1918
|
-
n.childrenIds =
|
|
2528
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1919
2529
|
return id;
|
|
1920
2530
|
}
|
|
1921
2531
|
function unmarshalerPathNode(node, ctx, parentId) {
|
|
1922
2532
|
const id = v4();
|
|
2533
|
+
const namedChildren = node.namedChildren;
|
|
1923
2534
|
const n = {
|
|
1924
2535
|
id,
|
|
1925
2536
|
parentId,
|
|
1926
2537
|
type: "path",
|
|
1927
|
-
text: node.text,
|
|
2538
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2539
|
+
startIndex: node.startIndex,
|
|
2540
|
+
endIndex: node.endIndex,
|
|
1928
2541
|
};
|
|
1929
2542
|
ctx.nodes.set(id, n);
|
|
1930
|
-
n.childrenIds =
|
|
2543
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1931
2544
|
return id;
|
|
1932
2545
|
}
|
|
1933
2546
|
function unmarshalerPlaceholderNode(node, ctx, parentId) {
|
|
1934
2547
|
const id = v4();
|
|
2548
|
+
const namedChildren = node.namedChildren;
|
|
1935
2549
|
const n = {
|
|
1936
2550
|
id,
|
|
1937
2551
|
parentId,
|
|
1938
2552
|
type: "placeholder",
|
|
1939
|
-
text: node.text,
|
|
2553
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2554
|
+
startIndex: node.startIndex,
|
|
2555
|
+
endIndex: node.endIndex,
|
|
1940
2556
|
};
|
|
1941
2557
|
ctx.nodes.set(id, n);
|
|
1942
|
-
n.childrenIds =
|
|
2558
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1943
2559
|
return id;
|
|
1944
2560
|
}
|
|
1945
2561
|
function unmarshalerSourceCodeNode(node, ctx, parentId) {
|
|
1946
2562
|
const id = v4();
|
|
2563
|
+
const namedChildren = node.namedChildren;
|
|
1947
2564
|
const n = {
|
|
1948
2565
|
id,
|
|
1949
2566
|
parentId,
|
|
1950
2567
|
type: "source_code",
|
|
1951
|
-
text: node.text,
|
|
2568
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2569
|
+
startIndex: node.startIndex,
|
|
2570
|
+
endIndex: node.endIndex,
|
|
1952
2571
|
};
|
|
1953
2572
|
ctx.nodes.set(id, n);
|
|
1954
|
-
n.childrenIds =
|
|
2573
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1955
2574
|
return id;
|
|
1956
2575
|
}
|
|
1957
2576
|
function unmarshalerTodoCommandNameNode(node, ctx, parentId) {
|
|
1958
2577
|
const id = v4();
|
|
2578
|
+
const namedChildren = node.namedChildren;
|
|
1959
2579
|
const n = {
|
|
1960
2580
|
id,
|
|
1961
2581
|
parentId,
|
|
1962
2582
|
type: "todo_command_name",
|
|
1963
|
-
text: node.text,
|
|
2583
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2584
|
+
startIndex: node.startIndex,
|
|
2585
|
+
endIndex: node.endIndex,
|
|
1964
2586
|
};
|
|
1965
2587
|
ctx.nodes.set(id, n);
|
|
1966
|
-
n.childrenIds =
|
|
2588
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1967
2589
|
return id;
|
|
1968
2590
|
}
|
|
1969
2591
|
function unmarshalerUriNode(node, ctx, parentId) {
|
|
1970
2592
|
const id = v4();
|
|
2593
|
+
const namedChildren = node.namedChildren;
|
|
1971
2594
|
const n = {
|
|
1972
2595
|
id,
|
|
1973
2596
|
parentId,
|
|
1974
2597
|
type: "uri",
|
|
1975
|
-
text: node.text,
|
|
2598
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2599
|
+
startIndex: node.startIndex,
|
|
2600
|
+
endIndex: node.endIndex,
|
|
1976
2601
|
};
|
|
1977
2602
|
ctx.nodes.set(id, n);
|
|
1978
|
-
n.childrenIds =
|
|
2603
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1979
2604
|
return id;
|
|
1980
2605
|
}
|
|
1981
2606
|
function unmarshalerValueLiteralNode(node, ctx, parentId) {
|
|
1982
2607
|
const id = v4();
|
|
2608
|
+
const namedChildren = node.namedChildren;
|
|
1983
2609
|
const n = {
|
|
1984
2610
|
id,
|
|
1985
2611
|
parentId,
|
|
1986
2612
|
type: "value_literal",
|
|
1987
|
-
text: node.text,
|
|
2613
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2614
|
+
startIndex: node.startIndex,
|
|
2615
|
+
endIndex: node.endIndex,
|
|
1988
2616
|
};
|
|
1989
2617
|
ctx.nodes.set(id, n);
|
|
1990
|
-
n.childrenIds =
|
|
2618
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
1991
2619
|
return id;
|
|
1992
2620
|
}
|
|
1993
2621
|
function unmarshalerWordNode(node, ctx, parentId) {
|
|
1994
2622
|
const id = v4();
|
|
2623
|
+
const namedChildren = node.namedChildren;
|
|
1995
2624
|
const n = {
|
|
1996
2625
|
id,
|
|
1997
2626
|
parentId,
|
|
1998
2627
|
type: "word",
|
|
1999
|
-
text: node.text,
|
|
2628
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2629
|
+
startIndex: node.startIndex,
|
|
2630
|
+
endIndex: node.endIndex,
|
|
2000
2631
|
};
|
|
2001
2632
|
ctx.nodes.set(id, n);
|
|
2002
|
-
n.childrenIds =
|
|
2633
|
+
n.childrenIds = namedChildren.map((child) => unmarshalNode(child, ctx, id));
|
|
2003
2634
|
return id;
|
|
2004
2635
|
}
|
|
2005
2636
|
// Parser core
|
|
@@ -2239,11 +2870,12 @@ export const unmarshalNode = (node, ctx, parentId) => {
|
|
|
2239
2870
|
return unmarshalerWordNode(node, ctx, parentId);
|
|
2240
2871
|
default: {
|
|
2241
2872
|
const id = v4();
|
|
2873
|
+
const namedChildren = node.namedChildren;
|
|
2242
2874
|
const n = {
|
|
2243
2875
|
id,
|
|
2244
2876
|
parentId,
|
|
2245
2877
|
type: node.type,
|
|
2246
|
-
text: node.text,
|
|
2878
|
+
text: namedChildren.length === 0 ? node.text : "",
|
|
2247
2879
|
childrenIds: [],
|
|
2248
2880
|
};
|
|
2249
2881
|
ctx.nodes.set(id, n);
|
|
@@ -2260,3 +2892,6 @@ export const parseCST = (root) => {
|
|
|
2260
2892
|
const rootId = unmarshalNode(root, ctx, null);
|
|
2261
2893
|
return { rootId, nodes: ctx.nodes };
|
|
2262
2894
|
};
|
|
2895
|
+
export const allChildIds = (ast, node) => {
|
|
2896
|
+
return node.childrenIds;
|
|
2897
|
+
};
|