@nfdi4plants/arctrl 2.0.0-beta.2 → 2.0.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/ARC.js +55 -18
- package/Contract/ArcAssay.js +4 -4
- package/Contract/ArcInvestigation.js +4 -4
- package/Contract/ArcStudy.js +3 -3
- package/Contract/Datamap.js +1 -1
- package/Contract/ValidationPackagesConfig.js +96 -0
- package/Core/ArcTypes.js +93 -90
- package/Core/Conversion.js +13 -13
- package/Core/DataContext.js +53 -6
- package/Core/{Table/DataMap.js → DataMap.js} +34 -22
- package/Core/Process/Component.js +15 -5
- package/Core/Process/FactorValue.js +14 -5
- package/Core/Process/MaterialAttributeValue.js +14 -5
- package/Core/Process/ProcessParameterValue.js +11 -2
- package/Core/Table/ArcTable.js +99 -11
- package/Core/Table/CompositeCell.js +38 -23
- package/Core/Table/CompositeColumn.js +7 -30
- package/Core/Table/CompositeHeader.js +5 -215
- package/Core/{Process/Value.js → Value.js} +9 -9
- package/Json/Assay.js +10 -9
- package/Json/{Process/Data.js → Data.js} +17 -17
- package/Json/{Process/DataFile.js → DataFile.js} +9 -9
- package/Json/DataMap/DataContext.js +30 -0
- package/Json/DataMap/DataMap.js +25 -0
- package/Json/Encode.js +10 -1
- package/Json/Process/Component.js +1 -1
- package/Json/Process/FactorValue.js +1 -1
- package/Json/Process/MaterialAttributeValue.js +1 -1
- package/Json/Process/ProcessInput.js +1 -1
- package/Json/Process/ProcessOutput.js +1 -1
- package/Json/Process/ProcessParameterValue.js +2 -2
- package/Json/Process/Value.js +3 -3
- package/Json/{Process/PropertyValue.js → PropertyValue.js} +30 -21
- package/Json/Study.js +9 -8
- package/Json/Table/CompositeCell.js +1 -1
- package/Json/context/rocrate/isa_data_context.js +1 -1
- package/Json/context/rocrate/isa_investigation_context.js +1 -1
- package/Json/context/rocrate/property_value_context.js +1 -1
- package/Spreadsheet/AnnotationTable/ArcTable.js +3 -2
- package/Spreadsheet/AnnotationTable/CompositeColumn.js +9 -7
- package/Spreadsheet/ArcAssay.js +62 -26
- package/Spreadsheet/ArcInvestigation.js +59 -38
- package/Spreadsheet/ArcStudy.js +51 -20
- package/Spreadsheet/DataMap.js +1 -1
- package/Spreadsheet/DataMapTable/DataMapTable.js +3 -3
- package/Spreadsheet/Template.js +1 -1
- package/ValidationPackages/ValidationPackage.js +61 -0
- package/ValidationPackages/ValidationPackagesConfig.js +88 -0
- package/Xlsx.js +9 -9
- package/Yaml/Encode.js +8 -0
- package/Yaml/ValidationPackage.js +47 -0
- package/Yaml/ValidationPackagesConfig.js +48 -0
- package/fable_modules/YAMLicious.0.0.1/Decode.fs +374 -0
- package/fable_modules/YAMLicious.0.0.1/Decode.fs.js +1684 -0
- package/fable_modules/YAMLicious.0.0.1/Encode.fs +148 -0
- package/fable_modules/YAMLicious.0.0.1/Encode.fs.js +74 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs +14 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs.js +11 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/PyInterop.fs +9 -0
- package/fable_modules/YAMLicious.0.0.1/Library.fs +138 -0
- package/fable_modules/YAMLicious.0.0.1/Library.fs.js +7 -0
- package/fable_modules/YAMLicious.0.0.1/Persil.fs +86 -0
- package/fable_modules/YAMLicious.0.0.1/Persil.fs.js +49 -0
- package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs +59 -0
- package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs.js +102 -0
- package/fable_modules/YAMLicious.0.0.1/Reader.fs +295 -0
- package/fable_modules/YAMLicious.0.0.1/Reader.fs.js +530 -0
- package/fable_modules/YAMLicious.0.0.1/Regex.fs +108 -0
- package/fable_modules/YAMLicious.0.0.1/Regex.fs.js +19 -0
- package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs +166 -0
- package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs.js +225 -0
- package/fable_modules/YAMLicious.0.0.1/Writer.fs +84 -0
- package/fable_modules/YAMLicious.0.0.1/Writer.fs.js +161 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLicious.fableproj +39 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs +82 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js +130 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
- package/fable_modules/project_cracked.json +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { match } from "../fable-library-js.4.16.0/RegExp.js";
|
|
2
|
+
import { getItemFromDict } from "../fable-library-js.4.16.0/MapUtil.js";
|
|
3
|
+
import { parse } from "../fable-library-js.4.16.0/Int32.js";
|
|
4
|
+
import { unwrap, value as value_2, map } from "../fable-library-js.4.16.0/Option.js";
|
|
5
|
+
import { empty as empty_1, collect, map as map_1, skipWhile, takeWhile, singleton, append, delay, toList } from "../fable-library-js.4.16.0/Seq.js";
|
|
6
|
+
import { YAMLContent_create_27AED5E3, YAMLElement, PreprocessorElement } from "./YAMLiciousTypes.fs.js";
|
|
7
|
+
import { append as append_1, reverse, ofArrayWithTail, tail, singleton as singleton_1, head, empty, isEmpty, cons } from "../fable-library-js.4.16.0/List.js";
|
|
8
|
+
import { $007CSchemaNamespace$007C_$007C, $007CSequenceSquareCloser$007C_$007C, $007CSequenceSquareOpener$007C_$007C, $007CInlineSequence$007C_$007C, $007CJSONCloser$007C_$007C, $007CJSONKeyOpener$007C_$007C, $007CInlineJSON$007C_$007C, $007CKey$007C_$007C, $007CYamlValue$007C_$007C, $007CKeyValue$007C_$007C, $007CYamlComment$007C_$007C, $007CSequenceMinusOpener$007C_$007C } from "./RegexActivePatterns.fs.js";
|
|
9
|
+
import { trimEnd, split as split_2, printf, toFail } from "../fable-library-js.4.16.0/String.js";
|
|
10
|
+
import { read as read_1 } from "./Preprocessing.fs.js";
|
|
11
|
+
|
|
12
|
+
function restoreStringReplace(stringDict, v) {
|
|
13
|
+
const m = match(/<s f=(?<index>\d+)\/>/gu, v);
|
|
14
|
+
if (m != null) {
|
|
15
|
+
return getItemFromDict(stringDict, parse((m.groups && m.groups.index) || "", 511, false, 32));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return v;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function restoreCommentReplace(commentDict, commentId) {
|
|
23
|
+
return map((id) => getItemFromDict(commentDict, id), commentId);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function collectSequenceElements(eles) {
|
|
27
|
+
let matchResult, rest, v, yamlAstList;
|
|
28
|
+
if (!isEmpty(eles)) {
|
|
29
|
+
const activePatternResult = $007CSequenceMinusOpener$007C_$007C(head(eles));
|
|
30
|
+
if (activePatternResult != null) {
|
|
31
|
+
if (!isEmpty(tail(eles))) {
|
|
32
|
+
if (head(tail(eles)).tag === 1) {
|
|
33
|
+
matchResult = 0;
|
|
34
|
+
rest = tail(tail(eles));
|
|
35
|
+
v = activePatternResult;
|
|
36
|
+
yamlAstList = head(tail(eles)).fields[0];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
matchResult = 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
matchResult = 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
matchResult = 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
matchResult = 1;
|
|
52
|
+
}
|
|
53
|
+
switch (matchResult) {
|
|
54
|
+
case 0:
|
|
55
|
+
return toList(delay(() => append((v.Value != null) ? singleton(cons(new PreprocessorElement(2, [value_2(v.Value)]), yamlAstList)) : singleton(yamlAstList), delay(() => collectSequenceElements(rest)))));
|
|
56
|
+
default:
|
|
57
|
+
if (isEmpty(eles)) {
|
|
58
|
+
return empty();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const activePatternResult_1 = $007CSequenceMinusOpener$007C_$007C(head(eles));
|
|
62
|
+
if (activePatternResult_1 != null) {
|
|
63
|
+
const v_1 = activePatternResult_1;
|
|
64
|
+
return toList(delay(() => append(singleton(singleton_1(new PreprocessorElement(2, [value_2(v_1.Value)]))), delay(() => collectSequenceElements(tail(eles))))));
|
|
65
|
+
}
|
|
66
|
+
else if ($007CYamlComment$007C_$007C(head(eles)) != null) {
|
|
67
|
+
return toList(delay(() => append(singleton(singleton_1(head(eles))), delay(() => collectSequenceElements(tail(eles))))));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return toFail(printf("Unknown pattern for sequence elements: %A"))(eles);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function isSequenceElement(e) {
|
|
77
|
+
let matchResult;
|
|
78
|
+
if (e.tag === 1) {
|
|
79
|
+
matchResult = 0;
|
|
80
|
+
}
|
|
81
|
+
else if ($007CSequenceMinusOpener$007C_$007C(e) != null) {
|
|
82
|
+
matchResult = 0;
|
|
83
|
+
}
|
|
84
|
+
else if ($007CYamlComment$007C_$007C(e) != null) {
|
|
85
|
+
matchResult = 0;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
matchResult = 1;
|
|
89
|
+
}
|
|
90
|
+
switch (matchResult) {
|
|
91
|
+
case 0:
|
|
92
|
+
return true;
|
|
93
|
+
default:
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function tokenize(yamlList, stringDict, commentDict) {
|
|
99
|
+
const loopRead = (restlist_mut, acc_mut) => {
|
|
100
|
+
let c2_2, c1_2, c1_1, c2_1;
|
|
101
|
+
loopRead:
|
|
102
|
+
while (true) {
|
|
103
|
+
const restlist = restlist_mut, acc = acc_mut;
|
|
104
|
+
let matchResult, rest0, v, yamlAstList;
|
|
105
|
+
if (!isEmpty(restlist)) {
|
|
106
|
+
const activePatternResult = $007CSchemaNamespace$007C_$007C(head(restlist));
|
|
107
|
+
if (activePatternResult != null) {
|
|
108
|
+
if (!isEmpty(tail(restlist))) {
|
|
109
|
+
if (head(tail(restlist)).tag === 1) {
|
|
110
|
+
matchResult = 0;
|
|
111
|
+
rest0 = tail(tail(restlist));
|
|
112
|
+
v = activePatternResult;
|
|
113
|
+
yamlAstList = head(tail(restlist)).fields[0];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
matchResult = 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
matchResult = 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
matchResult = 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
matchResult = 1;
|
|
129
|
+
}
|
|
130
|
+
switch (matchResult) {
|
|
131
|
+
case 0: {
|
|
132
|
+
const sequenceElements = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0)));
|
|
133
|
+
restlist_mut = toList(skipWhile(isSequenceElement, rest0));
|
|
134
|
+
acc_mut = cons(new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(cons(new PreprocessorElement(2, [v.Key]), yamlAstList), empty())), delay(() => map_1((i) => loopRead(i, empty()), sequenceElements)))))]), acc);
|
|
135
|
+
continue loopRead;
|
|
136
|
+
}
|
|
137
|
+
default: {
|
|
138
|
+
let matchResult_1, rest0_1, v_1, rest0_2, v_2, yamlAstList_1;
|
|
139
|
+
if (!isEmpty(restlist)) {
|
|
140
|
+
const activePatternResult_1 = $007CSchemaNamespace$007C_$007C(head(restlist));
|
|
141
|
+
if (activePatternResult_1 != null) {
|
|
142
|
+
matchResult_1 = 0;
|
|
143
|
+
rest0_1 = tail(restlist);
|
|
144
|
+
v_1 = activePatternResult_1;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const activePatternResult_2 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
|
|
148
|
+
if (activePatternResult_2 != null) {
|
|
149
|
+
if (!isEmpty(tail(restlist))) {
|
|
150
|
+
if (head(tail(restlist)).tag === 1) {
|
|
151
|
+
matchResult_1 = 1;
|
|
152
|
+
rest0_2 = tail(tail(restlist));
|
|
153
|
+
v_2 = activePatternResult_2;
|
|
154
|
+
yamlAstList_1 = head(tail(restlist)).fields[0];
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
matchResult_1 = 2;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
matchResult_1 = 2;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
matchResult_1 = 2;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
matchResult_1 = 2;
|
|
171
|
+
}
|
|
172
|
+
switch (matchResult_1) {
|
|
173
|
+
case 0: {
|
|
174
|
+
const sequenceElements_1 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_1)));
|
|
175
|
+
restlist_mut = toList(skipWhile(isSequenceElement, rest0_1));
|
|
176
|
+
acc_mut = cons(new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(singleton_1(new PreprocessorElement(2, [v_1.Key])), empty())), delay(() => map_1((i_1) => loopRead(i_1, empty()), sequenceElements_1)))))]), acc);
|
|
177
|
+
continue loopRead;
|
|
178
|
+
}
|
|
179
|
+
case 1: {
|
|
180
|
+
const objectList_1 = (v_2.Value != null) ? cons(new PreprocessorElement(2, [value_2(v_2.Value)]), yamlAstList_1) : yamlAstList_1;
|
|
181
|
+
const sequenceElements_2 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_2)));
|
|
182
|
+
restlist_mut = toList(skipWhile(isSequenceElement, rest0_2));
|
|
183
|
+
acc_mut = cons(new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(objectList_1, empty())), delay(() => map_1((i_2) => loopRead(i_2, empty()), sequenceElements_2)))))]), acc);
|
|
184
|
+
continue loopRead;
|
|
185
|
+
}
|
|
186
|
+
default: {
|
|
187
|
+
let matchResult_2, rest0_3, v_3, rest_4, v_4, closer, iList, opener, rest_5;
|
|
188
|
+
if (!isEmpty(restlist)) {
|
|
189
|
+
const activePatternResult_3 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
|
|
190
|
+
if (activePatternResult_3 != null) {
|
|
191
|
+
matchResult_2 = 0;
|
|
192
|
+
rest0_3 = tail(restlist);
|
|
193
|
+
v_3 = activePatternResult_3;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const activePatternResult_4 = $007CInlineSequence$007C_$007C(head(restlist));
|
|
197
|
+
if (activePatternResult_4 != null) {
|
|
198
|
+
matchResult_2 = 1;
|
|
199
|
+
rest_4 = tail(restlist);
|
|
200
|
+
v_4 = activePatternResult_4;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
const activePatternResult_5 = $007CSequenceSquareOpener$007C_$007C(head(restlist));
|
|
204
|
+
if (activePatternResult_5 != null) {
|
|
205
|
+
if (!isEmpty(tail(restlist))) {
|
|
206
|
+
if (head(tail(restlist)).tag === 1) {
|
|
207
|
+
if (!isEmpty(tail(tail(restlist)))) {
|
|
208
|
+
const activePatternResult_6 = $007CSequenceSquareCloser$007C_$007C(head(tail(tail(restlist))));
|
|
209
|
+
if (activePatternResult_6 != null) {
|
|
210
|
+
matchResult_2 = 2;
|
|
211
|
+
closer = activePatternResult_6;
|
|
212
|
+
iList = head(tail(restlist)).fields[0];
|
|
213
|
+
opener = activePatternResult_5;
|
|
214
|
+
rest_5 = tail(tail(tail(restlist)));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
matchResult_2 = 3;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
matchResult_2 = 3;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
matchResult_2 = 3;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
matchResult_2 = 3;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
matchResult_2 = 3;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
matchResult_2 = 3;
|
|
240
|
+
}
|
|
241
|
+
switch (matchResult_2) {
|
|
242
|
+
case 0: {
|
|
243
|
+
const sequenceElements_3 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_3)));
|
|
244
|
+
restlist_mut = toList(skipWhile(isSequenceElement, rest0_3));
|
|
245
|
+
acc_mut = cons(new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(singleton_1(new PreprocessorElement(2, [value_2(v_3.Value)])), empty())), delay(() => map_1((i_3) => loopRead(i_3, empty()), sequenceElements_3)))))]), acc);
|
|
246
|
+
continue loopRead;
|
|
247
|
+
}
|
|
248
|
+
case 1: {
|
|
249
|
+
const c = restoreCommentReplace(commentDict, v_4.Comment);
|
|
250
|
+
const split = split_2(v_4.Value, [","], void 0, 1);
|
|
251
|
+
const current_4 = new YAMLElement(2, [toList(delay(() => map_1((value) => loopRead(singleton_1(new PreprocessorElement(2, [value.trim()])), empty()), split)))]);
|
|
252
|
+
restlist_mut = rest_4;
|
|
253
|
+
acc_mut = ((c != null) ? ofArrayWithTail([current_4, new YAMLElement(4, [value_2(c)])], acc) : cons(current_4, acc));
|
|
254
|
+
continue loopRead;
|
|
255
|
+
}
|
|
256
|
+
case 2: {
|
|
257
|
+
const c1 = restoreCommentReplace(commentDict, opener.Comment);
|
|
258
|
+
const c2 = restoreCommentReplace(commentDict, closer.Comment);
|
|
259
|
+
const current_5 = new YAMLElement(2, [toList(delay(() => collect((i_4) => singleton(loopRead(singleton_1((i_4.tag === 2) ? (new PreprocessorElement(2, [trimEnd(i_4.fields[0], ",")])) : toFail(printf("Unexpected element in MultiLineSquareBrackets: %A"))(i_4)), empty())), iList)))]);
|
|
260
|
+
restlist_mut = rest_5;
|
|
261
|
+
acc_mut = ((c1 == null) ? ((c2 == null) ? cons(current_5, acc) : ((c2_2 = c2, ofArrayWithTail([new YAMLElement(4, [c2_2]), current_5], acc)))) : ((c2 == null) ? ((c1_2 = c1, ofArrayWithTail([current_5, new YAMLElement(4, [c1_2])], acc))) : ((c1_1 = c1, (c2_1 = c2, ofArrayWithTail([new YAMLElement(4, [c2_1]), current_5, new YAMLElement(4, [c1_1])], acc))))));
|
|
262
|
+
continue loopRead;
|
|
263
|
+
}
|
|
264
|
+
default: {
|
|
265
|
+
let matchResult_3, rest_6, v_5, closer_1, iList_1, opener_1, rest_7;
|
|
266
|
+
if (!isEmpty(restlist)) {
|
|
267
|
+
const activePatternResult_7 = $007CInlineJSON$007C_$007C(head(restlist));
|
|
268
|
+
if (activePatternResult_7 != null) {
|
|
269
|
+
matchResult_3 = 0;
|
|
270
|
+
rest_6 = tail(restlist);
|
|
271
|
+
v_5 = activePatternResult_7;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const activePatternResult_8 = $007CJSONKeyOpener$007C_$007C(head(restlist));
|
|
275
|
+
if (activePatternResult_8 != null) {
|
|
276
|
+
if (!isEmpty(tail(restlist))) {
|
|
277
|
+
if (head(tail(restlist)).tag === 1) {
|
|
278
|
+
if (!isEmpty(tail(tail(restlist)))) {
|
|
279
|
+
const activePatternResult_9 = $007CJSONCloser$007C_$007C(head(tail(tail(restlist))));
|
|
280
|
+
if (activePatternResult_9 != null) {
|
|
281
|
+
matchResult_3 = 1;
|
|
282
|
+
closer_1 = activePatternResult_9;
|
|
283
|
+
iList_1 = head(tail(restlist)).fields[0];
|
|
284
|
+
opener_1 = activePatternResult_8;
|
|
285
|
+
rest_7 = tail(tail(tail(restlist)));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
matchResult_3 = 2;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
matchResult_3 = 2;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
matchResult_3 = 2;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
matchResult_3 = 2;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
matchResult_3 = 2;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
matchResult_3 = 2;
|
|
310
|
+
}
|
|
311
|
+
switch (matchResult_3) {
|
|
312
|
+
case 0: {
|
|
313
|
+
const c_1 = restoreCommentReplace(commentDict, v_5.Comment);
|
|
314
|
+
const split_1 = split_2(v_5.Value, [","], void 0, 1);
|
|
315
|
+
const current_6 = reverse(toList(delay(() => collect((value_1) => {
|
|
316
|
+
const matchValue_1 = loopRead(singleton_1(new PreprocessorElement(2, [value_1.trim()])), empty());
|
|
317
|
+
if (matchValue_1.tag === 3) {
|
|
318
|
+
return matchValue_1.fields[0];
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
throw new Error("Unexpected element in InlineJSON");
|
|
322
|
+
return empty_1();
|
|
323
|
+
}
|
|
324
|
+
}, split_1))));
|
|
325
|
+
restlist_mut = rest_6;
|
|
326
|
+
acc_mut = ((c_1 != null) ? append_1(current_6, cons(new YAMLElement(4, [value_2(c_1)]), acc)) : append_1(current_6, acc));
|
|
327
|
+
continue loopRead;
|
|
328
|
+
}
|
|
329
|
+
case 1: {
|
|
330
|
+
const c1_3 = restoreCommentReplace(commentDict, opener_1.Comment);
|
|
331
|
+
const c2_3 = restoreCommentReplace(commentDict, closer_1.Comment);
|
|
332
|
+
const current_7 = new YAMLElement(0, [YAMLContent_create_27AED5E3(opener_1.Key, unwrap(c1_3)), new YAMLElement(3, [toList(delay(() => collect((i_5) => {
|
|
333
|
+
const matchValue_2 = loopRead(singleton_1((i_5.tag === 2) ? (new PreprocessorElement(2, [trimEnd(i_5.fields[0], ",")])) : toFail(printf("Unexpected element in MultiLineSquareBrackets: %A"))(i_5)), empty());
|
|
334
|
+
if (matchValue_2.tag === 3) {
|
|
335
|
+
return matchValue_2.fields[0];
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
throw new Error("Unexpected element in MultilineJSON");
|
|
339
|
+
return empty_1();
|
|
340
|
+
}
|
|
341
|
+
}, iList_1)))])]);
|
|
342
|
+
restlist_mut = rest_7;
|
|
343
|
+
acc_mut = ((c2_3 == null) ? cons(current_7, acc) : ofArrayWithTail([new YAMLElement(4, [c2_3]), current_7], acc));
|
|
344
|
+
continue loopRead;
|
|
345
|
+
}
|
|
346
|
+
default: {
|
|
347
|
+
let matchResult_4, rest_8, v_6, yamlAstList_2;
|
|
348
|
+
if (!isEmpty(restlist)) {
|
|
349
|
+
const activePatternResult_10 = $007CKey$007C_$007C(head(restlist));
|
|
350
|
+
if (activePatternResult_10 != null) {
|
|
351
|
+
if (!isEmpty(tail(restlist))) {
|
|
352
|
+
if (head(tail(restlist)).tag === 1) {
|
|
353
|
+
matchResult_4 = 0;
|
|
354
|
+
rest_8 = tail(tail(restlist));
|
|
355
|
+
v_6 = activePatternResult_10;
|
|
356
|
+
yamlAstList_2 = head(tail(restlist)).fields[0];
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
matchResult_4 = 1;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
matchResult_4 = 1;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
matchResult_4 = 1;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
matchResult_4 = 1;
|
|
372
|
+
}
|
|
373
|
+
switch (matchResult_4) {
|
|
374
|
+
case 0: {
|
|
375
|
+
restlist_mut = rest_8;
|
|
376
|
+
acc_mut = cons(new YAMLElement(0, [YAMLContent_create_27AED5E3(v_6.Key, unwrap(restoreCommentReplace(commentDict, v_6.Comment))), loopRead(yamlAstList_2, empty())]), acc);
|
|
377
|
+
continue loopRead;
|
|
378
|
+
}
|
|
379
|
+
default: {
|
|
380
|
+
let matchResult_5, rest0_4, v_7, w, yamlAstList_3;
|
|
381
|
+
if (!isEmpty(restlist)) {
|
|
382
|
+
const activePatternResult_11 = $007CKey$007C_$007C(head(restlist));
|
|
383
|
+
if (activePatternResult_11 != null) {
|
|
384
|
+
if (!isEmpty(tail(restlist))) {
|
|
385
|
+
const activePatternResult_12 = $007CSequenceMinusOpener$007C_$007C(head(tail(restlist)));
|
|
386
|
+
if (activePatternResult_12 != null) {
|
|
387
|
+
if (!isEmpty(tail(tail(restlist)))) {
|
|
388
|
+
if (head(tail(tail(restlist))).tag === 1) {
|
|
389
|
+
matchResult_5 = 0;
|
|
390
|
+
rest0_4 = tail(tail(tail(restlist)));
|
|
391
|
+
v_7 = activePatternResult_11;
|
|
392
|
+
w = activePatternResult_12;
|
|
393
|
+
yamlAstList_3 = head(tail(tail(restlist))).fields[0];
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
matchResult_5 = 1;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
matchResult_5 = 1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
matchResult_5 = 1;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
matchResult_5 = 1;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
matchResult_5 = 1;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
matchResult_5 = 1;
|
|
417
|
+
}
|
|
418
|
+
switch (matchResult_5) {
|
|
419
|
+
case 0: {
|
|
420
|
+
const c_3 = restoreCommentReplace(commentDict, v_7.Comment);
|
|
421
|
+
const objectList_2 = (w.Value != null) ? cons(new PreprocessorElement(2, [value_2(w.Value)]), yamlAstList_3) : yamlAstList_3;
|
|
422
|
+
const sequenceElements_4 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_4)));
|
|
423
|
+
const rest_9 = toList(skipWhile(isSequenceElement, rest0_4));
|
|
424
|
+
const seq = new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(objectList_2, empty())), delay(() => map_1((i_6) => loopRead(i_6, empty()), sequenceElements_4)))))]);
|
|
425
|
+
restlist_mut = rest_9;
|
|
426
|
+
acc_mut = cons(new YAMLElement(0, [YAMLContent_create_27AED5E3(v_7.Key, unwrap(c_3)), new YAMLElement(3, [singleton_1(seq)])]), acc);
|
|
427
|
+
continue loopRead;
|
|
428
|
+
}
|
|
429
|
+
default: {
|
|
430
|
+
let matchResult_6, rest0_5, v_8, w_1;
|
|
431
|
+
if (!isEmpty(restlist)) {
|
|
432
|
+
const activePatternResult_13 = $007CKey$007C_$007C(head(restlist));
|
|
433
|
+
if (activePatternResult_13 != null) {
|
|
434
|
+
if (!isEmpty(tail(restlist))) {
|
|
435
|
+
const activePatternResult_14 = $007CSequenceMinusOpener$007C_$007C(head(tail(restlist)));
|
|
436
|
+
if (activePatternResult_14 != null) {
|
|
437
|
+
matchResult_6 = 0;
|
|
438
|
+
rest0_5 = tail(tail(restlist));
|
|
439
|
+
v_8 = activePatternResult_13;
|
|
440
|
+
w_1 = activePatternResult_14;
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
matchResult_6 = 1;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
matchResult_6 = 1;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
matchResult_6 = 1;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
matchResult_6 = 1;
|
|
456
|
+
}
|
|
457
|
+
switch (matchResult_6) {
|
|
458
|
+
case 0: {
|
|
459
|
+
const c_4 = restoreCommentReplace(commentDict, v_8.Comment);
|
|
460
|
+
const sequenceElements_5 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_5)));
|
|
461
|
+
const rest_10 = toList(skipWhile(isSequenceElement, rest0_5));
|
|
462
|
+
const seq_1 = new YAMLElement(2, [toList(delay(() => append(singleton(loopRead(singleton_1(new PreprocessorElement(2, [value_2(w_1.Value)])), empty())), delay(() => map_1((i_7) => loopRead(i_7, empty()), sequenceElements_5)))))]);
|
|
463
|
+
restlist_mut = rest_10;
|
|
464
|
+
acc_mut = cons(new YAMLElement(0, [YAMLContent_create_27AED5E3(v_8.Key, unwrap(c_4)), new YAMLElement(3, [singleton_1(seq_1)])]), acc);
|
|
465
|
+
continue loopRead;
|
|
466
|
+
}
|
|
467
|
+
default:
|
|
468
|
+
if (isEmpty(restlist)) {
|
|
469
|
+
return new YAMLElement(3, [reverse(acc)]);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
const activePatternResult_15 = $007CKeyValue$007C_$007C(head(restlist));
|
|
473
|
+
if (activePatternResult_15 != null) {
|
|
474
|
+
const v_9 = activePatternResult_15;
|
|
475
|
+
restlist_mut = tail(restlist);
|
|
476
|
+
acc_mut = cons(new YAMLElement(0, [YAMLContent_create_27AED5E3(v_9.Key), loopRead(singleton_1(new PreprocessorElement(2, [v_9.Value])), empty())]), acc);
|
|
477
|
+
continue loopRead;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
const activePatternResult_16 = $007CYamlComment$007C_$007C(head(restlist));
|
|
481
|
+
if (activePatternResult_16 != null) {
|
|
482
|
+
const v_10 = activePatternResult_16;
|
|
483
|
+
restlist_mut = tail(restlist);
|
|
484
|
+
acc_mut = cons(new YAMLElement(4, [getItemFromDict(commentDict, v_10.Comment)]), acc);
|
|
485
|
+
continue loopRead;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
const activePatternResult_17 = $007CYamlValue$007C_$007C(head(restlist));
|
|
489
|
+
if (activePatternResult_17 != null) {
|
|
490
|
+
const v_11 = activePatternResult_17;
|
|
491
|
+
restlist_mut = tail(restlist);
|
|
492
|
+
acc_mut = cons(new YAMLElement(1, [YAMLContent_create_27AED5E3(restoreStringReplace(stringDict, v_11.Value), unwrap(restoreCommentReplace(commentDict, v_11.Comment)))]), acc);
|
|
493
|
+
continue loopRead;
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
return toFail(printf("Unknown pattern: %A"))(restlist);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
return loopRead(yamlList, empty());
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export function read(yaml) {
|
|
521
|
+
const ast = read_1(yaml);
|
|
522
|
+
const matchValue = ast.AST;
|
|
523
|
+
if (matchValue.tag === 0) {
|
|
524
|
+
return tokenize(matchValue.fields[0], ast.StringMap, ast.CommentMap);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
throw new Error("Not a root!");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
module YAMLicious.Regex
|
|
2
|
+
|
|
3
|
+
[<Literal>]
|
|
4
|
+
let CommentPattern =
|
|
5
|
+
#if FABLE_COMPILER_PYTHON
|
|
6
|
+
"\<c f=(?P<comment>\d+)\/\>"
|
|
7
|
+
#endif
|
|
8
|
+
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
9
|
+
"<c f=(?<comment>\d+)\/>"
|
|
10
|
+
#endif
|
|
11
|
+
#if !FABLE_COMPILER
|
|
12
|
+
"\<c f=(?<comment>\d+)\/\>"
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
let KeyPattern =
|
|
16
|
+
#if FABLE_COMPILER_PYTHON
|
|
17
|
+
$"^(?P<key>[^\{{\[]+):\s*({CommentPattern})?$"
|
|
18
|
+
#else
|
|
19
|
+
$"^(?<key>[^\{{\[]+):\s*({CommentPattern})?$"
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
[<Literal>]
|
|
23
|
+
let KeyValuePattern =
|
|
24
|
+
#if FABLE_COMPILER_PYTHON
|
|
25
|
+
"^(?P<key>[^\{{\[]+):\s+(?P<value>.*)$"
|
|
26
|
+
#else
|
|
27
|
+
"^(?<key>[^\{{\[]+):\s+(?<value>(.*))$"
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
let LineCommentPattern =
|
|
31
|
+
$"^{CommentPattern}$"
|
|
32
|
+
|
|
33
|
+
let ValuePattern =
|
|
34
|
+
#if FABLE_COMPILER_PYTHON
|
|
35
|
+
$"^(?P<value>.*?)\s*?({CommentPattern})?$"
|
|
36
|
+
#else
|
|
37
|
+
$"^(?<value>.*?)\s*?({CommentPattern})?$"
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
[<Literal>]
|
|
41
|
+
let SequenceMinusPattern =
|
|
42
|
+
#if FABLE_COMPILER_PYTHON
|
|
43
|
+
"^-(\s+(?P<value>.*))?$"
|
|
44
|
+
#else
|
|
45
|
+
"^-(\s+(?<value>.*))?$"
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
let InlineSequencePattern =
|
|
49
|
+
#if FABLE_COMPILER_PYTHON
|
|
50
|
+
$"^\[(?P<inlineSequence>.+)\]\s*?({CommentPattern})?$"
|
|
51
|
+
#else
|
|
52
|
+
$"^\[(?<inlineSequence>.+)\]\s*?({CommentPattern})?$"
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
let InlineJSONPattern =
|
|
56
|
+
#if FABLE_COMPILER_PYTHON
|
|
57
|
+
$"^\{{(?P<inlineSequence>.+)\}}\s*?({CommentPattern})?$"
|
|
58
|
+
#else
|
|
59
|
+
$"^\{{(?<inlineSequence>.+)\}}\s*?({CommentPattern})?$"
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
let SequenceOpenerPattern =
|
|
63
|
+
#if FABLE_COMPILER_PYTHON
|
|
64
|
+
$"^\[\s*({CommentPattern})?$"
|
|
65
|
+
#else
|
|
66
|
+
$"^\[\s*({CommentPattern})?$"
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
let SequenceCloserPattern =
|
|
70
|
+
#if FABLE_COMPILER_PYTHON
|
|
71
|
+
$"^\]\s*({CommentPattern})?$"
|
|
72
|
+
#else
|
|
73
|
+
$"^\]\s*({CommentPattern})?$"
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
let JSONOpenerPattern =
|
|
77
|
+
#if FABLE_COMPILER_PYTHON
|
|
78
|
+
$"^(?P<key>[^\{{\[]+):\s+\{{\s*({CommentPattern})?$"
|
|
79
|
+
#else
|
|
80
|
+
$"^(?<key>[^\{{\[]+):\s+\{{\s*({CommentPattern})?$"
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
let JSONCloserPattern =
|
|
84
|
+
#if FABLE_COMPILER_PYTHON
|
|
85
|
+
$"^\}}\s*({CommentPattern})?$"
|
|
86
|
+
#else
|
|
87
|
+
$"^\}}\s*({CommentPattern})?$"
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
[<Literal>]
|
|
91
|
+
let StringReplacementPattern =
|
|
92
|
+
#if FABLE_COMPILER_PYTHON
|
|
93
|
+
"\<s f=(?P<index>\d+)\/\>"
|
|
94
|
+
#endif
|
|
95
|
+
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
96
|
+
"<s f=(?<index>\d+)\/>"
|
|
97
|
+
#endif
|
|
98
|
+
#if !FABLE_COMPILER
|
|
99
|
+
"\<s f=(?<index>\d+)\/\>"
|
|
100
|
+
#endif
|
|
101
|
+
|
|
102
|
+
[<Literal>]
|
|
103
|
+
let SchemaNamespacePattern =
|
|
104
|
+
#if FABLE_COMPILER_PYTHON
|
|
105
|
+
"^\$(?P<key>[a-zA-Z0-9\s:]+):$"
|
|
106
|
+
#else
|
|
107
|
+
"^\$(?<key>[a-zA-Z0-9\s:]+):$"
|
|
108
|
+
#endif
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
export const KeyPattern = `^(?<key>[^\\{\\[]+):\\s*(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
3
|
+
|
|
4
|
+
export const LineCommentPattern = `^${"<c f=(?<comment>\\d+)\\/>"}$`;
|
|
5
|
+
|
|
6
|
+
export const ValuePattern = `^(?<value>.*?)\\s*?(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
7
|
+
|
|
8
|
+
export const InlineSequencePattern = `^\\[(?<inlineSequence>.+)\\]\\s*?(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
9
|
+
|
|
10
|
+
export const InlineJSONPattern = `^\\{(?<inlineSequence>.+)\\}\\s*?(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
11
|
+
|
|
12
|
+
export const SequenceOpenerPattern = `^\\[\\s*(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
13
|
+
|
|
14
|
+
export const SequenceCloserPattern = `^\\]\\s*(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
15
|
+
|
|
16
|
+
export const JSONOpenerPattern = `^(?<key>[^\\{\\[]+):\\s+\\{\\s*(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
17
|
+
|
|
18
|
+
export const JSONCloserPattern = `^\\}\\s*(${"<c f=(?<comment>\\d+)\\/>"})?$`;
|
|
19
|
+
|