occam-furtle 2.0.73 → 2.0.75
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 +16 -3
- package/lib/dom/assignment/object.js +10 -7
- package/lib/dom/assignment/variable.js +150 -0
- package/lib/dom/assignments/variable.js +149 -0
- package/lib/dom/procedure/anonymous.js +10 -3
- package/lib/dom/procedureCall/anonymous.js +141 -0
- package/lib/dom/{returnStatement.js → statement/return.js} +3 -3
- package/lib/dom/value.js +51 -20
- package/lib/dom/values.js +9 -2
- package/lib/dom/variable.js +45 -77
- package/lib/index.js +5 -4
- package/package.json +4 -4
- package/src/dom/assignment/array.js +18 -3
- package/src/dom/assignment/object.js +12 -9
- package/src/dom/assignment/variable.js +69 -0
- package/src/dom/assignments/variable.js +80 -0
- package/src/dom/procedure/anonymous.js +11 -2
- package/src/dom/procedureCall/anonymous.js +61 -0
- package/src/dom/{returnStatement.js → statement/return.js} +3 -3
- package/src/dom/value.js +57 -23
- package/src/dom/values.js +10 -1
- package/src/dom/variable.js +53 -83
- package/src/index.js +4 -4
- package/lib/dom/assignment.js +0 -160
- package/lib/dom/declaration/variables.js +0 -148
- package/lib/utilities/node.js +0 -21
- package/src/dom/assignment.js +0 -84
- package/src/dom/declaration/variables.js +0 -82
- package/src/utilities/node.js +0 -16
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import dom from "../../dom";
|
|
4
|
+
|
|
5
|
+
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { domAssigned } from "../../dom";
|
|
7
|
+
|
|
8
|
+
const anonymousProcedureCallNodeQuery = nodeQuery("/value/anonymousProcedureCall");
|
|
9
|
+
|
|
10
|
+
export default domAssigned(class AnonymousProcedureCall {
|
|
11
|
+
constructor(string, anonymousProcedure, values) {
|
|
12
|
+
this.string = string;
|
|
13
|
+
this.anonymousProcedure = anonymousProcedure;
|
|
14
|
+
this.values = values;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getString() {
|
|
18
|
+
return this.string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getAnonymousProcedure() {
|
|
22
|
+
return this.anonymousProcedure;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getValues() {
|
|
26
|
+
return this.values;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
evaluate(context) {
|
|
30
|
+
const anonymousProcedureCallString = this.string; ///
|
|
31
|
+
|
|
32
|
+
context.trace(`Evaluating the '${anonymousProcedureCallString}' anonymous procedure call...`);
|
|
33
|
+
|
|
34
|
+
const values = this.values.evaluate(context),
|
|
35
|
+
value = this.anonymousProcedure.call(values, context);
|
|
36
|
+
|
|
37
|
+
context.debug(`...evaluated the '${anonymousProcedureCallString}' anonymous procedure call.`);
|
|
38
|
+
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static name = "AnonymousProcedureCall";
|
|
43
|
+
|
|
44
|
+
static fromValueNode(valueNode, context) {
|
|
45
|
+
let anonymousProcedureCall = null;
|
|
46
|
+
|
|
47
|
+
const anonymousProcedureCallNode = anonymousProcedureCallNodeQuery(valueNode);
|
|
48
|
+
|
|
49
|
+
if (anonymousProcedureCallNode !== null) {
|
|
50
|
+
const { Values, AnonymousProcedure } = dom,
|
|
51
|
+
node = anonymousProcedureCallNode, ///
|
|
52
|
+
string = context.nodeAsString(node),
|
|
53
|
+
anonymousProcedure = AnonymousProcedure.fromAnonymousProcedureCallNode(anonymousProcedureCallNode, context),
|
|
54
|
+
values = Values.fromAnonymousProcedureCallNode(anonymousProcedureCallNode, context);
|
|
55
|
+
|
|
56
|
+
anonymousProcedureCall = new AnonymousProcedureCall(string, anonymousProcedure, values);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return anonymousProcedureCall;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import dom from "
|
|
3
|
+
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
-
import { nodeQuery } from "
|
|
6
|
-
import { domAssigned } from "
|
|
5
|
+
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { domAssigned } from "../../dom";
|
|
7
7
|
|
|
8
8
|
const returnStatementNodeQuery = nodeQuery("/returnBlock/returnStatement");
|
|
9
9
|
|
package/src/dom/value.js
CHANGED
|
@@ -15,14 +15,14 @@ const { match } = arrayUtilities;
|
|
|
15
15
|
const ternaryValueNodeQuery = nodeQuery("/ternary/value"),
|
|
16
16
|
numberTerminalNodeQuery = nodeQuery("/value/@number"),
|
|
17
17
|
conditionValueNodeQuery = nodeQuery("/condition/value"),
|
|
18
|
-
assignmentValueNodeQuery = nodeQuery("/assignment/value"),
|
|
19
18
|
primitiveTerminalNodeQuery = nodeQuery("/value/@primitive"),
|
|
20
19
|
returnStatementValueNodeQuery = nodeQuery("/returnStatement/value"),
|
|
21
20
|
stringLiteralTerminalNodeQuery = nodeQuery("/value/@string-literal"),
|
|
22
|
-
conditionalBlocksCValueNodeQuery = nodeQuery("/conditionalBlocks/value")
|
|
21
|
+
conditionalBlocksCValueNodeQuery = nodeQuery("/conditionalBlocks/value"),
|
|
22
|
+
variableAssignmentValueNodeQuery = nodeQuery("/variableAssignment/value");
|
|
23
23
|
|
|
24
24
|
export default domAssigned(class Value {
|
|
25
|
-
constructor(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall) {
|
|
25
|
+
constructor(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall) {
|
|
26
26
|
this.node = node;
|
|
27
27
|
this.nodes = nodes;
|
|
28
28
|
this.number = number;
|
|
@@ -38,6 +38,7 @@ export default domAssigned(class Value {
|
|
|
38
38
|
this.bitwiseValue = bitwiseValue;
|
|
39
39
|
this.bracketedValue = bracketedValue;
|
|
40
40
|
this.procedureCall = procedureCall;
|
|
41
|
+
this.anonymousProcedureCall = anonymousProcedureCall;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
getNode() {
|
|
@@ -100,6 +101,10 @@ export default domAssigned(class Value {
|
|
|
100
101
|
return this.procedureCall;
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
getAnonymousProcedureCall() {
|
|
105
|
+
return this.anonymousProcedureCall;
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
getType() {
|
|
104
109
|
let type;
|
|
105
110
|
|
|
@@ -127,8 +132,16 @@ export default domAssigned(class Value {
|
|
|
127
132
|
type = this.nodesQuery.getType();
|
|
128
133
|
} else if (this.comparison !== null) {
|
|
129
134
|
type = this.comparison.getType();
|
|
135
|
+
} else if (this.negatedValue !== null) {
|
|
136
|
+
type = this.negatedValue.getType();
|
|
137
|
+
} else if (this.bitwiseValue !== null) {
|
|
138
|
+
type = this.bitwiseValue.getType();
|
|
139
|
+
} else if (this.bracketedValue !== null) {
|
|
140
|
+
type = this.bracketedValue.getType();
|
|
130
141
|
} else if (this.procedureCall !== null) {
|
|
131
142
|
type = this.procedureCall.getType();
|
|
143
|
+
} else if (this.anonymousProcedureCall !== null) {
|
|
144
|
+
type = this.anonymousProcedureCall.getType();
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
return type;
|
|
@@ -161,8 +174,16 @@ export default domAssigned(class Value {
|
|
|
161
174
|
string = this.nodesQuery.asString(context);
|
|
162
175
|
} else if (this.comparison !== null) {
|
|
163
176
|
string = this.comparison.asString(context);
|
|
177
|
+
} else if (this.negatedValue !== null) {
|
|
178
|
+
string = this.negatedValue.asString(context);
|
|
179
|
+
} else if (this.bitwiseValue !== null) {
|
|
180
|
+
string = this.bitwiseValue.asString(context);
|
|
181
|
+
} else if (this.bracketedValue !== null) {
|
|
182
|
+
string = this.bracketedValue.asString(context);
|
|
164
183
|
} else if (this.procedureCall !== null) {
|
|
165
184
|
string = this.procedureCall.asString(context);
|
|
185
|
+
} else if (this.anonymousProcedureCall !== null) {
|
|
186
|
+
string = this.anonymousProcedureCall.asString(context);
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
return string;
|
|
@@ -191,8 +212,16 @@ export default domAssigned(class Value {
|
|
|
191
212
|
value = this.nodesQuery.evaluate(context);
|
|
192
213
|
} else if (this.comparison !== null) {
|
|
193
214
|
value = this.comparison.evaluate(context);
|
|
215
|
+
} else if (this.negatedValue !== null) {
|
|
216
|
+
value = this.negatedValue.evaluate(context);
|
|
217
|
+
} else if (this.bitwiseValue !== null) {
|
|
218
|
+
value = this.bitwiseValue.evaluate(context);
|
|
219
|
+
} else if (this.bracketedValue !== null) {
|
|
220
|
+
value = this.bracketedValue.evaluate(context);
|
|
194
221
|
} else if (this.procedureCall !== null) {
|
|
195
222
|
value = this.procedureCall.evaluate(context);
|
|
223
|
+
} else if (this.anonymousProcedureCall !== null) {
|
|
224
|
+
value = this.anonymousProcedureCall.evaluate(context);
|
|
196
225
|
}
|
|
197
226
|
|
|
198
227
|
return value;
|
|
@@ -267,7 +296,8 @@ export default domAssigned(class Value {
|
|
|
267
296
|
bitwiseValue = null,
|
|
268
297
|
bracketedValue = null,
|
|
269
298
|
procedureCall = null,
|
|
270
|
-
|
|
299
|
+
anonymousProcedureCall = null,
|
|
300
|
+
value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall);
|
|
271
301
|
|
|
272
302
|
return value;
|
|
273
303
|
}
|
|
@@ -287,7 +317,8 @@ export default domAssigned(class Value {
|
|
|
287
317
|
bitwiseValue = null,
|
|
288
318
|
bracketedValue = null,
|
|
289
319
|
procedureCall = null,
|
|
290
|
-
|
|
320
|
+
anonymousProcedureCall = null,
|
|
321
|
+
value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall);
|
|
291
322
|
|
|
292
323
|
return value;
|
|
293
324
|
}
|
|
@@ -307,7 +338,8 @@ export default domAssigned(class Value {
|
|
|
307
338
|
bitwiseValue = null,
|
|
308
339
|
bracketedValue = null,
|
|
309
340
|
procedureCall = null,
|
|
310
|
-
|
|
341
|
+
anonymousProcedureCall = null,
|
|
342
|
+
value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall);
|
|
311
343
|
|
|
312
344
|
return value;
|
|
313
345
|
}
|
|
@@ -327,7 +359,8 @@ export default domAssigned(class Value {
|
|
|
327
359
|
bitwiseValue = null,
|
|
328
360
|
bracketedValue = null,
|
|
329
361
|
procedureCall = null,
|
|
330
|
-
|
|
362
|
+
anonymousProcedureCall = null,
|
|
363
|
+
value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall);
|
|
331
364
|
|
|
332
365
|
return value;
|
|
333
366
|
}
|
|
@@ -360,20 +393,6 @@ export default domAssigned(class Value {
|
|
|
360
393
|
return value;
|
|
361
394
|
}
|
|
362
395
|
|
|
363
|
-
static fromAssignmentNode(assigmentNode, context) {
|
|
364
|
-
let value = null;
|
|
365
|
-
|
|
366
|
-
const assignmentValueNode = assignmentValueNodeQuery(assigmentNode);
|
|
367
|
-
|
|
368
|
-
if (assignmentValueNode !== null) {
|
|
369
|
-
const valueNode = assignmentValueNode; ///
|
|
370
|
-
|
|
371
|
-
value = valueFromValueNode(valueNode, context);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return value;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
396
|
static fromReturnStatementNode(returnStatementNode, context) {
|
|
378
397
|
let value = null;
|
|
379
398
|
|
|
@@ -395,6 +414,20 @@ export default domAssigned(class Value {
|
|
|
395
414
|
|
|
396
415
|
return value;
|
|
397
416
|
}
|
|
417
|
+
|
|
418
|
+
static fromVariableAssignmentNode(variableAssigmentNode, context) {
|
|
419
|
+
let value = null;
|
|
420
|
+
|
|
421
|
+
const variableAssignmentValueNode = variableAssignmentValueNodeQuery(variableAssigmentNode);
|
|
422
|
+
|
|
423
|
+
if (variableAssignmentValueNode !== null) {
|
|
424
|
+
const valueNode = variableAssignmentValueNode; ///
|
|
425
|
+
|
|
426
|
+
value = valueFromValueNode(valueNode, context);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return value;
|
|
430
|
+
}
|
|
398
431
|
});
|
|
399
432
|
|
|
400
433
|
function matchNode(nodeA, nodeB) {
|
|
@@ -470,7 +503,7 @@ function booleanAsString(boolean, context) {
|
|
|
470
503
|
}
|
|
471
504
|
|
|
472
505
|
function valueFromValueNode(valueNode, context) {
|
|
473
|
-
const { Some, Value, Ternary, Variable, NodeQuery, NodesQuery, Comparison, NegatedValue, BitwiseValue, BracketedValue, ProcedureCall } = dom,
|
|
506
|
+
const { Some, Value, Ternary, Variable, NodeQuery, NodesQuery, Comparison, NegatedValue, BitwiseValue, BracketedValue, ProcedureCall, AnonymousProcedureCall } = dom,
|
|
474
507
|
node = nodeFromValueNode(valueNode, context),
|
|
475
508
|
nodes = nodesFromValueNode(valueNode, context),
|
|
476
509
|
number = numberFromValueNode(valueNode, context),
|
|
@@ -486,7 +519,8 @@ function valueFromValueNode(valueNode, context) {
|
|
|
486
519
|
bitwiseValue = BitwiseValue.fromValueNode(valueNode, context),
|
|
487
520
|
bracketedValue = BracketedValue.fromValueNode(valueNode, context),
|
|
488
521
|
procedureCall = ProcedureCall.fromValueNode(valueNode, context),
|
|
489
|
-
|
|
522
|
+
anonymousProcedureCall = AnonymousProcedureCall.fromValueNode(valueNode, context),
|
|
523
|
+
value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall, anonymousProcedureCall);
|
|
490
524
|
|
|
491
525
|
return value;
|
|
492
526
|
}
|
package/src/dom/values.js
CHANGED
|
@@ -6,7 +6,8 @@ import { domAssigned } from "../dom";
|
|
|
6
6
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
8
|
const valuesNodeQuery = nodeQuery("/value/procedureCall/values"),
|
|
9
|
-
valueNodesQuery = nodesQuery("/values/value")
|
|
9
|
+
valueNodesQuery = nodesQuery("/values/value"),
|
|
10
|
+
anonymousProcedureCallValuesNodeQuery = nodeQuery("/anonymousProcedureCall/values");
|
|
10
11
|
|
|
11
12
|
export default domAssigned(class Values {
|
|
12
13
|
constructor(string, array) {
|
|
@@ -97,6 +98,14 @@ export default domAssigned(class Values {
|
|
|
97
98
|
|
|
98
99
|
return values;
|
|
99
100
|
}
|
|
101
|
+
|
|
102
|
+
static fromAnonymousProcedureCallNode(anonymousProcedureCallNode, context) {
|
|
103
|
+
const anonymousProcedureCallValuesNode = anonymousProcedureCallValuesNodeQuery(anonymousProcedureCallNode),
|
|
104
|
+
valuesNode = anonymousProcedureCallValuesNode, ///
|
|
105
|
+
values = valuesFromValuesNode(valuesNode, context);
|
|
106
|
+
|
|
107
|
+
return values;
|
|
108
|
+
}
|
|
100
109
|
});
|
|
101
110
|
|
|
102
111
|
function arrayFromNodes(nodes, context) {
|
package/src/dom/variable.js
CHANGED
|
@@ -12,15 +12,15 @@ const someVariableNodeQuery = nodeQuery("/some/variable"),
|
|
|
12
12
|
nodesQueryVariableNodeQuery = nodeQuery("/nodesQuery/variable"),
|
|
13
13
|
variableNameTerminalNodeQuery = nodeQuery("/variable/@name"),
|
|
14
14
|
arrayAssignmentVariableNodeQuery = nodeQuery("/arrayAssignment/variable"),
|
|
15
|
-
objectAssignmentVariableNodeQuery = nodeQuery("/objectAssignment/variable")
|
|
15
|
+
objectAssignmentVariableNodeQuery = nodeQuery("/objectAssignment/variable"),
|
|
16
|
+
variableAssignmentVariableNodeQuery = nodeQuery("/variableAssignment/variable");
|
|
16
17
|
|
|
17
18
|
export default domAssigned(class Variable {
|
|
18
|
-
constructor(string, type, name, value
|
|
19
|
+
constructor(string, type, name, value) {
|
|
19
20
|
this.string = string;
|
|
20
21
|
this.type = type;
|
|
21
22
|
this.name = name;
|
|
22
23
|
this.value = value;
|
|
23
|
-
this.assignment = assignment;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
getString() {
|
|
@@ -39,41 +39,37 @@ export default domAssigned(class Variable {
|
|
|
39
39
|
return this.value;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
42
|
+
matchVariableName(variableName) {
|
|
43
|
+
const nameMatches = (this.name === variableName);
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
this.string = string;
|
|
45
|
+
return nameMatches;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
48
|
+
evaluate(context) {
|
|
49
|
+
const variableString = this.string; ///
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
this.name = name;
|
|
56
|
-
}
|
|
51
|
+
context.trace(`Evaluating the '${variableString}' variable...`);
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
53
|
+
const variableName = this.name, ///
|
|
54
|
+
variablePresent = context.isVariablePresentByVariableName(variableName);
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
if (!variablePresent) {
|
|
57
|
+
const message = `The '${variableString}; variable is not present.'`,
|
|
58
|
+
exception = Exception.fromMessage(message);
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
throw exception;
|
|
61
|
+
}
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
const variable = context.findVariableByVariableName(variableName),
|
|
64
|
+
value = variable.getValue(),
|
|
65
|
+
valueString = value.asString(context);
|
|
66
|
+
|
|
67
|
+
context.debug(`...evaluated the '${variableString}' variable to the ${valueString} value.`);
|
|
68
|
+
|
|
69
|
+
return value;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
assign(context) {
|
|
73
|
-
if (this.assignment === null) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
73
|
const variableName = this.name, ///
|
|
78
74
|
variableString = this.string, ///
|
|
79
75
|
variablePresent = context.isVariablePresentByVariableName(variableName);
|
|
@@ -87,10 +83,9 @@ export default domAssigned(class Variable {
|
|
|
87
83
|
throw exception;
|
|
88
84
|
}
|
|
89
85
|
|
|
90
|
-
const value = this.
|
|
91
|
-
variable = context.findVariableByVariableName(variableName),
|
|
86
|
+
const value = this.value.evaluate(context),
|
|
92
87
|
valueType = value.getType(),
|
|
93
|
-
variableType =
|
|
88
|
+
variableType = this.type;
|
|
94
89
|
|
|
95
90
|
if (valueType !== variableType) {
|
|
96
91
|
const message = `The '${variableString} variable's '${variableType}' type does not match the assigned value's '${valueType}' type.'`,
|
|
@@ -99,37 +94,13 @@ export default domAssigned(class Variable {
|
|
|
99
94
|
throw exception;
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
|
|
97
|
+
this.value = value;
|
|
103
98
|
|
|
104
99
|
const valueString = value.asString(context);
|
|
105
100
|
|
|
106
101
|
context.debug(`...assigned the ${valueString} value to the '${variableString}' variable.`);
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
evaluate(context) {
|
|
110
|
-
const variableString = this.string; ///
|
|
111
|
-
|
|
112
|
-
context.trace(`Evaluating the '${variableString}' variable...`);
|
|
113
|
-
|
|
114
|
-
const variableName = this.name, ///
|
|
115
|
-
variablePresent = context.isVariablePresentByVariableName(variableName);
|
|
116
|
-
|
|
117
|
-
if (!variablePresent) {
|
|
118
|
-
const message = `The '${variableString}; variable is not present.'`,
|
|
119
|
-
exception = Exception.fromMessage(message);
|
|
120
|
-
|
|
121
|
-
throw exception;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const variable = context.findVariableByVariableName(variableName),
|
|
125
|
-
value = variable.getValue(),
|
|
126
|
-
valueString = value.asString(context);
|
|
127
|
-
|
|
128
|
-
context.debug(`...evaluated the '${variableString}' variable to the ${valueString} value.`);
|
|
129
|
-
|
|
130
|
-
return value;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
104
|
static name = "Variable";
|
|
134
105
|
|
|
135
106
|
static fromSomeNode(someLoopNode, context) {
|
|
@@ -174,8 +145,7 @@ export default domAssigned(class Variable {
|
|
|
174
145
|
const type = parameter.getType(),
|
|
175
146
|
name = parameter.getName(),
|
|
176
147
|
string = name, ///
|
|
177
|
-
|
|
178
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
148
|
+
variable = new Variable(string, type, name, value);
|
|
179
149
|
|
|
180
150
|
return variable;
|
|
181
151
|
}
|
|
@@ -185,8 +155,7 @@ export default domAssigned(class Variable {
|
|
|
185
155
|
string = context.nodeAsString(node),
|
|
186
156
|
name = nameFromVariableNode(variableNode),
|
|
187
157
|
value = null,
|
|
188
|
-
|
|
189
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
158
|
+
variable = new Variable(string, type, name, value);
|
|
190
159
|
|
|
191
160
|
return variable;
|
|
192
161
|
}
|
|
@@ -207,37 +176,22 @@ export default domAssigned(class Variable {
|
|
|
207
176
|
return variable;
|
|
208
177
|
}
|
|
209
178
|
|
|
210
|
-
static
|
|
211
|
-
const type = parameter.getType(),
|
|
212
|
-
name = parameter.getName(),
|
|
213
|
-
value = null,
|
|
214
|
-
string = name, ///
|
|
215
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
216
|
-
|
|
217
|
-
return variable;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
static fromNamedParameterAndAssignment(namedParameter, assignment, context) {
|
|
179
|
+
static fromValueAndNamedParameter(value, namedParameter, context) {
|
|
221
180
|
const asName = namedParameter.getAsName(),
|
|
222
181
|
name = (asName !== null) ?
|
|
223
182
|
asName : ///
|
|
224
|
-
|
|
183
|
+
namedParameter.getName(),
|
|
225
184
|
type = namedParameter.getType(),
|
|
226
|
-
value = null,
|
|
227
185
|
string = name, ///
|
|
228
|
-
variable = new Variable(string, type, name, value
|
|
186
|
+
variable = new Variable(string, type, name, value);
|
|
229
187
|
|
|
230
188
|
return variable;
|
|
231
189
|
}
|
|
232
190
|
|
|
233
|
-
static
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
name = nameFromVariableNode(variableNode),
|
|
238
|
-
value = null,
|
|
239
|
-
assignment = Assignment.fromAssignmentNode(assignmentNode, context),
|
|
240
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
191
|
+
static fromTypeAndVariableAssignmentNode(type, variableAssignmentNode, context) {
|
|
192
|
+
const variableAssignmentVariableNode = variableAssignmentVariableNodeQuery(variableAssignmentNode),
|
|
193
|
+
variableNode = variableAssignmentVariableNode, ///
|
|
194
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
241
195
|
|
|
242
196
|
return variable;
|
|
243
197
|
}
|
|
@@ -250,8 +204,7 @@ function variableFromVariableNode(variableNode, context) {
|
|
|
250
204
|
type = null,
|
|
251
205
|
name = nameFromVariableNode(variableNode),
|
|
252
206
|
value = null,
|
|
253
|
-
|
|
254
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
207
|
+
variable = new Variable(string, type, name, value);
|
|
255
208
|
|
|
256
209
|
return variable;
|
|
257
210
|
}
|
|
@@ -263,3 +216,20 @@ function nameFromVariableNode(variableNode) {
|
|
|
263
216
|
|
|
264
217
|
return name;
|
|
265
218
|
}
|
|
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
|
+
*/
|
package/src/index.js
CHANGED
|
@@ -16,7 +16,6 @@ import Parameter from "./dom/parameter";
|
|
|
16
16
|
import Parameters from "./dom/parameters";
|
|
17
17
|
import NodesQuery from "./dom/query/nodes";
|
|
18
18
|
import Comparison from "./dom/comparison";
|
|
19
|
-
import Assignment from "./dom/assignment";
|
|
20
19
|
import ReturnBlock from "./dom/block/return";
|
|
21
20
|
import NegatedValue from "./dom/value/negated";
|
|
22
21
|
import BitwiseValue from "./dom/value/bitwise";
|
|
@@ -24,15 +23,16 @@ import ProcedureCall from "./dom/procedureCall";
|
|
|
24
23
|
import NamedParameter from "./dom/parameter/named";
|
|
25
24
|
import BracketedValue from "./dom/value/bracketed";
|
|
26
25
|
import ArrayAssigment from "./dom/assignment/array";
|
|
27
|
-
import ReturnStatement from "./dom/
|
|
26
|
+
import ReturnStatement from "./dom/statement/return";
|
|
28
27
|
import NamedParameters from "./dom/parameters/named";
|
|
29
28
|
import ObjectAssignment from "./dom/assignment/object";
|
|
30
29
|
import ConditionalBlocks from "./dom/conditionalBlocks";
|
|
31
30
|
import AnonymousProcedure from "./dom/procedure/anonymous";
|
|
31
|
+
import VariableAssignment from "./dom/assignment/variable";
|
|
32
|
+
import VariableAssignments from "./dom/assignments/variable";
|
|
32
33
|
import ProcedureDeclaration from "./dom/declaration/procedure";
|
|
33
|
-
import
|
|
34
|
+
import AnonymousProcedureCall from "./dom/procedureCall/anonymous";
|
|
34
35
|
|
|
35
36
|
export { default as Values } from "./dom/values";
|
|
36
37
|
export { default as FileContext } from "./context/file";
|
|
37
38
|
export { default as stringUtilities } from "./utilities/string";
|
|
38
|
-
|