@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.
Files changed (83) hide show
  1. package/ARC.js +55 -18
  2. package/Contract/ArcAssay.js +4 -4
  3. package/Contract/ArcInvestigation.js +4 -4
  4. package/Contract/ArcStudy.js +3 -3
  5. package/Contract/Datamap.js +1 -1
  6. package/Contract/ValidationPackagesConfig.js +96 -0
  7. package/Core/ArcTypes.js +93 -90
  8. package/Core/Conversion.js +13 -13
  9. package/Core/DataContext.js +53 -6
  10. package/Core/{Table/DataMap.js → DataMap.js} +34 -22
  11. package/Core/Process/Component.js +15 -5
  12. package/Core/Process/FactorValue.js +14 -5
  13. package/Core/Process/MaterialAttributeValue.js +14 -5
  14. package/Core/Process/ProcessParameterValue.js +11 -2
  15. package/Core/Table/ArcTable.js +99 -11
  16. package/Core/Table/CompositeCell.js +38 -23
  17. package/Core/Table/CompositeColumn.js +7 -30
  18. package/Core/Table/CompositeHeader.js +5 -215
  19. package/Core/{Process/Value.js → Value.js} +9 -9
  20. package/Json/Assay.js +10 -9
  21. package/Json/{Process/Data.js → Data.js} +17 -17
  22. package/Json/{Process/DataFile.js → DataFile.js} +9 -9
  23. package/Json/DataMap/DataContext.js +30 -0
  24. package/Json/DataMap/DataMap.js +25 -0
  25. package/Json/Encode.js +10 -1
  26. package/Json/Process/Component.js +1 -1
  27. package/Json/Process/FactorValue.js +1 -1
  28. package/Json/Process/MaterialAttributeValue.js +1 -1
  29. package/Json/Process/ProcessInput.js +1 -1
  30. package/Json/Process/ProcessOutput.js +1 -1
  31. package/Json/Process/ProcessParameterValue.js +2 -2
  32. package/Json/Process/Value.js +3 -3
  33. package/Json/{Process/PropertyValue.js → PropertyValue.js} +30 -21
  34. package/Json/Study.js +9 -8
  35. package/Json/Table/CompositeCell.js +1 -1
  36. package/Json/context/rocrate/isa_data_context.js +1 -1
  37. package/Json/context/rocrate/isa_investigation_context.js +1 -1
  38. package/Json/context/rocrate/property_value_context.js +1 -1
  39. package/Spreadsheet/AnnotationTable/ArcTable.js +3 -2
  40. package/Spreadsheet/AnnotationTable/CompositeColumn.js +9 -7
  41. package/Spreadsheet/ArcAssay.js +62 -26
  42. package/Spreadsheet/ArcInvestigation.js +59 -38
  43. package/Spreadsheet/ArcStudy.js +51 -20
  44. package/Spreadsheet/DataMap.js +1 -1
  45. package/Spreadsheet/DataMapTable/DataMapTable.js +3 -3
  46. package/Spreadsheet/Template.js +1 -1
  47. package/ValidationPackages/ValidationPackage.js +61 -0
  48. package/ValidationPackages/ValidationPackagesConfig.js +88 -0
  49. package/Xlsx.js +9 -9
  50. package/Yaml/Encode.js +8 -0
  51. package/Yaml/ValidationPackage.js +47 -0
  52. package/Yaml/ValidationPackagesConfig.js +48 -0
  53. package/fable_modules/YAMLicious.0.0.1/Decode.fs +374 -0
  54. package/fable_modules/YAMLicious.0.0.1/Decode.fs.js +1684 -0
  55. package/fable_modules/YAMLicious.0.0.1/Encode.fs +148 -0
  56. package/fable_modules/YAMLicious.0.0.1/Encode.fs.js +74 -0
  57. package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs +14 -0
  58. package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs.js +11 -0
  59. package/fable_modules/YAMLicious.0.0.1/Interop/PyInterop.fs +9 -0
  60. package/fable_modules/YAMLicious.0.0.1/Library.fs +138 -0
  61. package/fable_modules/YAMLicious.0.0.1/Library.fs.js +7 -0
  62. package/fable_modules/YAMLicious.0.0.1/Persil.fs +86 -0
  63. package/fable_modules/YAMLicious.0.0.1/Persil.fs.js +49 -0
  64. package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs +59 -0
  65. package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs.js +102 -0
  66. package/fable_modules/YAMLicious.0.0.1/Reader.fs +295 -0
  67. package/fable_modules/YAMLicious.0.0.1/Reader.fs.js +530 -0
  68. package/fable_modules/YAMLicious.0.0.1/Regex.fs +108 -0
  69. package/fable_modules/YAMLicious.0.0.1/Regex.fs.js +19 -0
  70. package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs +166 -0
  71. package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs.js +225 -0
  72. package/fable_modules/YAMLicious.0.0.1/Writer.fs +84 -0
  73. package/fable_modules/YAMLicious.0.0.1/Writer.fs.js +161 -0
  74. package/fable_modules/YAMLicious.0.0.1/YAMLicious.fableproj +39 -0
  75. package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs +82 -0
  76. package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js +130 -0
  77. package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  78. package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
  79. package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  80. package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
  81. package/fable_modules/project_cracked.json +1 -1
  82. package/index.js +1 -0
  83. package/package.json +1 -1
@@ -0,0 +1,166 @@
1
+ module YAMLicious.RegexActivePatterns
2
+
3
+ open System.Text.RegularExpressions
4
+ open YAMLiciousTypes
5
+ open Preprocessing
6
+ open Regex
7
+
8
+ // Define the active pattern
9
+ let (|Key|_|) (input: PreprocessorElement) =
10
+ match input with
11
+ | Line s ->
12
+ let m = Regex.Match(s, KeyPattern)
13
+ if m.Success then
14
+ let comment: int option =
15
+ let v = m.Groups.["comment"].Value
16
+ if v = "" then None else Some (int v)
17
+ Some {| Comment = comment; Key = m.Groups.["key"].Value |}
18
+ else
19
+ None
20
+ | _ -> None
21
+
22
+ // Define the active pattern
23
+ let (|KeyValue|_|) (input: PreprocessorElement) =
24
+ match input with
25
+ | Line s ->
26
+ let m = Regex.Match(s, KeyValuePattern)
27
+ if m.Success then
28
+ let v: string =
29
+ m.Groups.["value"].Value.Trim()
30
+ Some {| Value = v; Key = m.Groups.["key"].Value |}
31
+ else
32
+ None
33
+ | _ -> None
34
+
35
+ // Define the active pattern
36
+ let (|YamlValue|_|) (input: PreprocessorElement) =
37
+ match input with
38
+ | Line s ->
39
+ let m = Regex.Match(s, ValuePattern)
40
+ if m.Success then
41
+ let comment: int option =
42
+ let v = m.Groups.["comment"].Value
43
+ if v = "" then None else Some (int v)
44
+ let v: string =
45
+ m.Groups.["value"].Value.Trim()
46
+ Some {| Comment = comment; Value = v |}
47
+ else
48
+ None
49
+ | _ -> None
50
+
51
+ // Define the active pattern
52
+ let (|YamlComment|_|) (input: PreprocessorElement) =
53
+ match input with
54
+ | Line s ->
55
+ let m = Regex.Match(s, LineCommentPattern)
56
+ if m.Success then
57
+ Some {| Comment = m.Groups.["comment"].Value |> int|}
58
+ else
59
+ None
60
+ | _ -> None
61
+
62
+ // Define the active pattern
63
+ let (|SequenceMinusOpener|_|) (input: PreprocessorElement) =
64
+ match input with
65
+ | Line s ->
66
+ let m = Regex.Match(s, SequenceMinusPattern)
67
+ if m.Success then
68
+ let v: string option =
69
+ let v = m.Groups.["value"].Value.Trim()
70
+ if v = "" then None else Some v
71
+ Some {| Value = v |}
72
+ else
73
+ None
74
+ | _ -> None
75
+
76
+ let (|InlineSequence|_|) (input: PreprocessorElement) =
77
+ match input with
78
+ | Line s ->
79
+ let m = Regex.Match(s, InlineSequencePattern)
80
+ if m.Success then
81
+ let comment: int option =
82
+ let v = m.Groups.["comment"].Value
83
+ if v = "" then None else Some (int v)
84
+ let v: string =
85
+ m.Groups.["inlineSequence"].Value
86
+ Some {| Comment = comment; Value = v|}
87
+ else
88
+ None
89
+ | _ -> None
90
+
91
+ let (|SequenceSquareOpener|_|) (input: PreprocessorElement) =
92
+ match input with
93
+ | Line s ->
94
+ let m = Regex.Match(s, SequenceOpenerPattern)
95
+ if m.Success then
96
+ let comment: int option =
97
+ let v = m.Groups.["comment"].Value
98
+ if v = "" then None else Some (int v)
99
+ Some {| Comment = comment|}
100
+ else
101
+ None
102
+ | _ -> None
103
+
104
+ let (|SequenceSquareCloser|_|) (input: PreprocessorElement) =
105
+ match input with
106
+ | Line s ->
107
+ let m = Regex.Match(s, SequenceCloserPattern)
108
+ if m.Success then
109
+ let comment: int option =
110
+ let v = m.Groups.["comment"].Value
111
+ if v = "" then None else Some (int v)
112
+ Some {| Comment = comment|}
113
+ else
114
+ None
115
+ | _ -> None
116
+
117
+ let (|InlineJSON|_|) (input: PreprocessorElement) =
118
+ match input with
119
+ | Line s ->
120
+ let m = Regex.Match(s, InlineJSONPattern)
121
+ if m.Success then
122
+ let comment: int option =
123
+ let v = m.Groups.["comment"].Value
124
+ if v = "" then None else Some (int v)
125
+ let v: string =
126
+ m.Groups.["inlineSequence"].Value
127
+ Some {| Comment = comment; Value = v|}
128
+ else
129
+ None
130
+ | _ -> None
131
+
132
+ let (|JSONKeyOpener|_|) (input: PreprocessorElement) =
133
+ match input with
134
+ | Line s ->
135
+ let m = Regex.Match(s, JSONOpenerPattern)
136
+ if m.Success then
137
+ let comment: int option =
138
+ let v = m.Groups.["comment"].Value
139
+ if v = "" then None else Some (int v)
140
+ Some {| Key = m.Groups.["key"].Value; Comment = comment|}
141
+ else
142
+ None
143
+ | _ -> None
144
+
145
+ let (|JSONCloser|_|) (input: PreprocessorElement) =
146
+ match input with
147
+ | Line s ->
148
+ let m = Regex.Match(s, JSONCloserPattern)
149
+ if m.Success then
150
+ let comment: int option =
151
+ let v = m.Groups.["comment"].Value
152
+ if v = "" then None else Some (int v)
153
+ Some {| Comment = comment|}
154
+ else
155
+ None
156
+ | _ -> None
157
+
158
+ let (|SchemaNamespace|_|) (input: PreprocessorElement) =
159
+ match input with
160
+ | Line s ->
161
+ let m = Regex.Match(s, SchemaNamespacePattern)
162
+ if m.Success then
163
+ Some {| Key = m.Groups.["key"].Value|}
164
+ else
165
+ None
166
+ | _ -> None
@@ -0,0 +1,225 @@
1
+ import { create, match } from "../fable-library-js.4.16.0/RegExp.js";
2
+ import { JSONCloserPattern, JSONOpenerPattern, InlineJSONPattern, SequenceCloserPattern, SequenceOpenerPattern, InlineSequencePattern, LineCommentPattern, ValuePattern, KeyPattern } from "./Regex.fs.js";
3
+ import { unwrap } from "../fable-library-js.4.16.0/Option.js";
4
+ import { parse } from "../fable-library-js.4.16.0/Int32.js";
5
+
6
+ export function $007CKey$007C_$007C(input) {
7
+ let v;
8
+ if (input.tag === 2) {
9
+ const m = match(create(KeyPattern), input.fields[0]);
10
+ if (m != null) {
11
+ return {
12
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
13
+ Key: (m.groups && m.groups.key) || "",
14
+ };
15
+ }
16
+ else {
17
+ return void 0;
18
+ }
19
+ }
20
+ else {
21
+ return void 0;
22
+ }
23
+ }
24
+
25
+ export function $007CKeyValue$007C_$007C(input) {
26
+ if (input.tag === 2) {
27
+ const m = match(/^(?<key>[^\{{\[]+):\s+(?<value>(.*))$/gu, input.fields[0]);
28
+ if (m != null) {
29
+ const v = ((m.groups && m.groups.value) || "").trim();
30
+ return {
31
+ Key: (m.groups && m.groups.key) || "",
32
+ Value: v,
33
+ };
34
+ }
35
+ else {
36
+ return void 0;
37
+ }
38
+ }
39
+ else {
40
+ return void 0;
41
+ }
42
+ }
43
+
44
+ export function $007CYamlValue$007C_$007C(input) {
45
+ let v;
46
+ if (input.tag === 2) {
47
+ const m = match(create(ValuePattern), input.fields[0]);
48
+ if (m != null) {
49
+ return {
50
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
51
+ Value: ((m.groups && m.groups.value) || "").trim(),
52
+ };
53
+ }
54
+ else {
55
+ return void 0;
56
+ }
57
+ }
58
+ else {
59
+ return void 0;
60
+ }
61
+ }
62
+
63
+ export function $007CYamlComment$007C_$007C(input) {
64
+ if (input.tag === 2) {
65
+ const m = match(create(LineCommentPattern), input.fields[0]);
66
+ if (m != null) {
67
+ return {
68
+ Comment: parse((m.groups && m.groups.comment) || "", 511, false, 32),
69
+ };
70
+ }
71
+ else {
72
+ return void 0;
73
+ }
74
+ }
75
+ else {
76
+ return void 0;
77
+ }
78
+ }
79
+
80
+ export function $007CSequenceMinusOpener$007C_$007C(input) {
81
+ let v;
82
+ if (input.tag === 2) {
83
+ const m = match(/^-(\s+(?<value>.*))?$/gu, input.fields[0]);
84
+ if (m != null) {
85
+ return {
86
+ Value: unwrap((v = ((m.groups && m.groups.value) || "").trim(), (v === "") ? void 0 : v)),
87
+ };
88
+ }
89
+ else {
90
+ return void 0;
91
+ }
92
+ }
93
+ else {
94
+ return void 0;
95
+ }
96
+ }
97
+
98
+ export function $007CInlineSequence$007C_$007C(input) {
99
+ let v;
100
+ if (input.tag === 2) {
101
+ const m = match(create(InlineSequencePattern), input.fields[0]);
102
+ if (m != null) {
103
+ return {
104
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
105
+ Value: (m.groups && m.groups.inlineSequence) || "",
106
+ };
107
+ }
108
+ else {
109
+ return void 0;
110
+ }
111
+ }
112
+ else {
113
+ return void 0;
114
+ }
115
+ }
116
+
117
+ export function $007CSequenceSquareOpener$007C_$007C(input) {
118
+ let v;
119
+ if (input.tag === 2) {
120
+ const m = match(create(SequenceOpenerPattern), input.fields[0]);
121
+ if (m != null) {
122
+ return {
123
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
124
+ };
125
+ }
126
+ else {
127
+ return void 0;
128
+ }
129
+ }
130
+ else {
131
+ return void 0;
132
+ }
133
+ }
134
+
135
+ export function $007CSequenceSquareCloser$007C_$007C(input) {
136
+ let v;
137
+ if (input.tag === 2) {
138
+ const m = match(create(SequenceCloserPattern), input.fields[0]);
139
+ if (m != null) {
140
+ return {
141
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
142
+ };
143
+ }
144
+ else {
145
+ return void 0;
146
+ }
147
+ }
148
+ else {
149
+ return void 0;
150
+ }
151
+ }
152
+
153
+ export function $007CInlineJSON$007C_$007C(input) {
154
+ let v;
155
+ if (input.tag === 2) {
156
+ const m = match(create(InlineJSONPattern), input.fields[0]);
157
+ if (m != null) {
158
+ return {
159
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
160
+ Value: (m.groups && m.groups.inlineSequence) || "",
161
+ };
162
+ }
163
+ else {
164
+ return void 0;
165
+ }
166
+ }
167
+ else {
168
+ return void 0;
169
+ }
170
+ }
171
+
172
+ export function $007CJSONKeyOpener$007C_$007C(input) {
173
+ let v;
174
+ if (input.tag === 2) {
175
+ const m = match(create(JSONOpenerPattern), input.fields[0]);
176
+ if (m != null) {
177
+ return {
178
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
179
+ Key: (m.groups && m.groups.key) || "",
180
+ };
181
+ }
182
+ else {
183
+ return void 0;
184
+ }
185
+ }
186
+ else {
187
+ return void 0;
188
+ }
189
+ }
190
+
191
+ export function $007CJSONCloser$007C_$007C(input) {
192
+ let v;
193
+ if (input.tag === 2) {
194
+ const m = match(create(JSONCloserPattern), input.fields[0]);
195
+ if (m != null) {
196
+ return {
197
+ Comment: unwrap((v = ((m.groups && m.groups.comment) || ""), (v === "") ? void 0 : parse(v, 511, false, 32))),
198
+ };
199
+ }
200
+ else {
201
+ return void 0;
202
+ }
203
+ }
204
+ else {
205
+ return void 0;
206
+ }
207
+ }
208
+
209
+ export function $007CSchemaNamespace$007C_$007C(input) {
210
+ if (input.tag === 2) {
211
+ const m = match(/^\$(?<key>[a-zA-Z0-9\s:]+):$/gu, input.fields[0]);
212
+ if (m != null) {
213
+ return {
214
+ Key: (m.groups && m.groups.key) || "",
215
+ };
216
+ }
217
+ else {
218
+ return void 0;
219
+ }
220
+ }
221
+ else {
222
+ return void 0;
223
+ }
224
+ }
225
+
@@ -0,0 +1,84 @@
1
+ module YAMLicious.Writer
2
+
3
+ open YAMLicious.YAMLiciousTypes
4
+
5
+ module StyleVerifier =
6
+
7
+ let checkInlineSequence (ele: YAMLElement list) =
8
+ ele
9
+ |> Seq.forall (fun x ->
10
+ match x with
11
+ | YAMLElement.Value {Value = v; Comment = None} ->
12
+ true
13
+ | _ -> false
14
+ )
15
+
16
+ module Formatting =
17
+
18
+ let mkComment (comment: string) = "#" + comment
19
+ let mkKey (key: string) = key + ":"
20
+ let mkContent (content: YAMLContent) = content.Value + (content.Comment |> Option.map (fun s -> " " + (mkComment s)) |> Option.defaultValue "")
21
+ let mkInlineSequence (seq: YAMLElement list) =
22
+ let content =
23
+ seq
24
+ |> List.map (fun x ->
25
+ match x with
26
+ | YAMLElement.Value {Value = v; Comment = None} -> v
27
+ | _ -> failwith "Invalid sequence element"
28
+ )
29
+ |> String.concat ", "
30
+ "[" + content + "]"
31
+ let mkMinusLine (c: string) = "- " + c
32
+
33
+ let detokenize (ele: YAMLElement) =
34
+ let rec loop (ele: YAMLElement) =
35
+ match ele with
36
+ | YAMLElement.Nil ->
37
+ PreprocessorElement.Nil
38
+ | YAMLElement.Mapping (key, v) ->
39
+ match v with
40
+ | YAMLElement.Value v -> // mykey: myvalue # 12313
41
+ let s = Formatting.mkKey key.Value + " " + Formatting.mkContent v
42
+ PreprocessorElement.Line s
43
+ | YAMLElement.Sequence seq when StyleVerifier.checkInlineSequence seq -> // mykey: [v1, v2, v3]
44
+ let s = Formatting.mkKey key.Value + " " + Formatting.mkInlineSequence seq
45
+ PreprocessorElement.Line s
46
+ | anyElse ->
47
+ PreprocessorElement.Level [
48
+ PreprocessorElement.Line (Formatting.mkKey (Formatting.mkContent key))
49
+ PreprocessorElement.Intendation [
50
+ loop anyElse
51
+ ]
52
+ ]
53
+ | YAMLElement.Value (v) ->
54
+ PreprocessorElement.Line (Formatting.mkContent v)
55
+ | YAMLElement.Object seq ->
56
+ PreprocessorElement.Level [
57
+ for ele in seq do
58
+ loop ele
59
+ ]
60
+ | YAMLElement.Sequence seq ->
61
+ PreprocessorElement.Level [
62
+ for ele in seq do
63
+ match ele with
64
+ | YAMLElement.Value v -> // mykey: myvalue # 12313
65
+ let s = Formatting.mkMinusLine (Formatting.mkContent v)
66
+ PreprocessorElement.Line s
67
+ | YAMLElement.Sequence seq when StyleVerifier.checkInlineSequence seq -> // - [v1, v2, v3]
68
+ let s = Formatting.mkMinusLine (Formatting.mkInlineSequence seq)
69
+ PreprocessorElement.Line s
70
+ | anyElse ->
71
+ PreprocessorElement.Level [
72
+ PreprocessorElement.Line "-"
73
+ PreprocessorElement.Intendation [
74
+ loop anyElse
75
+ ]
76
+ ]
77
+ ]
78
+ | YAMLElement.Comment (c) ->
79
+ PreprocessorElement.Line (Formatting.mkComment c)
80
+ loop ele
81
+
82
+ let write (ele: YAMLElement) (fconfig: (Config -> Config) option) =
83
+ let preprocessed = detokenize ele
84
+ Preprocessing.write (preprocessed, fconfig)
@@ -0,0 +1,161 @@
1
+ import { singleton as singleton_1, collect, map as map_2, delay, toList, forAll } from "../fable-library-js.4.16.0/Seq.js";
2
+ import { map, defaultArg } from "../fable-library-js.4.16.0/Option.js";
3
+ import { join } from "../fable-library-js.4.16.0/String.js";
4
+ import { ofArray, singleton, map as map_1 } from "../fable-library-js.4.16.0/List.js";
5
+ import { PreprocessorElement } from "./YAMLiciousTypes.fs.js";
6
+ import { write as write_1 } from "./Preprocessing.fs.js";
7
+
8
+ export function StyleVerifier_checkInlineSequence(ele) {
9
+ return forAll((x) => {
10
+ let matchResult, v;
11
+ if (x.tag === 1) {
12
+ if (x.fields[0].Comment == null) {
13
+ matchResult = 0;
14
+ v = x.fields[0].Value;
15
+ }
16
+ else {
17
+ matchResult = 1;
18
+ }
19
+ }
20
+ else {
21
+ matchResult = 1;
22
+ }
23
+ switch (matchResult) {
24
+ case 0:
25
+ return true;
26
+ default:
27
+ return false;
28
+ }
29
+ }, ele);
30
+ }
31
+
32
+ export function Formatting_mkComment(comment) {
33
+ return "#" + comment;
34
+ }
35
+
36
+ export function Formatting_mkKey(key) {
37
+ return key + ":";
38
+ }
39
+
40
+ export function Formatting_mkContent(content) {
41
+ return content.Value + defaultArg(map((s) => (" " + Formatting_mkComment(s)), content.Comment), "");
42
+ }
43
+
44
+ export function Formatting_mkInlineSequence(seq) {
45
+ return ("[" + join(", ", map_1((x) => {
46
+ let matchResult, v;
47
+ if (x.tag === 1) {
48
+ if (x.fields[0].Comment == null) {
49
+ matchResult = 0;
50
+ v = x.fields[0].Value;
51
+ }
52
+ else {
53
+ matchResult = 1;
54
+ }
55
+ }
56
+ else {
57
+ matchResult = 1;
58
+ }
59
+ switch (matchResult) {
60
+ case 0:
61
+ return v;
62
+ default:
63
+ throw new Error("Invalid sequence element");
64
+ }
65
+ }, seq))) + "]";
66
+ }
67
+
68
+ export function Formatting_mkMinusLine(c) {
69
+ return "- " + c;
70
+ }
71
+
72
+ export function detokenize(ele) {
73
+ const loop = (ele_1) => {
74
+ switch (ele_1.tag) {
75
+ case 0: {
76
+ const v = ele_1.fields[1];
77
+ const key = ele_1.fields[0];
78
+ let matchResult, v_1, seq_1, anyElse;
79
+ switch (v.tag) {
80
+ case 1: {
81
+ matchResult = 0;
82
+ v_1 = v.fields[0];
83
+ break;
84
+ }
85
+ case 2: {
86
+ if (StyleVerifier_checkInlineSequence(v.fields[0])) {
87
+ matchResult = 1;
88
+ seq_1 = v.fields[0];
89
+ }
90
+ else {
91
+ matchResult = 2;
92
+ anyElse = v;
93
+ }
94
+ break;
95
+ }
96
+ default: {
97
+ matchResult = 2;
98
+ anyElse = v;
99
+ }
100
+ }
101
+ switch (matchResult) {
102
+ case 0:
103
+ return new PreprocessorElement(2, [(Formatting_mkKey(key.Value) + " ") + Formatting_mkContent(v_1)]);
104
+ case 1:
105
+ return new PreprocessorElement(2, [(Formatting_mkKey(key.Value) + " ") + Formatting_mkInlineSequence(seq_1)]);
106
+ default:
107
+ return new PreprocessorElement(0, [ofArray([new PreprocessorElement(2, [Formatting_mkKey(Formatting_mkContent(key))]), new PreprocessorElement(1, [singleton(loop(anyElse))])])]);
108
+ }
109
+ }
110
+ case 1:
111
+ return new PreprocessorElement(2, [Formatting_mkContent(ele_1.fields[0])]);
112
+ case 3:
113
+ return new PreprocessorElement(0, [toList(delay(() => map_2(loop, ele_1.fields[0])))]);
114
+ case 2:
115
+ return new PreprocessorElement(0, [toList(delay(() => collect((ele_3) => {
116
+ const matchValue = ele_3;
117
+ let matchResult_1, v_3, seq_5, anyElse_1;
118
+ switch (matchValue.tag) {
119
+ case 1: {
120
+ matchResult_1 = 0;
121
+ v_3 = matchValue.fields[0];
122
+ break;
123
+ }
124
+ case 2: {
125
+ if (StyleVerifier_checkInlineSequence(matchValue.fields[0])) {
126
+ matchResult_1 = 1;
127
+ seq_5 = matchValue.fields[0];
128
+ }
129
+ else {
130
+ matchResult_1 = 2;
131
+ anyElse_1 = matchValue;
132
+ }
133
+ break;
134
+ }
135
+ default: {
136
+ matchResult_1 = 2;
137
+ anyElse_1 = matchValue;
138
+ }
139
+ }
140
+ switch (matchResult_1) {
141
+ case 0:
142
+ return singleton_1(new PreprocessorElement(2, [Formatting_mkMinusLine(Formatting_mkContent(v_3))]));
143
+ case 1:
144
+ return singleton_1(new PreprocessorElement(2, [Formatting_mkMinusLine(Formatting_mkInlineSequence(seq_5))]));
145
+ default:
146
+ return singleton_1(new PreprocessorElement(0, [ofArray([new PreprocessorElement(2, ["-"]), new PreprocessorElement(1, [singleton(loop(anyElse_1))])])]));
147
+ }
148
+ }, ele_1.fields[0])))]);
149
+ case 4:
150
+ return new PreprocessorElement(2, [Formatting_mkComment(ele_1.fields[0])]);
151
+ default:
152
+ return new PreprocessorElement(3, []);
153
+ }
154
+ };
155
+ return loop(ele);
156
+ }
157
+
158
+ export function write(ele, fconfig) {
159
+ return write_1(detokenize(ele), fconfig);
160
+ }
161
+
@@ -0,0 +1,39 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <Authors>Caroline Ott, Kevin Frey</Authors>
5
+ <Description>A encoder/decoder based YAML parser in Thoth.Json style!</Description>
6
+ <TargetFramework>netstandard2.0</TargetFramework>
7
+ <PackageLicenseExpression>MIT</PackageLicenseExpression>
8
+ <PackageTags>f# fsharp fable fable-library fable-javascript fable-python yaml parser</PackageTags>
9
+ <PackageProjectUrl>https://github.com/CSBiology/YAMLicious</PackageProjectUrl>
10
+ <RepositoryUrl>https://github.com/CSBiology/YAMLicious</RepositoryUrl>
11
+ <RepositoryType>git</RepositoryType>
12
+ <PackageReadmeFile>README.md</PackageReadmeFile>
13
+ </PropertyGroup>
14
+
15
+ <ItemGroup>
16
+ <Content Include="*.fsproj; **\*.fs; **\*.fsi" PackagePath="fable\" />
17
+ <None Include="..\..\README.md" Pack="true" PackagePath="\"/>
18
+ </ItemGroup>
19
+
20
+ <ItemGroup>
21
+ <Compile Include="Interop\PyInterop.fs" />
22
+ <Compile Include="Interop\JsInterop.fs" />
23
+ <Compile Include="YAMLiciousTypes.fs" />
24
+ <Compile Include="Persil.fs" />
25
+ <Compile Include="Preprocessing.fs" />
26
+ <Compile Include="Regex.fs" />
27
+ <Compile Include="RegexActivePatterns.fs" />
28
+ <Compile Include="Reader.fs" />
29
+ <Compile Include="Writer.fs" />
30
+ <Compile Include="Encode.fs" />
31
+ <Compile Include="Decode.fs" />
32
+ <Compile Include="Library.fs" />
33
+ </ItemGroup>
34
+
35
+ <ItemGroup>
36
+ <PackageReference Include="Fable.Core" Version="4.3.0" />
37
+ </ItemGroup>
38
+
39
+ </Project>