occam-furtle 2.0.76 → 2.0.78
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/lib/dom/assignment/array.js +4 -18
- package/lib/dom/assignment/object.js +12 -19
- package/lib/dom/assignment/variable.js +4 -14
- package/lib/dom/assignments/variable.js +1 -4
- package/lib/dom/procedure/anonymous.js +2 -2
- package/lib/dom/some.js +8 -4
- package/lib/dom/step.js +2 -2
- package/lib/dom/value/negated.js +2 -2
- package/lib/dom/value.js +2 -7
- package/lib/dom/variable.js +30 -33
- package/package.json +5 -5
- package/src/dom/assignment/array.js +2 -20
- package/src/dom/assignment/object.js +14 -27
- package/src/dom/assignment/variable.js +3 -12
- package/src/dom/assignments/variable.js +0 -4
- package/src/dom/procedure/anonymous.js +1 -1
- package/src/dom/some.js +27 -19
- package/src/dom/step.js +2 -2
- package/src/dom/value/negated.js +1 -1
- package/src/dom/value.js +3 -9
- package/src/dom/variable.js +46 -39
|
@@ -15,7 +15,7 @@ const parametersNodeQuery = nodeQuery("/anonymousProcedure/parameters"),
|
|
|
15
15
|
export default domAssigned(class AnonymousProcedure {
|
|
16
16
|
constructor(string, type, parameters, returnBlock) {
|
|
17
17
|
this.string = string;
|
|
18
|
-
this.type
|
|
18
|
+
this.type = type;
|
|
19
19
|
this.parameters = parameters;
|
|
20
20
|
this.returnBlock = returnBlock;
|
|
21
21
|
}
|
package/src/dom/some.js
CHANGED
|
@@ -31,12 +31,15 @@ export default domAssigned(class Some {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
evaluate(context) {
|
|
34
|
+
let value;
|
|
35
|
+
|
|
34
36
|
const someString = this.getString();
|
|
35
37
|
|
|
36
38
|
context.trace(`Evaluating the '${someString}' some...`);
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
value = this.variable.evaluate(context);
|
|
41
|
+
|
|
42
|
+
const valueType = value.getType();
|
|
40
43
|
|
|
41
44
|
if (valueType !== NODES_TYPE) {
|
|
42
45
|
const valueString = value.asString(context),
|
|
@@ -46,35 +49,40 @@ export default domAssigned(class Some {
|
|
|
46
49
|
throw exception;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
const nodes = value.getNodes()
|
|
52
|
+
const nodes = value.getNodes(),
|
|
53
|
+
boolean = nodes.some((node) => {
|
|
54
|
+
let value;
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
let value;
|
|
56
|
+
const { Value, Values } = dom;
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
value = Value.fromNode(node, context);
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
const values = Values.fromValue(value, context);
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
value = this.anonymousProcedure.call(values, context);
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
const valueType = value.getType();
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
if (valueType !== BOOLEAN_TYPE) {
|
|
67
|
+
const valueString = value.asString(context),
|
|
68
|
+
message = `The ${valueString} value's type is '${valueType}' when it should be of type '${BOOLEAN_TYPE}'.`,
|
|
69
|
+
exception = Exception.fromMessage(message);
|
|
63
70
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
message = `The ${valueString} value's type is '${valueType}' when it should be of type '${BOOLEAN_TYPE}'.`,
|
|
67
|
-
exception = Exception.fromMessage(message);
|
|
71
|
+
throw exception;
|
|
72
|
+
}
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
}
|
|
74
|
+
const boolean = value.getBoolean();
|
|
71
75
|
|
|
72
|
-
|
|
76
|
+
return boolean;
|
|
77
|
+
});
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
const { Value } = dom;
|
|
80
|
+
|
|
81
|
+
value = Value.fromBoolean(boolean, context);
|
|
76
82
|
|
|
77
83
|
context.trace(`...evaluated the '${someString}' some.`);
|
|
84
|
+
|
|
85
|
+
return value;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
static name = "Some";
|
package/src/dom/step.js
CHANGED
|
@@ -50,13 +50,13 @@ export default domAssigned(class Step {
|
|
|
50
50
|
static name = "Step";
|
|
51
51
|
|
|
52
52
|
static fromStepNode(stepNode, context) {
|
|
53
|
-
const { ArrayAssignment, ObjectAssigment, ConditionalBlocks,
|
|
53
|
+
const { ArrayAssignment, ObjectAssigment, ConditionalBlocks, VariableAssignments } = dom,
|
|
54
54
|
node = stepNode, ///
|
|
55
55
|
string = context.nodeAsString(node),
|
|
56
56
|
arrayAssignment = ArrayAssignment.fromStepNode(stepNode, context),
|
|
57
57
|
objectAssigment = ObjectAssigment.fromStepNode(stepNode, context),
|
|
58
58
|
conditionalBlocks = ConditionalBlocks.fromStepNode(stepNode, context),
|
|
59
|
-
variablesDeclaration =
|
|
59
|
+
variablesDeclaration = VariableAssignments.fromStepNode(stepNode, context),
|
|
60
60
|
step = new Step(string, arrayAssignment, objectAssigment, conditionalBlocks, variablesDeclaration);
|
|
61
61
|
|
|
62
62
|
return step;
|
package/src/dom/value/negated.js
CHANGED
package/src/dom/value.js
CHANGED
|
@@ -416,15 +416,9 @@ export default domAssigned(class Value {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
static fromVariableAssignmentNode(variableAssigmentNode, context) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if (variableAssignmentValueNode !== null) {
|
|
424
|
-
const valueNode = variableAssignmentValueNode; ///
|
|
425
|
-
|
|
426
|
-
value = valueFromValueNode(valueNode, context);
|
|
427
|
-
}
|
|
419
|
+
const variableAssignmentValueNode = variableAssignmentValueNodeQuery(variableAssigmentNode),
|
|
420
|
+
valueNode = variableAssignmentValueNode, ///
|
|
421
|
+
value = valueFromValueNode(valueNode, context);
|
|
428
422
|
|
|
429
423
|
return value;
|
|
430
424
|
}
|
package/src/dom/variable.js
CHANGED
|
@@ -69,26 +69,26 @@ export default domAssigned(class Variable {
|
|
|
69
69
|
return value;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
assign(context) {
|
|
73
|
-
const
|
|
72
|
+
assign(value, context) {
|
|
73
|
+
const valueString = value.asString(context), ///
|
|
74
|
+
variableName = this.name, ///
|
|
74
75
|
variableString = this.string, ///
|
|
75
76
|
variablePresent = context.isVariablePresentByVariableName(variableName);
|
|
76
77
|
|
|
77
|
-
context.trace(`Assigning
|
|
78
|
+
context.trace(`Assigning the ${valueString} value to the '${variableString}' variable...`);
|
|
78
79
|
|
|
79
|
-
if (
|
|
80
|
-
const message = `The '${variableString}' variable is
|
|
80
|
+
if (variablePresent) {
|
|
81
|
+
const message = `The '${variableString}' variable is already present.`,
|
|
81
82
|
exception = Exception.fromMessage(message);
|
|
82
83
|
|
|
83
84
|
throw exception;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
const
|
|
87
|
-
valueType = value.getType(),
|
|
87
|
+
const valueType = value.getType(),
|
|
88
88
|
variableType = this.type;
|
|
89
89
|
|
|
90
90
|
if (valueType !== variableType) {
|
|
91
|
-
const message = `The '${variableString} variable's '${variableType}' type does not match the
|
|
91
|
+
const message = `The '${variableString} variable's '${variableType}' type does not match the value's '${valueType}' type.'`,
|
|
92
92
|
exception = Exception.fromMessage(message);
|
|
93
93
|
|
|
94
94
|
throw exception;
|
|
@@ -96,7 +96,9 @@ export default domAssigned(class Variable {
|
|
|
96
96
|
|
|
97
97
|
this.value = value;
|
|
98
98
|
|
|
99
|
-
const
|
|
99
|
+
const variable = this; ///
|
|
100
|
+
|
|
101
|
+
context.addVariable(variable);
|
|
100
102
|
|
|
101
103
|
context.debug(`...assigned the ${valueString} value to the '${variableString}' variable.`);
|
|
102
104
|
}
|
|
@@ -125,6 +127,16 @@ export default domAssigned(class Variable {
|
|
|
125
127
|
return variable;
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
static fromParameter(parameter, context) {
|
|
131
|
+
const type = parameter.getType(),
|
|
132
|
+
name = parameter.getName(),
|
|
133
|
+
value = null,
|
|
134
|
+
string = name, ///
|
|
135
|
+
variable = new Variable(string, type, name, value);
|
|
136
|
+
|
|
137
|
+
return variable;
|
|
138
|
+
}
|
|
139
|
+
|
|
128
140
|
static fromNodeQueryNode(nodeQueryNode, context) {
|
|
129
141
|
const nodeQueryVariableNode = nodeQueryVariableNodeQuery(nodeQueryNode),
|
|
130
142
|
variableNode = nodeQueryVariableNode, ///
|
|
@@ -141,6 +153,19 @@ export default domAssigned(class Variable {
|
|
|
141
153
|
return variable;
|
|
142
154
|
}
|
|
143
155
|
|
|
156
|
+
static fromNamedParameter(namedParameter, context) {
|
|
157
|
+
const asName = namedParameter.getAsName(),
|
|
158
|
+
type = namedParameter.getType(),
|
|
159
|
+
name = (asName !== null) ?
|
|
160
|
+
asName : ///
|
|
161
|
+
namedParameter.getName(),
|
|
162
|
+
value = null,
|
|
163
|
+
string = name, ///
|
|
164
|
+
variable = new Variable(string, type, name, value);
|
|
165
|
+
|
|
166
|
+
return variable;
|
|
167
|
+
}
|
|
168
|
+
|
|
144
169
|
static fromValueAndParameter(value, parameter, context) {
|
|
145
170
|
const type = parameter.getType(),
|
|
146
171
|
name = parameter.getName(),
|
|
@@ -176,27 +201,26 @@ export default domAssigned(class Variable {
|
|
|
176
201
|
return variable;
|
|
177
202
|
}
|
|
178
203
|
|
|
179
|
-
static fromValueAndNamedParameter(value, namedParameter, context) {
|
|
180
|
-
const asName = namedParameter.getAsName(),
|
|
181
|
-
name = (asName !== null) ?
|
|
182
|
-
asName : ///
|
|
183
|
-
namedParameter.getName(),
|
|
184
|
-
type = namedParameter.getType(),
|
|
185
|
-
string = name, ///
|
|
186
|
-
variable = new Variable(string, type, name, value);
|
|
187
|
-
|
|
188
|
-
return variable;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
204
|
static fromTypeAndVariableAssignmentNode(type, variableAssignmentNode, context) {
|
|
192
205
|
const variableAssignmentVariableNode = variableAssignmentVariableNodeQuery(variableAssignmentNode),
|
|
193
206
|
variableNode = variableAssignmentVariableNode, ///
|
|
194
|
-
variable =
|
|
207
|
+
variable = variableFromTypeAndVariableNode(type, variableNode, context);
|
|
195
208
|
|
|
196
209
|
return variable;
|
|
197
210
|
}
|
|
198
211
|
});
|
|
199
212
|
|
|
213
|
+
function variableFromTypeAndVariableNode(type, variableNode, context) {
|
|
214
|
+
const { Variable } = dom,
|
|
215
|
+
node = variableNode, ///
|
|
216
|
+
string = context.nodeAsString(node),
|
|
217
|
+
name = nameFromVariableNode(variableNode),
|
|
218
|
+
value = null,
|
|
219
|
+
variable = new Variable(string, type, name, value);
|
|
220
|
+
|
|
221
|
+
return variable;
|
|
222
|
+
}
|
|
223
|
+
|
|
200
224
|
function variableFromVariableNode(variableNode, context) {
|
|
201
225
|
const { Variable } = dom,
|
|
202
226
|
node = variableNode, ///
|
|
@@ -216,20 +240,3 @@ function nameFromVariableNode(variableNode) {
|
|
|
216
240
|
|
|
217
241
|
return name;
|
|
218
242
|
}
|
|
219
|
-
|
|
220
|
-
/*
|
|
221
|
-
|
|
222
|
-
static fromNamedParameterAndAssignment(namedParameter, assignment, context) {
|
|
223
|
-
const asName = namedParameter.getAsName(),
|
|
224
|
-
name = (asName !== null) ?
|
|
225
|
-
asName : ///
|
|
226
|
-
namedParameter.getName(),
|
|
227
|
-
type = namedParameter.getType(),
|
|
228
|
-
value = null,
|
|
229
|
-
string = name, ///
|
|
230
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
231
|
-
|
|
232
|
-
return variable;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
*/
|