@rsconcept/domain 1.0.0 → 1.1.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/README.md +3 -3
- package/dist/analyzer-DlSq3Y3r.d.ts +39 -0
- package/dist/arguments-extractor-1acwjQNc.d.ts +38 -0
- package/dist/ast-C8sIpKdL.d.ts +51 -0
- package/dist/ast-annotations-BiMjkKvz.d.ts +16 -0
- package/dist/branded-ZlzIcxzu.d.ts +9 -0
- package/dist/calculator-C9W2jkSx.d.ts +39 -0
- package/dist/cctext/index.d.ts +2 -1
- package/dist/cctext/index.js +2 -42
- package/dist/cctext/language-api.d.ts +10 -12
- package/dist/cctext/language-api.js +157 -227
- package/dist/cctext/language-api.js.map +1 -1
- package/dist/cctext/language.d.ts +24 -22
- package/dist/cctext/language.js +43 -39
- package/dist/cctext/language.js.map +1 -1
- package/dist/error-E1LVq_3w.d.ts +87 -0
- package/dist/graph/graph.d.ts +2 -62
- package/dist/graph/graph.js +339 -382
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/index.d.ts +2 -1
- package/dist/graph/index.js +2 -384
- package/dist/graph-DR8rL2o3.d.ts +64 -0
- package/dist/hash-Y8I4c6Al.d.ts +8 -0
- package/dist/index-BKZ67WMa.d.ts +1 -0
- package/dist/index-BVVgDSdq.d.ts +1 -0
- package/dist/index-DmtQKWjk.d.ts +1 -0
- package/dist/index-_6s0AX1B.d.ts +1 -0
- package/dist/index.d.ts +27 -28
- package/dist/index.js +23 -5851
- package/dist/lezer-tree-iS7LpLBJ.d.ts +14 -0
- package/dist/library/folder-tree.d.ts +22 -20
- package/dist/library/folder-tree.js +108 -130
- package/dist/library/folder-tree.js.map +1 -1
- package/dist/library/index.d.ts +8 -17
- package/dist/library/index.js +7 -2800
- package/dist/library/library-api.d.ts +3 -1
- package/dist/library/library-api.js +9 -8
- package/dist/library/library-api.js.map +1 -1
- package/dist/library/library.d.ts +2 -56
- package/dist/library/library.js +23 -19
- package/dist/library/library.js.map +1 -1
- package/dist/library/oss-api.d.ts +26 -37
- package/dist/library/oss-api.js +257 -1096
- package/dist/library/oss-api.js.map +1 -1
- package/dist/library/oss-layout-api.d.ts +28 -28
- package/dist/library/oss-layout-api.js +239 -316
- package/dist/library/oss-layout-api.js.map +1 -1
- package/dist/library/oss-layout.d.ts +2 -25
- package/dist/library/oss-layout.js +1 -1
- package/dist/library/oss.d.ts +87 -89
- package/dist/library/oss.js +27 -26
- package/dist/library/oss.js.map +1 -1
- package/dist/library/rsengine.d.ts +100 -106
- package/dist/library/rsengine.js +439 -2599
- package/dist/library/rsengine.js.map +1 -1
- package/dist/library/rsform-api.d.ts +11 -16
- package/dist/library/rsform-api.js +313 -825
- package/dist/library/rsform-api.js.map +1 -1
- package/dist/library/rsform.d.ts +159 -167
- package/dist/library/rsform.js +29 -28
- package/dist/library/rsform.js.map +1 -1
- package/dist/library/rsmodel-api.d.ts +8 -15
- package/dist/library/rsmodel-api.js +172 -813
- package/dist/library/rsmodel-api.js.map +1 -1
- package/dist/library/rsmodel.d.ts +27 -33
- package/dist/library/rsmodel.js +16 -23
- package/dist/library/rsmodel.js.map +1 -1
- package/dist/library/structure-planner.d.ts +20 -26
- package/dist/library/structure-planner.js +106 -474
- package/dist/library/structure-planner.js.map +1 -1
- package/dist/library-CYun28Xz.d.ts +58 -0
- package/dist/oss-layout-3glgAqfn.d.ts +27 -0
- package/dist/parser-Bwd8LxJ1.d.ts +7 -0
- package/dist/parsing/ast.d.ts +2 -49
- package/dist/parsing/ast.js +68 -76
- package/dist/parsing/ast.js.map +1 -1
- package/dist/parsing/index.d.ts +3 -3
- package/dist/parsing/index.js +3 -141
- package/dist/parsing/lezer-tree.d.ts +2 -13
- package/dist/parsing/lezer-tree.js +50 -43
- package/dist/parsing/lezer-tree.js.map +1 -1
- package/dist/rslang/api.d.ts +9 -14
- package/dist/rslang/api.js +114 -827
- package/dist/rslang/api.js.map +1 -1
- package/dist/rslang/ast-annotations.d.ts +2 -18
- package/dist/rslang/ast-annotations.js +34 -45
- package/dist/rslang/ast-annotations.js.map +1 -1
- package/dist/rslang/error.d.ts +2 -85
- package/dist/rslang/error.js +88 -150
- package/dist/rslang/error.js.map +1 -1
- package/dist/rslang/eval/calculator.d.ts +2 -43
- package/dist/rslang/eval/calculator.js +81 -1636
- package/dist/rslang/eval/calculator.js.map +1 -1
- package/dist/rslang/eval/evaluation-cache.d.ts +22 -26
- package/dist/rslang/eval/evaluation-cache.js +168 -287
- package/dist/rslang/eval/evaluation-cache.js.map +1 -1
- package/dist/rslang/eval/evaluator.d.ts +59 -63
- package/dist/rslang/eval/evaluator.js +602 -1509
- package/dist/rslang/eval/evaluator.js.map +1 -1
- package/dist/rslang/eval/value-api.d.ts +2 -48
- package/dist/rslang/eval/value-api.js +2 -490
- package/dist/rslang/eval/value.d.ts +2 -36
- package/dist/rslang/eval/value.js +2 -118
- package/dist/rslang/index.d.ts +14 -17
- package/dist/rslang/index.js +12 -4314
- package/dist/rslang/labels.d.ts +6 -6
- package/dist/rslang/labels.js +139 -305
- package/dist/rslang/labels.js.map +1 -1
- package/dist/rslang/parser/expression-generator.d.ts +5 -5
- package/dist/rslang/parser/expression-generator.js +248 -446
- package/dist/rslang/parser/expression-generator.js.map +1 -1
- package/dist/rslang/parser/normalize.d.ts +4 -8
- package/dist/rslang/parser/normalize.js +286 -481
- package/dist/rslang/parser/normalize.js.map +1 -1
- package/dist/rslang/parser/parser.d.ts +2 -5
- package/dist/rslang/parser/parser.js +30 -21
- package/dist/rslang/parser/parser.js.map +1 -1
- package/dist/rslang/parser/parser.terms.d.ts +43 -41
- package/dist/rslang/parser/parser.terms.js +44 -83
- package/dist/rslang/parser/parser.terms.js.map +1 -1
- package/dist/rslang/parser/syntax-errors.d.ts +5 -8
- package/dist/rslang/parser/syntax-errors.js +113 -382
- package/dist/rslang/parser/syntax-errors.js.map +1 -1
- package/dist/rslang/parser/token.d.ts +2 -79
- package/dist/rslang/parser/token.js +81 -93
- package/dist/rslang/parser/token.js.map +1 -1
- package/dist/rslang/semantic/analyzer.d.ts +2 -39
- package/dist/rslang/semantic/analyzer.js +186 -2600
- package/dist/rslang/semantic/analyzer.js.map +1 -1
- package/dist/rslang/semantic/arguments-extractor.d.ts +2 -42
- package/dist/rslang/semantic/arguments-extractor.js +202 -361
- package/dist/rslang/semantic/arguments-extractor.js.map +1 -1
- package/dist/rslang/semantic/type-auditor.d.ts +64 -68
- package/dist/rslang/semantic/type-auditor.js +594 -1564
- package/dist/rslang/semantic/type-auditor.js.map +1 -1
- package/dist/rslang/semantic/typification-api.d.ts +4 -7
- package/dist/rslang/semantic/typification-api.js +162 -303
- package/dist/rslang/semantic/typification-api.js.map +1 -1
- package/dist/rslang/semantic/typification-parser.d.ts +2 -12
- package/dist/rslang/semantic/typification-parser.js +165 -219
- package/dist/rslang/semantic/typification-parser.js.map +1 -1
- package/dist/rslang/semantic/typification.d.ts +2 -119
- package/dist/rslang/semantic/typification.js +66 -52
- package/dist/rslang/semantic/typification.js.map +1 -1
- package/dist/rslang/semantic/value-auditor.d.ts +32 -38
- package/dist/rslang/semantic/value-auditor.js +206 -518
- package/dist/rslang/semantic/value-auditor.js.map +1 -1
- package/dist/rslang/semantic/value-class.d.ts +2 -10
- package/dist/rslang/semantic/value-class.js +8 -7
- package/dist/rslang/semantic/value-class.js.map +1 -1
- package/dist/rslang/typification-graph.d.ts +2 -33
- package/dist/rslang/typification-graph.js +94 -306
- package/dist/rslang/typification-graph.js.map +1 -1
- package/dist/shared/branded.d.ts +2 -7
- package/dist/shared/branded.js +1 -1
- package/dist/shared/hash.d.ts +2 -6
- package/dist/shared/hash.js +13 -13
- package/dist/shared/hash.js.map +1 -1
- package/dist/shared/index.d.ts +3 -2
- package/dist/shared/index.js +2 -18
- package/dist/token-DeXAmzwr.d.ts +81 -0
- package/dist/typification-Dk-fisgO.d.ts +120 -0
- package/dist/typification-graph-6HcZ-rKH.d.ts +30 -0
- package/dist/typification-parser-BBVx1RxP.d.ts +13 -0
- package/dist/value-B8UtCqaK.js +366 -0
- package/dist/value-B8UtCqaK.js.map +1 -0
- package/dist/value-CTjX6825.d.ts +33 -0
- package/dist/value-api-Bw-SgaYY.d.ts +49 -0
- package/dist/value-class-CNI-lqXJ.d.ts +12 -0
- package/package.json +8 -8
- package/src/library/rsform-api.test.ts +24 -0
- package/src/library/rsform-api.ts +12 -4
- package/dist/cctext/index.js.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/index.js.map +0 -1
- package/dist/library/oss-layout.js.map +0 -1
- package/dist/parsing/index.js.map +0 -1
- package/dist/rslang/eval/value-api.js.map +0 -1
- package/dist/rslang/eval/value.js.map +0 -1
- package/dist/rslang/index.js.map +0 -1
- package/dist/shared/branded.js.map +0 -1
- package/dist/shared/index.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeType, Tree, TreeCursor } from "@lezer/common";
|
|
2
|
+
|
|
3
|
+
//#region src/parsing/lezer-tree.d.ts
|
|
4
|
+
/** Represents syntax tree node data. */
|
|
5
|
+
interface CMSyntaxNode {
|
|
6
|
+
type: NodeType;
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
}
|
|
10
|
+
/** Prints tree to compact string. */
|
|
11
|
+
declare function printTree(tree: Tree): string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TreeCursor as n, printTree as r, CMSyntaxNode as t };
|
|
14
|
+
//# sourceMappingURL=lezer-tree-iS7LpLBJ.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/library/folder-tree.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Module: Folder tree data structure. Does not support deletions.
|
|
3
4
|
*/
|
|
@@ -5,28 +6,29 @@
|
|
|
5
6
|
* Represents single node of a {@link FolderTree}.
|
|
6
7
|
*/
|
|
7
8
|
declare class FolderNode {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
rank: number;
|
|
10
|
+
text: string;
|
|
11
|
+
children: Map<string, FolderNode>;
|
|
12
|
+
parent: FolderNode | null;
|
|
13
|
+
filesInside: number;
|
|
14
|
+
filesTotal: number;
|
|
15
|
+
constructor(text: string, parent?: FolderNode | null);
|
|
16
|
+
addChild(text: string): FolderNode;
|
|
17
|
+
hasPredecessor(target: FolderNode): boolean;
|
|
18
|
+
incrementFiles(count?: number): void;
|
|
19
|
+
incrementTotal(count?: number): void;
|
|
20
|
+
getPath(): string;
|
|
20
21
|
}
|
|
21
22
|
/** Represents a FolderTree. */
|
|
22
23
|
declare class FolderTree {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
roots: Map<string, FolderNode>;
|
|
25
|
+
constructor(arr?: string[]);
|
|
26
|
+
at(path: string): FolderNode | undefined;
|
|
27
|
+
getTree(): FolderNode[];
|
|
28
|
+
private visitNode;
|
|
29
|
+
addPath(path: string, filesCount?: number): FolderNode;
|
|
30
|
+
private addNode;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
//#endregion
|
|
32
33
|
export { FolderNode, FolderTree };
|
|
34
|
+
//# sourceMappingURL=folder-tree.d.ts.map
|
|
@@ -1,136 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!this.parent) {
|
|
50
|
-
return suffix;
|
|
51
|
-
} else {
|
|
52
|
-
return this.parent.getPath() + suffix;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
//#region src/library/folder-tree.ts
|
|
2
|
+
/**
|
|
3
|
+
* Module: Folder tree data structure. Does not support deletions.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents single node of a {@link FolderTree}.
|
|
7
|
+
*/
|
|
8
|
+
var FolderNode = class FolderNode {
|
|
9
|
+
rank = 0;
|
|
10
|
+
text;
|
|
11
|
+
children;
|
|
12
|
+
parent;
|
|
13
|
+
filesInside = 0;
|
|
14
|
+
filesTotal = 0;
|
|
15
|
+
constructor(text, parent = null) {
|
|
16
|
+
this.text = text;
|
|
17
|
+
this.parent = parent;
|
|
18
|
+
this.children = /* @__PURE__ */ new Map();
|
|
19
|
+
if (parent) this.rank = parent.rank + 1;
|
|
20
|
+
}
|
|
21
|
+
addChild(text) {
|
|
22
|
+
const node = new FolderNode(text, this);
|
|
23
|
+
this.children.set(text, node);
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
hasPredecessor(target) {
|
|
27
|
+
if (this.parent === target) return true;
|
|
28
|
+
else if (!this.parent) return false;
|
|
29
|
+
let node = this.parent;
|
|
30
|
+
while (node.parent) {
|
|
31
|
+
if (node.parent === target) return true;
|
|
32
|
+
node = node.parent;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
incrementFiles(count = 1) {
|
|
37
|
+
this.filesInside = this.filesInside + count;
|
|
38
|
+
this.incrementTotal(count);
|
|
39
|
+
}
|
|
40
|
+
incrementTotal(count = 1) {
|
|
41
|
+
this.filesTotal = this.filesTotal + count;
|
|
42
|
+
if (this.parent) this.parent.incrementTotal(count);
|
|
43
|
+
}
|
|
44
|
+
getPath() {
|
|
45
|
+
const suffix = this.text ? `/${this.text}` : "";
|
|
46
|
+
if (!this.parent) return suffix;
|
|
47
|
+
else return this.parent.getPath() + suffix;
|
|
48
|
+
}
|
|
55
49
|
};
|
|
50
|
+
/** Represents a FolderTree. */
|
|
56
51
|
var FolderTree = class {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return node;
|
|
101
|
-
}
|
|
102
|
-
addNode(text, parent) {
|
|
103
|
-
if (!parent) {
|
|
104
|
-
const newNode = new FolderNode(text);
|
|
105
|
-
this.roots.set(text, newNode);
|
|
106
|
-
return newNode;
|
|
107
|
-
} else {
|
|
108
|
-
return parent.addChild(text);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
52
|
+
roots = /* @__PURE__ */ new Map();
|
|
53
|
+
constructor(arr) {
|
|
54
|
+
arr?.forEach((path) => this.addPath(path));
|
|
55
|
+
}
|
|
56
|
+
at(path) {
|
|
57
|
+
let parse = ChopPathHead(path);
|
|
58
|
+
if (!this.roots.has(parse.head)) return;
|
|
59
|
+
let node = this.roots.get(parse.head);
|
|
60
|
+
while (parse.tail !== "") {
|
|
61
|
+
parse = ChopPathHead(parse.tail);
|
|
62
|
+
if (!node.children.has(parse.head)) return;
|
|
63
|
+
node = node.children.get(parse.head);
|
|
64
|
+
}
|
|
65
|
+
return node;
|
|
66
|
+
}
|
|
67
|
+
getTree() {
|
|
68
|
+
const result = [];
|
|
69
|
+
this.roots.forEach((root) => this.visitNode(root, result));
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
visitNode(target, result) {
|
|
73
|
+
result.push(target);
|
|
74
|
+
[...target.children.keys()].sort((a, b) => a.localeCompare(b)).forEach((key) => this.visitNode(target.children.get(key), result));
|
|
75
|
+
}
|
|
76
|
+
addPath(path, filesCount = 1) {
|
|
77
|
+
let parse = ChopPathHead(path);
|
|
78
|
+
if (!parse.head) throw Error(`Invalid path ${path}`);
|
|
79
|
+
let node = this.roots.has(parse.head) ? this.roots.get(parse.head) : this.addNode(parse.head);
|
|
80
|
+
while (parse.tail !== "") {
|
|
81
|
+
parse = ChopPathHead(parse.tail);
|
|
82
|
+
if (node.children.has(parse.head)) node = node.children.get(parse.head);
|
|
83
|
+
else node = this.addNode(parse.head, node);
|
|
84
|
+
}
|
|
85
|
+
node.incrementFiles(filesCount);
|
|
86
|
+
return node;
|
|
87
|
+
}
|
|
88
|
+
addNode(text, parent) {
|
|
89
|
+
if (!parent) {
|
|
90
|
+
const newNode = new FolderNode(text);
|
|
91
|
+
this.roots.set(text, newNode);
|
|
92
|
+
return newNode;
|
|
93
|
+
} else return parent.addChild(text);
|
|
94
|
+
}
|
|
111
95
|
};
|
|
112
96
|
function ChopPathHead(path) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
head: path.substring(1, slash),
|
|
128
|
-
tail: path.substring(slash)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
97
|
+
if (path?.at(0) !== "/") return {
|
|
98
|
+
head: "",
|
|
99
|
+
tail: ""
|
|
100
|
+
};
|
|
101
|
+
const slash = path.indexOf("/", 1);
|
|
102
|
+
if (slash === -1) return {
|
|
103
|
+
head: path.substring(1),
|
|
104
|
+
tail: ""
|
|
105
|
+
};
|
|
106
|
+
else return {
|
|
107
|
+
head: path.substring(1, slash),
|
|
108
|
+
tail: path.substring(slash)
|
|
109
|
+
};
|
|
131
110
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { FolderNode, FolderTree };
|
|
113
|
+
|
|
136
114
|
//# sourceMappingURL=folder-tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/library/folder-tree.ts"],"sourcesContent":["/**\n * Module: Folder tree data structure. Does not support deletions.\n */\n\n/**\n * Represents single node of a {@link FolderTree}.\n */\nexport class FolderNode {\n rank: number = 0;\n text: string;\n children: Map<string, FolderNode>;\n parent: FolderNode | null;\n\n filesInside: number = 0;\n filesTotal: number = 0;\n\n constructor(text: string, parent: FolderNode | null = null) {\n this.text = text;\n this.parent = parent;\n this.children = new Map();\n if (parent) {\n this.rank = parent.rank + 1;\n }\n }\n\n addChild(text: string): FolderNode {\n const node = new FolderNode(text, this);\n this.children.set(text, node);\n return node;\n }\n\n hasPredecessor(target: FolderNode): boolean {\n if (this.parent === target) {\n return true;\n } else if (!this.parent) {\n return false;\n }\n let node = this.parent;\n while (node.parent) {\n if (node.parent === target) {\n return true;\n }\n node = node.parent;\n }\n return false;\n }\n\n incrementFiles(count: number = 1): void {\n this.filesInside = this.filesInside + count;\n this.incrementTotal(count);\n }\n\n incrementTotal(count: number = 1): void {\n this.filesTotal = this.filesTotal + count;\n if (this.parent) {\n this.parent.incrementTotal(count);\n }\n }\n\n getPath(): string {\n const suffix = this.text ? `/${this.text}` : '';\n if (!this.parent) {\n return suffix;\n } else {\n return this.parent.getPath() + suffix;\n }\n }\n}\n\n/** Represents a FolderTree. */\nexport class FolderTree {\n roots = new Map<string, FolderNode>();\n\n constructor(arr?: string[]) {\n arr?.forEach(path => this.addPath(path));\n }\n\n at(path: string): FolderNode | undefined {\n let parse = ChopPathHead(path);\n if (!this.roots.has(parse.head)) {\n return undefined;\n }\n let node = this.roots.get(parse.head)!;\n while (parse.tail !== '') {\n parse = ChopPathHead(parse.tail);\n if (!node.children.has(parse.head)) {\n return undefined;\n }\n node = node.children.get(parse.head)!;\n }\n return node;\n }\n\n getTree(): FolderNode[] {\n const result: FolderNode[] = [];\n this.roots.forEach(root => this.visitNode(root, result));\n return result;\n }\n\n private visitNode(target: FolderNode, result: FolderNode[]) {\n result.push(target);\n [...target.children.keys()]\n .sort((a, b) => a.localeCompare(b))\n .forEach(key => this.visitNode(target.children.get(key)!, result));\n }\n\n addPath(path: string, filesCount: number = 1): FolderNode {\n let parse = ChopPathHead(path);\n if (!parse.head) {\n throw Error(`Invalid path ${path}`);\n }\n let node = this.roots.has(parse.head) ? this.roots.get(parse.head)! : this.addNode(parse.head);\n while (parse.tail !== '') {\n parse = ChopPathHead(parse.tail);\n if (node.children.has(parse.head)) {\n node = node.children.get(parse.head)!;\n } else {\n node = this.addNode(parse.head, node);\n }\n }\n node.incrementFiles(filesCount);\n return node;\n }\n\n private addNode(text: string, parent?: FolderNode): FolderNode {\n if (!parent) {\n const newNode = new FolderNode(text);\n this.roots.set(text, newNode);\n return newNode;\n } else {\n return parent.addChild(text);\n }\n }\n}\n\n// ========= Internals =======\nfunction ChopPathHead(path: string) {\n if (path?.at(0) !== '/') {\n return {\n head: '',\n tail: ''\n };\n }\n const slash = path.indexOf('/', 1);\n if (slash === -1) {\n return {\n head: path.substring(1),\n tail: ''\n };\n } else {\n return {\n head: path.substring(1, slash),\n tail: path.substring(slash)\n };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"folder-tree.js","names":[],"sources":["../../src/library/folder-tree.ts"],"sourcesContent":["/**\n * Module: Folder tree data structure. Does not support deletions.\n */\n\n/**\n * Represents single node of a {@link FolderTree}.\n */\nexport class FolderNode {\n rank: number = 0;\n text: string;\n children: Map<string, FolderNode>;\n parent: FolderNode | null;\n\n filesInside: number = 0;\n filesTotal: number = 0;\n\n constructor(text: string, parent: FolderNode | null = null) {\n this.text = text;\n this.parent = parent;\n this.children = new Map();\n if (parent) {\n this.rank = parent.rank + 1;\n }\n }\n\n addChild(text: string): FolderNode {\n const node = new FolderNode(text, this);\n this.children.set(text, node);\n return node;\n }\n\n hasPredecessor(target: FolderNode): boolean {\n if (this.parent === target) {\n return true;\n } else if (!this.parent) {\n return false;\n }\n let node = this.parent;\n while (node.parent) {\n if (node.parent === target) {\n return true;\n }\n node = node.parent;\n }\n return false;\n }\n\n incrementFiles(count: number = 1): void {\n this.filesInside = this.filesInside + count;\n this.incrementTotal(count);\n }\n\n incrementTotal(count: number = 1): void {\n this.filesTotal = this.filesTotal + count;\n if (this.parent) {\n this.parent.incrementTotal(count);\n }\n }\n\n getPath(): string {\n const suffix = this.text ? `/${this.text}` : '';\n if (!this.parent) {\n return suffix;\n } else {\n return this.parent.getPath() + suffix;\n }\n }\n}\n\n/** Represents a FolderTree. */\nexport class FolderTree {\n roots = new Map<string, FolderNode>();\n\n constructor(arr?: string[]) {\n arr?.forEach(path => this.addPath(path));\n }\n\n at(path: string): FolderNode | undefined {\n let parse = ChopPathHead(path);\n if (!this.roots.has(parse.head)) {\n return undefined;\n }\n let node = this.roots.get(parse.head)!;\n while (parse.tail !== '') {\n parse = ChopPathHead(parse.tail);\n if (!node.children.has(parse.head)) {\n return undefined;\n }\n node = node.children.get(parse.head)!;\n }\n return node;\n }\n\n getTree(): FolderNode[] {\n const result: FolderNode[] = [];\n this.roots.forEach(root => this.visitNode(root, result));\n return result;\n }\n\n private visitNode(target: FolderNode, result: FolderNode[]) {\n result.push(target);\n [...target.children.keys()]\n .sort((a, b) => a.localeCompare(b))\n .forEach(key => this.visitNode(target.children.get(key)!, result));\n }\n\n addPath(path: string, filesCount: number = 1): FolderNode {\n let parse = ChopPathHead(path);\n if (!parse.head) {\n throw Error(`Invalid path ${path}`);\n }\n let node = this.roots.has(parse.head) ? this.roots.get(parse.head)! : this.addNode(parse.head);\n while (parse.tail !== '') {\n parse = ChopPathHead(parse.tail);\n if (node.children.has(parse.head)) {\n node = node.children.get(parse.head)!;\n } else {\n node = this.addNode(parse.head, node);\n }\n }\n node.incrementFiles(filesCount);\n return node;\n }\n\n private addNode(text: string, parent?: FolderNode): FolderNode {\n if (!parent) {\n const newNode = new FolderNode(text);\n this.roots.set(text, newNode);\n return newNode;\n } else {\n return parent.addChild(text);\n }\n }\n}\n\n// ========= Internals =======\nfunction ChopPathHead(path: string) {\n if (path?.at(0) !== '/') {\n return {\n head: '',\n tail: ''\n };\n }\n const slash = path.indexOf('/', 1);\n if (slash === -1) {\n return {\n head: path.substring(1),\n tail: ''\n };\n } else {\n return {\n head: path.substring(1, slash),\n tail: path.substring(slash)\n };\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,aAAb,MAAa,WAAW;CACtB,OAAe;CACf;CACA;CACA;CAEA,cAAsB;CACtB,aAAqB;CAErB,YAAY,MAAc,SAA4B,MAAM;EAC1D,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,2BAAW,IAAI,IAAI;EACxB,IAAI,QACF,KAAK,OAAO,OAAO,OAAO;CAE9B;CAEA,SAAS,MAA0B;EACjC,MAAM,OAAO,IAAI,WAAW,MAAM,IAAI;EACtC,KAAK,SAAS,IAAI,MAAM,IAAI;EAC5B,OAAO;CACT;CAEA,eAAe,QAA6B;EAC1C,IAAI,KAAK,WAAW,QAClB,OAAO;OACF,IAAI,CAAC,KAAK,QACf,OAAO;EAET,IAAI,OA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rslang/eval/calculator.js';
|
|
12
|
-
import '../rslang/error.js';
|
|
13
|
-
import '../rslang/semantic/typification.js';
|
|
14
|
-
import '../shared/branded.js';
|
|
15
|
-
import '../rslang/eval/value.js';
|
|
16
|
-
import '../rslang/semantic/analyzer.js';
|
|
17
|
-
import '../rslang/semantic/value-class.js';
|
|
1
|
+
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
2
|
+
import { a as LibraryItemType, i as LibraryItemReference, n as CurrentVersion, o as LocationHead, r as LibraryItem, s as VersionInfo, t as AccessPolicy } from "../library-CYun28Xz.js";
|
|
3
|
+
import { n as OssLayout, r as Position2D } from "../oss-layout-3glgAqfn.js";
|
|
4
|
+
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./oss.js";
|
|
5
|
+
import { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TypeInfo } from "./rsform.js";
|
|
6
|
+
import { BasicBinding, BasicsContext, DEFAULT_VALUE_TEXT, EvalStatus, RSModel, RSModelStats } from "./rsmodel.js";
|
|
7
|
+
import { RSEngine } from "./rsengine.js";
|
|
8
|
+
export { AccessPolicy, type ArgumentValue, type Attribution, type BasicBinding, type BasicsContext, type Block, type Constituenta, CstClass, CstStatus, type CstSubstituteInfo, CstType, type CurrentVersion, DEFAULT_VALUE_TEXT, EvalStatus, FolderNode, FolderTree, type LibraryItem, type LibraryItemReference, LibraryItemType, LocationHead, NodeType, type Operation, type OperationInput, type OperationSchema, type OperationSchemaStats, type OperationSynthesis, OperationType, type OssItem, type OssLayout, type Position2D, RSEngine, type RSForm, type RSFormStats, type RSModel, type RSModelStats, type Substitution, type SubstitutionErrorDescription, SubstitutionErrorType, type TypeInfo, type VersionInfo };
|