@bikky/replication 1.0.3 → 1.0.4
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/.idea/Replication.iml +12 -0
- package/.idea/compiler.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +3 -1
- package/Expressions/Compiler/Grammar/Accessors.d.ts +32 -0
- package/Expressions/Compiler/Grammar/Accessors.js +227 -0
- package/Expressions/Compiler/Grammar/Accessors.js.map +1 -0
- package/Expressions/Compiler/Grammar/ControlFlow.d.ts +38 -0
- package/Expressions/Compiler/Grammar/ControlFlow.js +178 -0
- package/Expressions/Compiler/Grammar/ControlFlow.js.map +1 -0
- package/Expressions/Compiler/Grammar/Declarations.d.ts +22 -0
- package/Expressions/Compiler/Grammar/Declarations.js +84 -0
- package/Expressions/Compiler/Grammar/Declarations.js.map +1 -0
- package/Expressions/Compiler/Grammar/Function.d.ts +30 -0
- package/Expressions/Compiler/Grammar/Function.js +292 -0
- package/Expressions/Compiler/Grammar/Function.js.map +1 -0
- package/Expressions/Compiler/Grammar/General.d.ts +55 -0
- package/Expressions/Compiler/Grammar/General.js +248 -0
- package/Expressions/Compiler/Grammar/General.js.map +1 -0
- package/Expressions/Compiler/Grammar/Maths.d.ts +26 -0
- package/Expressions/Compiler/Grammar/Maths.js +164 -0
- package/Expressions/Compiler/Grammar/Maths.js.map +1 -0
- package/Expressions/Compiler/Grammar/Misc.d.ts +20 -0
- package/Expressions/Compiler/Grammar/Misc.js +50 -0
- package/Expressions/Compiler/Grammar/Misc.js.map +1 -0
- package/Expressions/Compiler/Grammar/Preprocessors.d.ts +18 -0
- package/Expressions/Compiler/Grammar/Preprocessors.js +43 -0
- package/Expressions/Compiler/Grammar/Preprocessors.js.map +1 -0
- package/Expressions/Compiler/Grammar/Struct.d.ts +21 -0
- package/Expressions/Compiler/Grammar/Struct.js +42 -0
- package/Expressions/Compiler/Grammar/Struct.js.map +1 -0
- package/Expressions/Compiler/Grammar/Tokens.d.ts +7 -0
- package/Expressions/Compiler/Grammar/Tokens.js +270 -0
- package/Expressions/Compiler/Grammar/Tokens.js.map +1 -0
- package/Expressions/Compiler/Grammar/Types.d.ts +35 -0
- package/Expressions/Compiler/Grammar/Types.js +230 -0
- package/Expressions/Compiler/Grammar/Types.js.map +1 -0
- package/Expressions/Compiler/GrammarRegistry.d.ts +20 -0
- package/Expressions/Compiler/GrammarRegistry.js +51 -0
- package/Expressions/Compiler/GrammarRegistry.js.map +1 -0
- package/Expressions/Compiler/Parser/Checks.d.ts +8 -0
- package/Expressions/Compiler/Parser/Checks.js +40 -0
- package/Expressions/Compiler/Parser/Checks.js.map +1 -0
- package/Expressions/Compiler/Parser/Enums.d.ts +73 -0
- package/Expressions/Compiler/Parser/Enums.js +77 -0
- package/Expressions/Compiler/Parser/Enums.js.map +1 -0
- package/Expressions/Compiler/Parser/Interfaces.d.ts +118 -0
- package/Expressions/Compiler/Parser/Interfaces.js +112 -0
- package/Expressions/Compiler/Parser/Interfaces.js.map +1 -0
- package/Expressions/Compiler/Parser/MatchGrammar.d.ts +15 -0
- package/Expressions/Compiler/Parser/MatchGrammar.js +128 -0
- package/Expressions/Compiler/Parser/MatchGrammar.js.map +1 -0
- package/Expressions/Compiler/Parser/MatchRepeatingRule.d.ts +4 -0
- package/Expressions/Compiler/Parser/MatchRepeatingRule.js +51 -0
- package/Expressions/Compiler/Parser/MatchRepeatingRule.js.map +1 -0
- package/Expressions/Compiler/Parser/MatchRule.d.ts +4 -0
- package/Expressions/Compiler/Parser/MatchRule.js +57 -0
- package/Expressions/Compiler/Parser/MatchRule.js.map +1 -0
- package/Expressions/Compiler/Parser/Parser.d.ts +26 -0
- package/Expressions/Compiler/Parser/Parser.js +67 -0
- package/Expressions/Compiler/Parser/Parser.js.map +1 -0
- package/Expressions/Compiler/Parser/Tokenizer.d.ts +12 -0
- package/Expressions/Compiler/Parser/Tokenizer.js +138 -0
- package/Expressions/Compiler/Parser/Tokenizer.js.map +1 -0
- package/Expressions/Compiler/Parser/TypesAndPrint.d.ts +29 -0
- package/Expressions/Compiler/Parser/TypesAndPrint.js +15 -0
- package/Expressions/Compiler/Parser/TypesAndPrint.js.map +1 -0
- package/Expressions/Compiler/Parser/Updates.d.ts +10 -0
- package/Expressions/Compiler/Parser/Updates.js +79 -0
- package/Expressions/Compiler/Parser/Updates.js.map +1 -0
- package/Networking.d.ts +3 -0
- package/Networking.js +19 -5
- package/Networking.js.map +1 -1
- package/package.json +28 -28
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="RegExpUnnecessaryNonCapturingGroup" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
5
|
+
</profile>
|
|
6
|
+
</component>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/Replication.iml" filepath="$PROJECT_DIR$/.idea/Replication.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NodeType } from "../Parser/Enums.js";
|
|
2
|
+
import { GrammarInterfaces } from "../Parser/Interfaces.js";
|
|
3
|
+
import { ExpressionNode, ParenthetisedExpressionNode } from "./General.js";
|
|
4
|
+
import { FunctionCallNode } from "./Function.js";
|
|
5
|
+
import { CastNode } from "./Types.js";
|
|
6
|
+
import { LiteralNode } from "./Misc.js";
|
|
7
|
+
import EAST_Complex_Node = GrammarInterfaces.EAST_Complex_Node;
|
|
8
|
+
import EAST_Token = GrammarInterfaces.EAST_Token;
|
|
9
|
+
import Node = GrammarInterfaces.Node;
|
|
10
|
+
export interface MemberAccessNode extends EAST_Complex_Node {
|
|
11
|
+
type: NodeType.MEMBER_ACCESS;
|
|
12
|
+
values: {
|
|
13
|
+
context: ParenthetisedExpressionNode | EAST_Token | CastNode | ArrayAccessSequenceNode | FunctionCallNode;
|
|
14
|
+
memberName: (EAST_Token)[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function IsMemberAccessNode(node: Node): node is MemberAccessNode;
|
|
18
|
+
export interface ArrayAccessorNode extends EAST_Complex_Node {
|
|
19
|
+
type: NodeType.ARRAY_ACCESSOR;
|
|
20
|
+
values: {
|
|
21
|
+
index: LiteralNode | ExpressionNode | EAST_Token;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare function IsArrayAccessorNode(node: Node): node is ArrayAccessorNode;
|
|
25
|
+
export interface ArrayAccessSequenceNode extends EAST_Complex_Node {
|
|
26
|
+
type: NodeType.ARRAY_ACCESS_SEQUENCE;
|
|
27
|
+
values: {
|
|
28
|
+
identifier: EAST_Token | ExpressionNode;
|
|
29
|
+
accessor: ArrayAccessorNode[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function IsArrayAccessSequenceNode(node: Node): node is ArrayAccessSequenceNode;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { CollectionType, NodeType, TokenType } from "../Parser/Enums.js";
|
|
2
|
+
import { GrammarRegistry } from "../GrammarRegistry.js";
|
|
3
|
+
import { Versions } from "../../../Constants/Versions.js";
|
|
4
|
+
import { GrammarInterfaces } from "../Parser/Interfaces.js";
|
|
5
|
+
import { describeObject } from "../../../Constants/SerialisationTypes.js";
|
|
6
|
+
var ExpressionSyntaxError = GrammarRegistry.ExpressionSyntaxError;
|
|
7
|
+
import { ChainNumber, ChainString } from "../../TypeRegistry/Primitive.js";
|
|
8
|
+
import { ArrayType, DictType, MapType } from "../../TypeRegistry/ChainCollections.js";
|
|
9
|
+
var isAssignableCompile = GrammarInterfaces.isAssignableCompile;
|
|
10
|
+
import { ErrorStack } from "../../../Constants/Errors.js";
|
|
11
|
+
var dedupeTypes = GrammarInterfaces.dedupeTypes;
|
|
12
|
+
var collapseTypeLive = GrammarInterfaces.collapseTypeLive;
|
|
13
|
+
export function IsMemberAccessNode(node) {
|
|
14
|
+
return node.type === NodeType.MEMBER_ACCESS;
|
|
15
|
+
}
|
|
16
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.MEMBER_ACCESS, [[
|
|
17
|
+
{
|
|
18
|
+
type: [NodeType.PARENTHETISED_EXPRESSION, NodeType.FUNCTION_CALL, NodeType.ARRAY_ACCESS_SEQUENCE,
|
|
19
|
+
NodeType.CAST, TokenType.IDENTIFIER],
|
|
20
|
+
name: "context"
|
|
21
|
+
},
|
|
22
|
+
{ type: [TokenType.OPERATOR], value: "." },
|
|
23
|
+
{
|
|
24
|
+
type: [TokenType.IDENTIFIER],
|
|
25
|
+
name: "memberName",
|
|
26
|
+
repeat: [1, Number.POSITIVE_INFINITY],
|
|
27
|
+
repeatSeparator: { type: TokenType.OPERATOR, value: "." }
|
|
28
|
+
}
|
|
29
|
+
]], {
|
|
30
|
+
runtimeExecute(scope, node, outputType) {
|
|
31
|
+
let contextNode = node.values.context;
|
|
32
|
+
let result = contextNode.execute.runtimeExecute(scope, contextNode, null);
|
|
33
|
+
for (const member of node.values.memberName) {
|
|
34
|
+
if (!result.type) {
|
|
35
|
+
throw new ExpressionSyntaxError(`Cannot access member on never.`, contextNode);
|
|
36
|
+
}
|
|
37
|
+
let index = member.execute.runtimeExecute(scope, member, null);
|
|
38
|
+
if (result.type.kind === "function") {
|
|
39
|
+
throw new ExpressionSyntaxError(`Cannot look up members on a function.`, contextNode);
|
|
40
|
+
}
|
|
41
|
+
let accessor = result.type.getAccess(scope.version, !!scope.data, index.value);
|
|
42
|
+
if (!accessor) {
|
|
43
|
+
throw new ExpressionSyntaxError(`Property ${index.value} does not exist on type ${result.type.debugName}.`, contextNode);
|
|
44
|
+
}
|
|
45
|
+
let value = accessor.evaluate(scope);
|
|
46
|
+
let narrowedType = collapseTypeLive(scope, node, value, accessor.resultTypes);
|
|
47
|
+
if (!narrowedType) {
|
|
48
|
+
throw new Error(`Resolved property value is not compatible with any expected property type.`);
|
|
49
|
+
}
|
|
50
|
+
result = {
|
|
51
|
+
type: narrowedType,
|
|
52
|
+
value
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
let stack = new ErrorStack({ Version: scope.version, SourceFile: node.file.sourceLocation });
|
|
56
|
+
if (!isAssignableCompile(scope.version, outputType, result.type ? [result.type] : null, node, stack)) {
|
|
57
|
+
throw new ExpressionSyntaxError(`Value returned a type that is not assignable to expected type.\n` + stack.toString(`GA_MEM_01`), contextNode);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
},
|
|
61
|
+
compileTimeTraversal(scope, node, outputType) {
|
|
62
|
+
const contextNode = node.values.context;
|
|
63
|
+
let result = contextNode.execute.compileTimeTraversal(scope, contextNode, null);
|
|
64
|
+
for (const member of node.values.memberName) {
|
|
65
|
+
if (!result || !result.type) {
|
|
66
|
+
throw new ExpressionSyntaxError(`Cannot access member on never.`, contextNode);
|
|
67
|
+
}
|
|
68
|
+
const index = member.data;
|
|
69
|
+
const nextUnion = [];
|
|
70
|
+
for (const contextType of result.type) {
|
|
71
|
+
if (contextType.kind === "function") {
|
|
72
|
+
throw new ExpressionSyntaxError(`Cannot access members on a function.`, contextNode);
|
|
73
|
+
}
|
|
74
|
+
const accessor = contextType.getAccess(scope.version, !!scope.data, index);
|
|
75
|
+
if (!accessor?.resultTypes?.length) {
|
|
76
|
+
throw new Error(`Accessor ${contextType.debugName}.${accessor?.propName} does not return any valid types.`);
|
|
77
|
+
}
|
|
78
|
+
for (const type of accessor.resultTypes) {
|
|
79
|
+
nextUnion.push(type);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (nextUnion.length === 0) {
|
|
83
|
+
throw new ExpressionSyntaxError(`No valid member types found for '${index}' across all possible context types.`, member);
|
|
84
|
+
}
|
|
85
|
+
result = {
|
|
86
|
+
type: dedupeTypes(nextUnion)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
let stack = new ErrorStack({ Version: scope.version, SourceFile: node.file.sourceLocation });
|
|
90
|
+
if (!isAssignableCompile(scope.version, outputType, result?.type ?? null, node, stack)) {
|
|
91
|
+
throw new ExpressionSyntaxError(`Value returned a type that is not assignable to expected type.\n` + stack.toString(`GA_MEM_02`), contextNode);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export function IsArrayAccessorNode(node) {
|
|
97
|
+
return node.type === NodeType.ARRAY_ACCESSOR;
|
|
98
|
+
}
|
|
99
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.ARRAY_ACCESSOR, [[
|
|
100
|
+
{ type: [TokenType.OPERATOR], value: "[" },
|
|
101
|
+
{
|
|
102
|
+
type: [NodeType.LITERAL, NodeType.EXPRESSION, TokenType.IDENTIFIER],
|
|
103
|
+
name: "index"
|
|
104
|
+
},
|
|
105
|
+
{ type: [TokenType.OPERATOR], value: "]" }
|
|
106
|
+
]], {
|
|
107
|
+
//Just returns the index value for the array access.
|
|
108
|
+
runtimeExecute(scope, node, outputType) {
|
|
109
|
+
let indexNode = node.values.index;
|
|
110
|
+
return indexNode.execute.runtimeExecute(scope, indexNode, outputType);
|
|
111
|
+
},
|
|
112
|
+
compileTimeTraversal(scope, node, outputType) {
|
|
113
|
+
let indexNode = node.values.index;
|
|
114
|
+
return indexNode.execute.compileTimeTraversal(scope, indexNode, outputType);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
export function IsArrayAccessSequenceNode(node) {
|
|
118
|
+
return node.type === NodeType.ARRAY_ACCESS_SEQUENCE;
|
|
119
|
+
}
|
|
120
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.ARRAY_ACCESS_SEQUENCE, [[
|
|
121
|
+
{
|
|
122
|
+
type: [TokenType.IDENTIFIER, NodeType.PARENTHETISED_EXPRESSION],
|
|
123
|
+
name: "identifier"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: [NodeType.ARRAY_ACCESSOR],
|
|
127
|
+
name: "accessor",
|
|
128
|
+
repeat: [1, Number.POSITIVE_INFINITY]
|
|
129
|
+
}
|
|
130
|
+
]], {
|
|
131
|
+
runtimeExecute(scope, node, outputType) {
|
|
132
|
+
let contextNode = node.values.identifier;
|
|
133
|
+
let current = contextNode.execute.runtimeExecute(scope, contextNode, null);
|
|
134
|
+
let result = {
|
|
135
|
+
type: current.type,
|
|
136
|
+
value: current.value
|
|
137
|
+
};
|
|
138
|
+
for (const member of node.values.accessor) {
|
|
139
|
+
let index = member.execute.runtimeExecute(scope, member, null);
|
|
140
|
+
if (result.type.kind !== "value") {
|
|
141
|
+
throw new ExpressionSyntaxError(`Cannot access member on function.`, contextNode);
|
|
142
|
+
}
|
|
143
|
+
let accessor = result.type.getAccess(scope.version, !!scope.data, index.value);
|
|
144
|
+
if (!accessor) {
|
|
145
|
+
throw new ExpressionSyntaxError(`Property ${index.value} does not exist on type ${result.type.debugName}.`, contextNode);
|
|
146
|
+
}
|
|
147
|
+
let value = accessor.evaluate(scope);
|
|
148
|
+
let type = accessor.resultTypes.find((e) => scope.data ?
|
|
149
|
+
e.getData(scope.version, index.value) : e.getLive(scope.version, index.value));
|
|
150
|
+
if (!type) {
|
|
151
|
+
throw new Error(`${describeObject(result.value)}'s accessor ${result.type.debugName}.${accessor.propName} contains an invalid value.`);
|
|
152
|
+
}
|
|
153
|
+
result = {
|
|
154
|
+
type: type,
|
|
155
|
+
value
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
},
|
|
160
|
+
compileTimeTraversal(scope, node, outputType) {
|
|
161
|
+
let contextNode = node.values.identifier;
|
|
162
|
+
let current = contextNode.execute.compileTimeTraversal(scope, contextNode, null);
|
|
163
|
+
if (!current || !current.type) {
|
|
164
|
+
throw new ExpressionSyntaxError(`Cannot access member on never.`, contextNode);
|
|
165
|
+
}
|
|
166
|
+
let result = [];
|
|
167
|
+
result.push(...current?.type);
|
|
168
|
+
for (const member of node.values.accessor) {
|
|
169
|
+
let index = member.execute.compileTimeTraversal(scope, member, null);
|
|
170
|
+
let indexType;
|
|
171
|
+
if (!index || !index.type) {
|
|
172
|
+
throw new ExpressionSyntaxError(`Cannot use an expressiont that doesn't return a value in an array accessor.`, contextNode);
|
|
173
|
+
}
|
|
174
|
+
//Check to see if index type is valid, and there's only one type used for the lookup.
|
|
175
|
+
for (let type of index.type) {
|
|
176
|
+
if (typeof indexType !== "undefined") {
|
|
177
|
+
throw new ExpressionSyntaxError(`Can only use one type as an index at a time, not both string and number types.`, contextNode);
|
|
178
|
+
}
|
|
179
|
+
if (type.kind !== "value") {
|
|
180
|
+
throw new ExpressionSyntaxError(`Cannot access member on function.`, contextNode);
|
|
181
|
+
}
|
|
182
|
+
if (type != ChainNumber && type != ChainString) {
|
|
183
|
+
throw new ExpressionSyntaxError(`Array/Dictionary lookup must be a string or a number.`, contextNode);
|
|
184
|
+
}
|
|
185
|
+
if (type.getOwnOutputStyle() != CollectionType.Single) {
|
|
186
|
+
throw new ExpressionSyntaxError(`Array/Dictionary lookup must be a single value, not an array, map or dictionary.`, contextNode);
|
|
187
|
+
}
|
|
188
|
+
indexType = type;
|
|
189
|
+
}
|
|
190
|
+
//Do the lookup.
|
|
191
|
+
result = [];
|
|
192
|
+
let contextTypes = result;
|
|
193
|
+
for (let type of contextTypes) {
|
|
194
|
+
if (type.kind !== "value") {
|
|
195
|
+
throw new ExpressionSyntaxError(`Cannot access member on function.`, contextNode);
|
|
196
|
+
}
|
|
197
|
+
let outputTypes;
|
|
198
|
+
if (type instanceof ArrayType) {
|
|
199
|
+
if (indexType != ChainNumber) {
|
|
200
|
+
throw new ExpressionSyntaxError(`Can only access arrays with numbers.`, contextNode);
|
|
201
|
+
}
|
|
202
|
+
outputTypes = type.types;
|
|
203
|
+
}
|
|
204
|
+
else if (type instanceof MapType) {
|
|
205
|
+
if (indexType != ChainString) {
|
|
206
|
+
throw new ExpressionSyntaxError(`Can only access maps with strings.`, contextNode);
|
|
207
|
+
}
|
|
208
|
+
outputTypes = type.types;
|
|
209
|
+
}
|
|
210
|
+
else if (type instanceof DictType) {
|
|
211
|
+
if (indexType != ChainString) {
|
|
212
|
+
throw new ExpressionSyntaxError(`Can only access dictionaries with strings.`, contextNode);
|
|
213
|
+
}
|
|
214
|
+
outputTypes = type.types;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
throw new ExpressionSyntaxError(`Accessors can only be used on maps and arrays.`, contextNode);
|
|
218
|
+
}
|
|
219
|
+
result.push(...outputTypes);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
type: [...new Set(result)]
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
//# sourceMappingURL=Accessors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accessors.js","sourceRoot":"","sources":["Accessors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAA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BAC3B,MAAM,IAAI,qBAAqB,CAAC,mCAAmC,EAAE,WAAW,CAAC,CAAC;gBACnF,CAAC;gBACD,IAAI,WAAwB,CAAC;gBAC7B,IAAI,IAAI,YAAY,SAAS,EAAE,CAAC;oBAC/B,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;wBAC9B,MAAM,IAAI,qBAAqB,CAAC,sCAAsC,EAAE,WAAW,CAAC,CAAC;oBACtF,CAAC;oBACD,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC1B,CAAC;qBACI,IAAI,IAAI,YAAY,OAAO,EAAE,CAAC;oBAClC,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;wBAC9B,MAAM,IAAI,qBAAqB,CAAC,oCAAoC,EAAE,WAAW,CAAC,CAAC;oBACpF,CAAC;oBACD,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC1B,CAAC;qBACI,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;oBACnC,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;wBAC9B,MAAM,IAAI,qBAAqB,CAAC,4CAA4C,EAAE,WAAW,CAAC,CAAC;oBAC5F,CAAC;oBACD,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC1B,CAAC;qBACI,CAAC;oBACL,MAAM,IAAI,qBAAqB,CAAC,gDAAgD,EAAE,WAAW,CAAC,CAAC;gBAChG,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QAED,OAAO;YACN,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;SAC1B,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NodeType } from "../Parser/Enums.js";
|
|
2
|
+
import { GrammarInterfaces } from "../Parser/Interfaces.js";
|
|
3
|
+
import { BlockNode, ExpressionNode, StatementNode } from "./General.js";
|
|
4
|
+
import EAST_Complex_Node = GrammarInterfaces.EAST_Complex_Node;
|
|
5
|
+
import Node = GrammarInterfaces.Node;
|
|
6
|
+
export declare const CONTROL_FLOW_STATEMENTS: NodeType[];
|
|
7
|
+
type ControlFlowLoopNodes = BreakNode | ContinueNode;
|
|
8
|
+
export declare function IsLoopNode(node: Node): node is ForNode | WhileNode;
|
|
9
|
+
export declare function IsControlFlowNode(node: Node): node is ContinueNode | BreakNode;
|
|
10
|
+
export interface ContinueNode extends GrammarInterfaces.EAST_Complex_Node {
|
|
11
|
+
type: NodeType.CONTINUE;
|
|
12
|
+
values: undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function IsContinueNode(node: Node): node is ContinueNode;
|
|
15
|
+
export interface BreakNode extends EAST_Complex_Node {
|
|
16
|
+
type: NodeType.BREAK;
|
|
17
|
+
values: undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function IsBreakNode(node: Node): node is BreakNode;
|
|
20
|
+
export interface WhileNode extends EAST_Complex_Node {
|
|
21
|
+
type: NodeType.WHILE_LOOP;
|
|
22
|
+
values: {
|
|
23
|
+
test: ExpressionNode;
|
|
24
|
+
body: BlockNode<ControlFlowLoopNodes> | StatementNode;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function IsWhileNode(node: Node): node is WhileNode;
|
|
28
|
+
export interface ForNode extends GrammarInterfaces.EAST_Complex_Node {
|
|
29
|
+
type: NodeType.FOR_LOOP;
|
|
30
|
+
values: {
|
|
31
|
+
initialiser: ExpressionNode;
|
|
32
|
+
test: ExpressionNode;
|
|
33
|
+
incrementer: ExpressionNode;
|
|
34
|
+
body: BlockNode<ControlFlowLoopNodes> | StatementNode;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare function IsForNode(node: Node): node is ForNode;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { NodeType, TokenType } from "../Parser/Enums.js";
|
|
2
|
+
import { GrammarInterfaces } from "../Parser/Interfaces.js";
|
|
3
|
+
import { GrammarRegistry } from "../GrammarRegistry.js";
|
|
4
|
+
import { Versions } from "../../../Constants/Versions.js";
|
|
5
|
+
var SpecialType = GrammarInterfaces.SpecialType;
|
|
6
|
+
var ExpressionSyntaxError = GrammarRegistry.ExpressionSyntaxError;
|
|
7
|
+
import { ChainBoolean } from "../../TypeRegistry/Primitive.js";
|
|
8
|
+
import { CreateChildScope } from "../../TypeRegistry/Types.js";
|
|
9
|
+
export const CONTROL_FLOW_STATEMENTS = [NodeType.FOR_LOOP, NodeType.WHILE_LOOP, NodeType.DOWHILE_LOOP, NodeType.IF];
|
|
10
|
+
const CONTROL_FLOW_LOOP = [NodeType.BREAK, NodeType.CONTINUE];
|
|
11
|
+
//-------------------------------------------------LOOPS-----------------------------------------------
|
|
12
|
+
export function IsLoopNode(node) {
|
|
13
|
+
return node.type === NodeType.FOR_LOOP || node.type === NodeType.WHILE_LOOP || node.type === NodeType.DOWHILE_LOOP;
|
|
14
|
+
}
|
|
15
|
+
export function IsControlFlowNode(node) {
|
|
16
|
+
return node.type === NodeType.CONTINUE || node.type === NodeType.BREAK || node.type === NodeType.RETURN;
|
|
17
|
+
}
|
|
18
|
+
export function IsContinueNode(node) {
|
|
19
|
+
return node.type === NodeType.CONTINUE;
|
|
20
|
+
}
|
|
21
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.CONTINUE, [[
|
|
22
|
+
{ type: TokenType.KEYWORD, value: "continue" },
|
|
23
|
+
{ type: TokenType.OPERATOR, value: ";" }
|
|
24
|
+
]], {
|
|
25
|
+
runtimeExecute(scope, currentNode, outputType) {
|
|
26
|
+
return {
|
|
27
|
+
interrupt: "continue",
|
|
28
|
+
type: null,
|
|
29
|
+
value: null
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
compileTimeTraversal(scope, currentNode, outputType) {
|
|
33
|
+
if (outputType !== null) {
|
|
34
|
+
throw new ExpressionSyntaxError("Continue statements cannot return values", currentNode);
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export function IsBreakNode(node) {
|
|
40
|
+
return node.type === NodeType.BREAK;
|
|
41
|
+
}
|
|
42
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.BREAK, [[
|
|
43
|
+
{ type: TokenType.KEYWORD, value: "break" },
|
|
44
|
+
{ type: TokenType.OPERATOR, value: ";" }
|
|
45
|
+
]], {
|
|
46
|
+
runtimeExecute(scope, currentNode, outputType) {
|
|
47
|
+
return {
|
|
48
|
+
interrupt: "break",
|
|
49
|
+
type: null,
|
|
50
|
+
value: null
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
compileTimeTraversal(scope, currentNode, outputType) {
|
|
54
|
+
if (outputType !== null) {
|
|
55
|
+
throw new ExpressionSyntaxError("Break statements cannot return values", currentNode);
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export function IsWhileNode(node) {
|
|
61
|
+
return node.type === NodeType.WHILE_LOOP;
|
|
62
|
+
}
|
|
63
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.WHILE_LOOP, [[
|
|
64
|
+
{ type: TokenType.KEYWORD, value: "while" },
|
|
65
|
+
{ type: TokenType.OPERATOR, value: "(" },
|
|
66
|
+
{ type: NodeType.EXPRESSION, name: "test" },
|
|
67
|
+
{ type: TokenType.OPERATOR, value: ")" },
|
|
68
|
+
{
|
|
69
|
+
type: [NodeType.BLOCK, NodeType.STATEMENT],
|
|
70
|
+
input: [...CONTROL_FLOW_LOOP, GrammarInterfaces.SpecialType.INPUT_TYPES],
|
|
71
|
+
name: "body"
|
|
72
|
+
}
|
|
73
|
+
]], {
|
|
74
|
+
runtimeExecute(scope, currentNode, outputType) {
|
|
75
|
+
if (outputType !== null) {
|
|
76
|
+
throw new ExpressionSyntaxError("Loops cannot return values", currentNode);
|
|
77
|
+
}
|
|
78
|
+
// Create a new scope for the loop
|
|
79
|
+
let loopScope = CreateChildScope(scope);
|
|
80
|
+
while (true) {
|
|
81
|
+
// Evaluate the test condition
|
|
82
|
+
let testResult = currentNode.values.test.execute.runtimeExecute(loopScope, currentNode.values.test, [ChainBoolean]);
|
|
83
|
+
if (!testResult.value) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
// Execute the body
|
|
87
|
+
let bodyResult = currentNode.values.body.execute.runtimeExecute(loopScope, currentNode.values.body, null);
|
|
88
|
+
// Handle control flow statements
|
|
89
|
+
if (bodyResult.interrupt === "break") {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (bodyResult.interrupt === "return") {
|
|
93
|
+
return bodyResult;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
type: null,
|
|
98
|
+
value: null
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
compileTimeTraversal(scope, currentNode, outputType) {
|
|
102
|
+
if (outputType !== null) {
|
|
103
|
+
throw new ExpressionSyntaxError("Loops cannot return values", currentNode);
|
|
104
|
+
}
|
|
105
|
+
// Create a new scope for the loop body
|
|
106
|
+
let bodyScope = CreateChildScope(scope);
|
|
107
|
+
// Ensure the test condition is a boolean
|
|
108
|
+
currentNode.values.test.execute.compileTimeTraversal(bodyScope, currentNode.values.test, [ChainBoolean]);
|
|
109
|
+
// Traverse the body
|
|
110
|
+
currentNode.values.body.execute.compileTimeTraversal(bodyScope, currentNode.values.body, null);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export function IsForNode(node) {
|
|
115
|
+
return node.type === NodeType.FOR_LOOP;
|
|
116
|
+
}
|
|
117
|
+
GrammarRegistry.AddRule(Versions.v1_0_0, NodeType.FOR_LOOP, [[
|
|
118
|
+
{ type: TokenType.KEYWORD, value: "for" },
|
|
119
|
+
{ type: TokenType.OPERATOR, value: "(" },
|
|
120
|
+
{ type: NodeType.EXPRESSION, name: "initialiser" },
|
|
121
|
+
{ type: TokenType.OPERATOR, value: ";" },
|
|
122
|
+
{ type: NodeType.EXPRESSION, name: "test" },
|
|
123
|
+
{ type: TokenType.OPERATOR, value: ";" },
|
|
124
|
+
{ type: NodeType.EXPRESSION, name: "incrementer" },
|
|
125
|
+
{ type: TokenType.OPERATOR, value: ")" },
|
|
126
|
+
{
|
|
127
|
+
type: [NodeType.BLOCK, NodeType.STATEMENT],
|
|
128
|
+
input: [...CONTROL_FLOW_LOOP, SpecialType.INPUT_TYPES],
|
|
129
|
+
name: "body"
|
|
130
|
+
}
|
|
131
|
+
]], {
|
|
132
|
+
runtimeExecute(scope, currentNode, outputType) {
|
|
133
|
+
if (outputType !== null) {
|
|
134
|
+
throw new ExpressionSyntaxError("Loops cannot return values", currentNode);
|
|
135
|
+
}
|
|
136
|
+
// Create a new scope for the loop
|
|
137
|
+
let loopScope = CreateChildScope(scope);
|
|
138
|
+
currentNode.values.initialiser.execute.runtimeExecute(loopScope, currentNode.values.initialiser, null);
|
|
139
|
+
while (true) {
|
|
140
|
+
// Evaluate the test condition
|
|
141
|
+
let testResult = currentNode.values.test.execute.runtimeExecute(loopScope, currentNode.values.test, [ChainBoolean]);
|
|
142
|
+
if (!testResult.value) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
// Execute the body
|
|
146
|
+
let bodyResult = currentNode.values.body.execute.runtimeExecute(loopScope, currentNode.values.body, null);
|
|
147
|
+
// Handle control flow statements
|
|
148
|
+
if (bodyResult.interrupt === "break") {
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (bodyResult.interrupt === "return") {
|
|
152
|
+
return bodyResult;
|
|
153
|
+
}
|
|
154
|
+
currentNode.values.incrementer.execute.runtimeExecute(loopScope, currentNode.values.incrementer, null);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
type: null,
|
|
158
|
+
value: null
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
compileTimeTraversal(scope, currentNode, outputType) {
|
|
162
|
+
if (outputType !== null) {
|
|
163
|
+
throw new ExpressionSyntaxError("Loops cannot return values", currentNode);
|
|
164
|
+
}
|
|
165
|
+
// Create a new scope for the loop body
|
|
166
|
+
let bodyScope = CreateChildScope(scope);
|
|
167
|
+
// Traverse the initialiser
|
|
168
|
+
currentNode.values.initialiser.execute.compileTimeTraversal(bodyScope, currentNode.values.initialiser, null);
|
|
169
|
+
// Traverse the incrementer
|
|
170
|
+
currentNode.values.incrementer.execute.compileTimeTraversal(bodyScope, currentNode.values.incrementer, null);
|
|
171
|
+
// Ensure the test condition is a boolean
|
|
172
|
+
currentNode.values.test.execute.compileTimeTraversal(bodyScope, currentNode.values.test, [ChainBoolean]);
|
|
173
|
+
// Traverse the body
|
|
174
|
+
currentNode.values.body.execute.compileTimeTraversal(bodyScope, currentNode.values.body, null);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
//# sourceMappingURL=ControlFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlFlow.js","sourceRoot":"","sources":["ControlFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAI1D,IAAO,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC;AAEnD,IAAO,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,EAAE,QAA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C;IACb,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeType } from "../Parser/Enums.js";
|
|
2
|
+
import { GrammarInterfaces } from "../Parser/Interfaces.js";
|
|
3
|
+
import { ExpressionNode } from "./General.js";
|
|
4
|
+
import Node = GrammarInterfaces.Node;
|
|
5
|
+
import EAST_Token = GrammarInterfaces.EAST_Token;
|
|
6
|
+
import { TypeDefinitionNode, TypeUnionNode } from "./Types.js";
|
|
7
|
+
export interface DeclarationEntryNode extends GrammarInterfaces.EAST_Complex_Node {
|
|
8
|
+
type: NodeType.DECLARATION_ENTRY;
|
|
9
|
+
values: {
|
|
10
|
+
name: EAST_Token;
|
|
11
|
+
type: TypeDefinitionNode | TypeUnionNode;
|
|
12
|
+
initialiser?: ExpressionNode;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function IsDeclarationEntryNode(node: Node): node is DeclarationEntryNode;
|
|
16
|
+
export interface DeclarationNode extends GrammarInterfaces.EAST_Complex_Node {
|
|
17
|
+
type: NodeType.DECLARATION;
|
|
18
|
+
values: {
|
|
19
|
+
declarations: DeclarationEntryNode[];
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function IsDeclarationNode(node: Node): node is DeclarationNode;
|