occam-furtle 2.0.69 → 2.0.71
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.js +1 -10
- package/lib/dom/block/return.js +31 -4
- package/lib/dom/block.js +1 -1
- package/lib/dom/parameters.js +12 -12
- package/lib/dom/procedure/anonymous.js +28 -24
- package/lib/dom/procedure.js +7 -22
- package/lib/dom/returnStatement.js +5 -10
- package/lib/dom/some.js +3 -4
- package/lib/dom/step.js +3 -12
- package/lib/dom/value.js +2 -2
- package/lib/dom/variable.js +2 -9
- package/lib/index.js +1 -2
- package/package.json +4 -4
- package/src/dom/assignment.js +0 -10
- package/src/dom/block/return.js +51 -10
- package/src/dom/block.js +1 -1
- package/src/dom/parameters.js +17 -17
- package/src/dom/procedure/anonymous.js +51 -37
- package/src/dom/procedure.js +3 -25
- package/src/dom/returnStatement.js +8 -14
- package/src/dom/some.js +2 -4
- package/src/dom/step.js +3 -11
- package/src/dom/value.js +1 -1
- package/src/dom/variable.js +1 -17
- package/src/index.js +0 -1
- package/lib/dom/assignment/variable.js +0 -133
- package/src/dom/assignment/variable.js +0 -52
package/src/dom/block/return.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
|
+
import Exception from "../../exception";
|
|
4
5
|
import BlockContext from "../../context/block";
|
|
5
6
|
|
|
6
|
-
import { nodesQuery } from "../../utilities/query";
|
|
7
7
|
import { domAssigned } from "../../dom";
|
|
8
|
+
import { nodeQuery, nodesQuery } from "../../utilities/query";
|
|
8
9
|
|
|
9
|
-
const stepNodesQuery = nodesQuery("/
|
|
10
|
+
const stepNodesQuery = nodesQuery("/returnBlock/step"),
|
|
11
|
+
nonsenseNodesQuery = nodesQuery("/returnBlock/nonsense"),
|
|
12
|
+
anonymousProcedureReturnBlockNodeQuery = nodeQuery("/anonymousProcedure/returnBlock"),
|
|
13
|
+
procedureDeclarationReturnBlockNodeQuery = nodeQuery("/procedureDeclaration/returnBlock");
|
|
10
14
|
|
|
11
15
|
export default domAssigned(class ReturnBlock {
|
|
12
|
-
constructor(string, steps, returnStatement) {
|
|
16
|
+
constructor(string, steps, nonsensical, returnStatement) {
|
|
13
17
|
this.string = string;
|
|
14
18
|
this.steps = steps;
|
|
19
|
+
this.nonsensical = nonsensical;
|
|
15
20
|
this.returnStatement = returnStatement;
|
|
16
21
|
}
|
|
17
22
|
|
|
@@ -23,11 +28,22 @@ export default domAssigned(class ReturnBlock {
|
|
|
23
28
|
return this.steps;
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
isNonsensical() {
|
|
32
|
+
return this.nonsensical;
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
getReturnStatement() {
|
|
27
36
|
return this.returnStatement;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
evaluate(variables, context) {
|
|
40
|
+
if (this.nonsensical) {
|
|
41
|
+
const message = `The return block is nonsensical.`,
|
|
42
|
+
exception = Exception.fromMessage(message);
|
|
43
|
+
|
|
44
|
+
throw exception;
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
const blockContext = BlockContext.fromVariables(variables, context);
|
|
32
48
|
|
|
33
49
|
context = blockContext; ///
|
|
@@ -44,13 +60,17 @@ export default domAssigned(class ReturnBlock {
|
|
|
44
60
|
static name = "ReturnBlock";
|
|
45
61
|
|
|
46
62
|
static fromProcedureDeclarationNode(procedureDeclarationNode, context) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
const procedureDeclarationReturnBlockNode = procedureDeclarationReturnBlockNodeQuery(procedureDeclarationNode),
|
|
64
|
+
returnBlockNode = procedureDeclarationReturnBlockNode, ///
|
|
65
|
+
returnBlock = returnBlockFromReturnBlockNode(returnBlockNode, context);
|
|
66
|
+
|
|
67
|
+
return returnBlock;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static fromAnonymousProcedureNode(anonymousProcedureNode, context) {
|
|
71
|
+
const anonymousProcedureReturnBlockNode = anonymousProcedureReturnBlockNodeQuery(anonymousProcedureNode),
|
|
72
|
+
returnBlockNode = anonymousProcedureReturnBlockNode, ///
|
|
73
|
+
returnBlock = returnBlockFromReturnBlockNode(returnBlockNode, context);
|
|
54
74
|
|
|
55
75
|
return returnBlock;
|
|
56
76
|
}
|
|
@@ -66,3 +86,24 @@ function stepsFromStepNodes(stepNodes, context) {
|
|
|
66
86
|
|
|
67
87
|
return steps;
|
|
68
88
|
}
|
|
89
|
+
|
|
90
|
+
function returnBlockFromReturnBlockNode(returnBlockNode, context) {
|
|
91
|
+
const { ReturnBlock, ReturnStatement } = dom,
|
|
92
|
+
node = returnBlockNode, ///
|
|
93
|
+
string = context.nodeAsString(node),
|
|
94
|
+
stepNodes = stepNodesQuery(returnBlockNode),
|
|
95
|
+
steps = stepsFromStepNodes(stepNodes, context),
|
|
96
|
+
nonsensical = nonsensicalFromReturnBlockNode(returnBlockNode, context),
|
|
97
|
+
returnStatement = ReturnStatement.fromReturnBlockNode(returnBlockNode, context),
|
|
98
|
+
returnBlock = new ReturnBlock(string, steps, nonsensical, returnStatement);
|
|
99
|
+
|
|
100
|
+
return returnBlock;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function nonsensicalFromReturnBlockNode(returnBlockNode, context) {
|
|
104
|
+
const nonsenseNodes = nonsenseNodesQuery(returnBlockNode),
|
|
105
|
+
nonsenseNodesLength = nonsenseNodes.length,
|
|
106
|
+
nonsensical = (nonsenseNodesLength > 0);
|
|
107
|
+
|
|
108
|
+
return nonsensical;
|
|
109
|
+
}
|
package/src/dom/block.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import BlockContext from "../context/block";
|
|
5
5
|
|
|
6
|
+
import { nodesQuery } from "../utilities/query";
|
|
6
7
|
import { domAssigned } from "../dom";
|
|
7
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
9
|
const stepNodesQuery = nodesQuery("/block/step");
|
|
10
10
|
|
package/src/dom/parameters.js
CHANGED
|
@@ -7,9 +7,9 @@ import { domAssigned } from "../dom";
|
|
|
7
7
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
9
|
const parameterNodesQuery = nodesQuery("/parameters/parameter"),
|
|
10
|
-
someParametersNodeQuery = nodeQuery("/some/parameters"),
|
|
11
10
|
arrayAssignmentParametersNodeQuery = nodeQuery("/arrayAssignment/parameters"),
|
|
12
11
|
objectAssignmentParametersNodeQuery = nodeQuery("/objectAssignment/parameters"),
|
|
12
|
+
anonymousProcedureParametersNodeQuery = nodeQuery("/anonymousProcedure/parameters"),
|
|
13
13
|
procedureDeclarationParametersNodeQuery = nodeQuery("/procedureDeclaration/parameters");
|
|
14
14
|
|
|
15
15
|
export default domAssigned(class Parameters {
|
|
@@ -107,22 +107,6 @@ export default domAssigned(class Parameters {
|
|
|
107
107
|
|
|
108
108
|
static name = "Parameters";
|
|
109
109
|
|
|
110
|
-
static fromSomeNode(someNode, context) {
|
|
111
|
-
const { Parameter } = dom,
|
|
112
|
-
someParametersNode = someParametersNodeQuery(someNode),
|
|
113
|
-
parameterNode = someParametersNode, ///
|
|
114
|
-
parameterNodes = parameterNodesQuery(parameterNode),
|
|
115
|
-
array = parameterNodes.map((parameterNode) => {
|
|
116
|
-
const parameter = Parameter.fromParameterNode(parameterNode, context);
|
|
117
|
-
|
|
118
|
-
return parameter;
|
|
119
|
-
}),
|
|
120
|
-
string = stringFromArray(array, context),
|
|
121
|
-
parameters = new Parameters(string, array);
|
|
122
|
-
|
|
123
|
-
return parameters;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
110
|
static fromStringAndArray(string, array) {
|
|
127
111
|
const parameters = new Parameters(string, array);
|
|
128
112
|
|
|
@@ -153,6 +137,22 @@ export default domAssigned(class Parameters {
|
|
|
153
137
|
return parameters;
|
|
154
138
|
}
|
|
155
139
|
|
|
140
|
+
static fromAnonymousProcedureNode(anonymousProcedureNode, context) {
|
|
141
|
+
const { Parameter } = dom,
|
|
142
|
+
anonymousProcedureParametersNode = anonymousProcedureParametersNodeQuery(anonymousProcedureNode),
|
|
143
|
+
parameterNode = anonymousProcedureParametersNode, ///
|
|
144
|
+
parameterNodes = parameterNodesQuery(parameterNode),
|
|
145
|
+
array = parameterNodes.map((parameterNode) => {
|
|
146
|
+
const parameter = Parameter.fromParameterNode(parameterNode, context);
|
|
147
|
+
|
|
148
|
+
return parameter;
|
|
149
|
+
}),
|
|
150
|
+
string = stringFromArray(array, context),
|
|
151
|
+
parameters = new Parameters(string, array);
|
|
152
|
+
|
|
153
|
+
return parameters;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
156
|
static fromProcedureDeclarationNode(procedureDeclarationNode, context) {
|
|
157
157
|
let parameters = null;
|
|
158
158
|
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
import Exception from "../../exception";
|
|
5
5
|
|
|
6
|
+
import { nodeQuery } from "../../utilities/query";
|
|
6
7
|
import { domAssigned } from "../../dom";
|
|
7
|
-
import { nodeQuery, nodesQuery } from "../../utilities/query";
|
|
8
8
|
import { variablesFromValuesAndParameters } from "../procedure";
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const parametersNodeQuery = nodeQuery("/anonymousProcedure/parameters"),
|
|
11
|
+
typeTerminalNodeQuery = nodeQuery("/anonymousProcedure/@type"),
|
|
12
|
+
somAnonymousProcedureNodeQuery = nodeQuery("/some/anonymousProcedure");
|
|
12
13
|
|
|
13
14
|
export default domAssigned(class AnonymousProcedure {
|
|
14
|
-
constructor(string,
|
|
15
|
+
constructor(string, type, parameters, returnBlock) {
|
|
15
16
|
this.string = string;
|
|
17
|
+
this.type - type;
|
|
16
18
|
this.parameters = parameters;
|
|
17
|
-
this.nonsensical = nonsensical;
|
|
18
19
|
this.returnBlock = returnBlock;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -22,12 +23,12 @@ export default domAssigned(class AnonymousProcedure {
|
|
|
22
23
|
return this.string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
return this.
|
|
26
|
+
getType() {
|
|
27
|
+
return this.type;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
return this.
|
|
30
|
+
getParameters() {
|
|
31
|
+
return this.paramters;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
getReturnBlock() {
|
|
@@ -35,54 +36,67 @@ export default domAssigned(class AnonymousProcedure {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
call(values, context) {
|
|
38
|
-
debugger
|
|
39
|
-
|
|
40
39
|
const anonymousProcedureString = this.string; ///
|
|
41
40
|
|
|
42
41
|
context.trace(`Calling the '${anonymousProcedureString}' anonymous procedure...`);
|
|
43
42
|
|
|
44
|
-
if (this.nonsensical) {
|
|
45
|
-
const message = `The '${anonymousProcedureString}' anonymous procedure is nonsensical.`,
|
|
46
|
-
exception = Exception.fromMessage(message);
|
|
47
|
-
|
|
48
|
-
throw exception;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
this.parameters.matchValues(values, context);
|
|
52
44
|
|
|
53
45
|
const variables = variablesFromValuesAndParameters(values, this.parameters, context);
|
|
54
46
|
|
|
55
|
-
this.returnBlock.evaluate(variables, context)
|
|
47
|
+
const value = this.returnBlock.evaluate(variables, context),
|
|
48
|
+
valueType = value.getType();
|
|
49
|
+
|
|
50
|
+
if (this.type !== valueType) {
|
|
51
|
+
const valueString = value.asString(context),
|
|
52
|
+
message = `The ${valueString} value's '${valueType}' type and the '${anonymousProcedureString}' anonymous procedure's '${this.type}' type do not match.`,
|
|
53
|
+
exception = Exception.fromMessage(message);
|
|
54
|
+
|
|
55
|
+
throw exception;
|
|
56
|
+
}
|
|
56
57
|
|
|
57
58
|
context.debug(`...called the '${anonymousProcedureString}' anonymous procedure.`);
|
|
59
|
+
|
|
60
|
+
return value;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
static name = "AnonymousProcedure";
|
|
61
64
|
|
|
62
65
|
static fromSomeNode(someNode, context) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
anonymousProcedureDeclaration = new AnonymousProcedure(string, parameters, nonsensical, returnBlock);
|
|
69
|
-
|
|
70
|
-
return anonymousProcedureDeclaration;
|
|
66
|
+
const someAnonymousProcedureNode = somAnonymousProcedureNodeQuery(someNode),
|
|
67
|
+
anonymousProcedureNode = someAnonymousProcedureNode, ///
|
|
68
|
+
anonymousProcedure = anonymousProcedureFromAnonymousProcedureNode(anonymousProcedureNode, context);
|
|
69
|
+
|
|
70
|
+
return anonymousProcedure;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
function
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
function anonymousProcedureFromAnonymousProcedureNode(anonymousProcedureNode, context) {
|
|
75
|
+
const { Parameters, ReturnBlock, AnonymousProcedure } = dom,
|
|
76
|
+
string = stringFromAnonymousProcedureNode(anonymousProcedureNode, context),
|
|
77
|
+
type = typeFromProcedureAnonymousProcedureNode(anonymousProcedureNode, context),
|
|
78
|
+
parameters = Parameters.fromAnonymousProcedureNode(anonymousProcedureNode, context),
|
|
79
|
+
returnBlock = ReturnBlock.fromAnonymousProcedureNode(anonymousProcedureNode, context),
|
|
80
|
+
anonymousProcedure = new AnonymousProcedure(string, type, parameters, returnBlock);
|
|
78
81
|
|
|
79
|
-
return
|
|
82
|
+
return anonymousProcedure;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function typeFromProcedureAnonymousProcedureNode(anonymousProcedureNode, context) {
|
|
86
|
+
const typeTerminalNode = typeTerminalNodeQuery(anonymousProcedureNode),
|
|
87
|
+
typeTerminalNodeContent = typeTerminalNode.getContent(),
|
|
88
|
+
type = typeTerminalNodeContent; ///
|
|
89
|
+
|
|
90
|
+
return type;
|
|
80
91
|
}
|
|
81
92
|
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
function stringFromAnonymousProcedureNode(anonymousProcedureNode, context) {
|
|
94
|
+
const parametersNode = parametersNodeQuery(anonymousProcedureNode),
|
|
95
|
+
typeTerminalNode = typeTerminalNodeQuery(anonymousProcedureNode),
|
|
96
|
+
parametersString = context.nodeAsString(parametersNode),
|
|
97
|
+
typeNode = typeTerminalNode, ///
|
|
98
|
+
typeString = context.nodeAsString(typeNode),
|
|
99
|
+
string = `${typeString} (${parametersString}) { ... }`;
|
|
86
100
|
|
|
87
|
-
return
|
|
101
|
+
return string;
|
|
88
102
|
}
|
package/src/dom/procedure.js
CHANGED
|
@@ -3,22 +3,20 @@
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import Exception from "../exception";
|
|
5
5
|
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
6
7
|
import { domAssigned } from "../dom";
|
|
7
8
|
import { BOOLEAN_TYPE } from "../types";
|
|
8
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
9
|
|
|
10
10
|
const labelNodeQuery = nodeQuery("/procedureDeclaration/label"),
|
|
11
|
-
nonsenseNodesQuery = nodesQuery("/procedureDeclaration/returnBlock/nonsense"),
|
|
12
11
|
parametersNodeQuery = nodeQuery("/procedureDeclaration/parameters"),
|
|
13
12
|
typeTerminalNodeQuery = nodeQuery("/procedureDeclaration/@type");
|
|
14
13
|
|
|
15
14
|
export default domAssigned(class Procedure {
|
|
16
|
-
constructor(string, type, label, parameters,
|
|
15
|
+
constructor(string, type, label, parameters, returnBlock) {
|
|
17
16
|
this.string = string;
|
|
18
17
|
this.type = type;
|
|
19
18
|
this.label = label;
|
|
20
19
|
this.parameters = parameters;
|
|
21
|
-
this.nonsensical = nonsensical;
|
|
22
20
|
this.returnBlock = returnBlock;
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -38,10 +36,6 @@ export default domAssigned(class Procedure {
|
|
|
38
36
|
return this.parameters;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
isNonsensical() {
|
|
42
|
-
return this.nonsensical;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
39
|
getReturnBlock() {
|
|
46
40
|
return this.returnBlock;
|
|
47
41
|
}
|
|
@@ -64,13 +58,6 @@ export default domAssigned(class Procedure {
|
|
|
64
58
|
|
|
65
59
|
context.trace(`Calling the '${procedureString}' procedure...`);
|
|
66
60
|
|
|
67
|
-
if (this.nonsensical) {
|
|
68
|
-
const message = `The '${procedureString}' procedure is nonsensical.`,
|
|
69
|
-
exception = Exception.fromMessage(message);
|
|
70
|
-
|
|
71
|
-
throw exception;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
61
|
this.parameters.matchValues(values, context);
|
|
75
62
|
|
|
76
63
|
const variables = variablesFromValuesAndParameters(values, this.parameters, context),
|
|
@@ -100,9 +87,8 @@ export default domAssigned(class Procedure {
|
|
|
100
87
|
type = typeFromProcedureDeclarationNode(procedureDeclarationNode, context),
|
|
101
88
|
label = Label.fromProcedureDeclarationNode(procedureDeclarationNode, context),
|
|
102
89
|
parameters = Parameters.fromProcedureDeclarationNode(procedureDeclarationNode, context),
|
|
103
|
-
nonsensical = nonsensicalFromProcedureDeclarationNode(procedureDeclarationNode, context),
|
|
104
90
|
returnBlock = ReturnBlock.fromProcedureDeclarationNode(procedureDeclarationNode, context),
|
|
105
|
-
procedureDeclaration = new Procedure(string, type, label, parameters,
|
|
91
|
+
procedureDeclaration = new Procedure(string, type, label, parameters, returnBlock);
|
|
106
92
|
|
|
107
93
|
return procedureDeclaration;
|
|
108
94
|
}
|
|
@@ -145,11 +131,3 @@ function stringFromProcedureDeclarationNode(procedureDeclarationNode, context) {
|
|
|
145
131
|
|
|
146
132
|
return string;
|
|
147
133
|
}
|
|
148
|
-
|
|
149
|
-
function nonsensicalFromProcedureDeclarationNode(procedureDeclarationNode, context) {
|
|
150
|
-
const nonsenseNodes = nonsenseNodesQuery(procedureDeclarationNode),
|
|
151
|
-
nonsenseNodesLength = nonsenseNodes.length,
|
|
152
|
-
nonsensical = (nonsenseNodesLength > 0);
|
|
153
|
-
|
|
154
|
-
return nonsensical;
|
|
155
|
-
}
|
|
@@ -5,7 +5,7 @@ import dom from "../dom";
|
|
|
5
5
|
import { nodeQuery } from "../utilities/query";
|
|
6
6
|
import { domAssigned } from "../dom";
|
|
7
7
|
|
|
8
|
-
const returnStatementNodeQuery = nodeQuery("/
|
|
8
|
+
const returnStatementNodeQuery = nodeQuery("/returnBlock/returnStatement");
|
|
9
9
|
|
|
10
10
|
export default domAssigned(class ReturnStatement {
|
|
11
11
|
constructor(string, value) {
|
|
@@ -37,19 +37,13 @@ export default domAssigned(class ReturnStatement {
|
|
|
37
37
|
|
|
38
38
|
static name = "ReturnStatement";
|
|
39
39
|
|
|
40
|
-
static
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
node = returnStatementNode, ///
|
|
48
|
-
string = context.nodeAsString(node),
|
|
49
|
-
value = Value.fromReturnStatementNode(returnStatementNode, context);
|
|
50
|
-
|
|
51
|
-
returnStatement = new ReturnStatement(string, value);
|
|
52
|
-
}
|
|
40
|
+
static fromReturnBlockNode(returnBlockNode, context) {
|
|
41
|
+
const { Value } = dom,
|
|
42
|
+
returnStatementNode = returnStatementNodeQuery(returnBlockNode),
|
|
43
|
+
node = returnStatementNode, ///
|
|
44
|
+
string = context.nodeAsString(node),
|
|
45
|
+
value = Value.fromReturnStatementNode(returnStatementNode, context),
|
|
46
|
+
returnStatement = new ReturnStatement(string, value);
|
|
53
47
|
|
|
54
48
|
return returnStatement;
|
|
55
49
|
}
|
package/src/dom/some.js
CHANGED
|
@@ -31,11 +31,9 @@ export default domAssigned(class Some {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
evaluate(context) {
|
|
34
|
-
debugger
|
|
35
|
-
|
|
36
34
|
const someString = this.getString();
|
|
37
35
|
|
|
38
|
-
context.trace(`Evaluating the '${someString}' some
|
|
36
|
+
context.trace(`Evaluating the '${someString}' some...`);
|
|
39
37
|
|
|
40
38
|
const value = this.variable.evaluate(context),
|
|
41
39
|
valueType = value.getType();
|
|
@@ -58,7 +56,7 @@ export default domAssigned(class Some {
|
|
|
58
56
|
this.anonymousProcedure.call(values, context);
|
|
59
57
|
});
|
|
60
58
|
|
|
61
|
-
context.trace(`...evaluated the '${someString}' some
|
|
59
|
+
context.trace(`...evaluated the '${someString}' some.`);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
static name = "Some";
|
package/src/dom/step.js
CHANGED
|
@@ -5,12 +5,11 @@ import dom from "../dom";
|
|
|
5
5
|
import { domAssigned } from "../dom";
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class Step {
|
|
8
|
-
constructor(string, arrayAssignment, objectAssigment, conditionalBlocks,
|
|
8
|
+
constructor(string, arrayAssignment, objectAssigment, conditionalBlocks, variablesDeclaration) {
|
|
9
9
|
this.string = string;
|
|
10
10
|
this.arrayAssignment = arrayAssignment;
|
|
11
11
|
this.objectAssigment = objectAssigment;
|
|
12
12
|
this.conditionalBlocks = conditionalBlocks;
|
|
13
|
-
this.variableAssignment = variableAssignment;
|
|
14
13
|
this.variablesDeclaration = variablesDeclaration;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -30,10 +29,6 @@ export default domAssigned(class Step {
|
|
|
30
29
|
return this.conditionalBlocks;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
getVariableAssignment() {
|
|
34
|
-
return this.variableAssignment;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
32
|
getVariablesDeclaration() {
|
|
38
33
|
return this.variablesDeclaration;
|
|
39
34
|
}
|
|
@@ -48,8 +43,6 @@ export default domAssigned(class Step {
|
|
|
48
43
|
this.objectAssigment.evaluate(context);
|
|
49
44
|
} else if (this.conditionalBlocks !== null) {
|
|
50
45
|
this.conditionalBlocks.evaluate(context);
|
|
51
|
-
} else if (this.variableAssignment !== null) {
|
|
52
|
-
this.variableAssignment.evaluate(context);
|
|
53
46
|
} else if (this.variablesDeclaration !== null) {
|
|
54
47
|
this.variablesDeclaration.evaluate(context);
|
|
55
48
|
}
|
|
@@ -58,15 +51,14 @@ export default domAssigned(class Step {
|
|
|
58
51
|
static name = "Step";
|
|
59
52
|
|
|
60
53
|
static fromStepNode(stepNode, context) {
|
|
61
|
-
const { ArrayAssignment, ObjectAssigment, ConditionalBlocks,
|
|
54
|
+
const { ArrayAssignment, ObjectAssigment, ConditionalBlocks, VariablesDeclaration } = dom,
|
|
62
55
|
node = stepNode, ///
|
|
63
56
|
string = context.nodeAsString(node),
|
|
64
57
|
arrayAssignment = ArrayAssignment.fromStepNode(stepNode, context),
|
|
65
58
|
objectAssigment = ObjectAssigment.fromStepNode(stepNode, context),
|
|
66
59
|
conditionalBlocks = ConditionalBlocks.fromStepNode(stepNode, context),
|
|
67
|
-
variableAssignment = VariableAssignment.fromStepNode(stepNode, context),
|
|
68
60
|
variablesDeclaration = VariablesDeclaration.fromStepNode(stepNode, context),
|
|
69
|
-
step = new Step(string, arrayAssignment, objectAssigment, conditionalBlocks,
|
|
61
|
+
step = new Step(string, arrayAssignment, objectAssigment, conditionalBlocks, variablesDeclaration);
|
|
70
62
|
|
|
71
63
|
return step;
|
|
72
64
|
}
|
package/src/dom/value.js
CHANGED
|
@@ -19,7 +19,7 @@ const ternaryValueNodeQuery = nodeQuery("/ternary/value"),
|
|
|
19
19
|
primitiveTerminalNodeQuery = nodeQuery("/value/@primitive"),
|
|
20
20
|
returnStatementValueNodeQuery = nodeQuery("/returnStatement/value"),
|
|
21
21
|
stringLiteralTerminalNodeQuery = nodeQuery("/value/@string-literal"),
|
|
22
|
-
conditionalBlocksCValueNodeQuery = nodeQuery("/conditionalBlocks/
|
|
22
|
+
conditionalBlocksCValueNodeQuery = nodeQuery("/conditionalBlocks/value");
|
|
23
23
|
|
|
24
24
|
export default domAssigned(class Value {
|
|
25
25
|
constructor(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, negatedValue, bitwiseValue, bracketedValue, procedureCall) {
|
package/src/dom/variable.js
CHANGED
|
@@ -12,8 +12,7 @@ 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")
|
|
16
|
-
variableAssignmentVariableNodeQuery = nodeQuery("/variableAssignment/variable");
|
|
15
|
+
objectAssignmentVariableNodeQuery = nodeQuery("/objectAssignment/variable");
|
|
17
16
|
|
|
18
17
|
export default domAssigned(class Variable {
|
|
19
18
|
constructor(string, type, name, value, assignment) {
|
|
@@ -218,21 +217,6 @@ export default domAssigned(class Variable {
|
|
|
218
217
|
return variable;
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
static fromVariableAssignmentNode(variableAssignmentNode, context) {
|
|
222
|
-
const { Assignment } = dom,
|
|
223
|
-
variableAssignmentVariableNode = variableAssignmentVariableNodeQuery(variableAssignmentNode),
|
|
224
|
-
variableNode = variableAssignmentVariableNode, ///
|
|
225
|
-
node = variableNode, ///
|
|
226
|
-
string = context.nodeAsString(node),
|
|
227
|
-
type = null,
|
|
228
|
-
name = nameFromVariableNode(variableNode),
|
|
229
|
-
value = null,
|
|
230
|
-
assignment = Assignment.fromVariableAssignmentNode(variableAssignmentNode, context),
|
|
231
|
-
variable = new Variable(string, type, name, value, assignment);
|
|
232
|
-
|
|
233
|
-
return variable;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
220
|
static fromTypeVariableNodeAndAssignmentNode(type, variableNode, assignmentNode, context) {
|
|
237
221
|
const { Assignment } = dom,
|
|
238
222
|
node = variableNode, ///
|
package/src/index.js
CHANGED
|
@@ -27,7 +27,6 @@ import ReturnStatement from "./dom/returnStatement";
|
|
|
27
27
|
import ObjectAssignment from "./dom/assignment/object";
|
|
28
28
|
import ConditionalBlocks from "./dom/conditionalBlocks";
|
|
29
29
|
import AnonymousProcedure from "./dom/procedure/anonymous";
|
|
30
|
-
import VariableAssignment from "./dom/assignment/variable";
|
|
31
30
|
import ProcedureDeclaration from "./dom/declaration/procedure";
|
|
32
31
|
import VariablesDeclaration from "./dom/declaration/variables";
|
|
33
32
|
|