occam-furtle 2.0.80 → 2.0.82
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/constants.js +9 -1
- package/lib/dom/assignment/array.js +6 -2
- package/lib/dom/assignment/object.js +6 -2
- package/lib/dom/assignment/variable.js +6 -2
- package/lib/dom/assignments/variable.js +10 -2
- package/lib/dom/block/return.js +8 -4
- package/lib/dom/block.js +6 -2
- package/lib/dom/comparison.js +7 -3
- package/lib/dom/conditionalBlocks.js +8 -8
- package/lib/dom/declaration/procedure.js +6 -2
- package/lib/dom/parameter/named.js +10 -2
- package/lib/dom/parameters/named.js +10 -2
- package/lib/dom/procedure/anonymous.js +9 -2
- package/lib/dom/procedureCall/anonymous.js +6 -2
- package/lib/dom/reduce.js +34 -32
- package/lib/dom/statement/return.js +6 -2
- package/lib/dom/ternary.js +5 -7
- package/lib/dom/value/bitwise.js +7 -3
- package/lib/dom/value/bracketed.js +6 -2
- package/lib/dom/value/negated.js +6 -2
- package/lib/dom/value.js +29 -22
- package/lib/dom/values.js +7 -1
- package/lib/dom/variable.js +9 -2
- package/lib/nodeProperty.js +2 -2
- package/package.json +5 -5
- package/src/constants.js +2 -0
- package/src/dom/assignment/array.js +10 -3
- package/src/dom/assignment/object.js +10 -3
- package/src/dom/assignment/variable.js +9 -2
- package/src/dom/assignments/variable.js +18 -4
- package/src/dom/block/return.js +12 -6
- package/src/dom/block.js +9 -4
- package/src/dom/comparison.js +15 -5
- package/src/dom/conditionalBlocks.js +10 -10
- package/src/dom/declaration/procedure.js +8 -2
- package/src/dom/parameter/named.js +14 -2
- package/src/dom/parameters/named.js +16 -2
- package/src/dom/procedure/anonymous.js +9 -0
- package/src/dom/procedureCall/anonymous.js +10 -3
- package/src/dom/reduce.js +44 -44
- package/src/dom/statement/return.js +8 -2
- package/src/dom/ternary.js +8 -15
- package/src/dom/value/bitwise.js +14 -4
- package/src/dom/value/bracketed.js +9 -3
- package/src/dom/value/negated.js +9 -3
- package/src/dom/value.js +30 -21
- package/src/dom/values.js +4 -0
- package/src/dom/variable.js +9 -0
- package/src/nodeProperty.js +1 -1
package/src/dom/reduce.js
CHANGED
|
@@ -7,14 +7,16 @@ import { nodeQuery } from "../utilities/query";
|
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
8
|
import { NODES_TYPE, BOOLEAN_TYPE } from "../types";
|
|
9
9
|
|
|
10
|
-
const variableNodeQuery = nodeQuery("/
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const variableNodeQuery = nodeQuery("/reduce/variable"),
|
|
11
|
+
parametersNodeQuery = nodeQuery("/reduce/anonymousProcedure/parameters"),
|
|
12
|
+
valueReduceNodeQuery = nodeQuery("/value/reduce"),
|
|
13
|
+
initialValueNodeQuery = nodeQuery("/reduce/value"); ///
|
|
13
14
|
|
|
14
|
-
export default domAssigned(class
|
|
15
|
-
constructor(string, variable, anonymousProcedure) {
|
|
15
|
+
export default domAssigned(class Reduce {
|
|
16
|
+
constructor(string, variable, initialValue, anonymousProcedure) {
|
|
16
17
|
this.string = string;
|
|
17
18
|
this.variable = variable;
|
|
19
|
+
this.initialValue = initialValue;
|
|
18
20
|
this.anonymousProcedure = anonymousProcedure;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -26,6 +28,10 @@ export default domAssigned(class Some {
|
|
|
26
28
|
return this.variable;
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
getInitialValue() {
|
|
32
|
+
return this.initialValue;
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
getAnonymousProcedure() {
|
|
30
36
|
return this.anonymousProcedure;
|
|
31
37
|
}
|
|
@@ -33,9 +39,9 @@ export default domAssigned(class Some {
|
|
|
33
39
|
evaluate(context) {
|
|
34
40
|
let value;
|
|
35
41
|
|
|
36
|
-
const
|
|
42
|
+
const reduceString = this.getString();
|
|
37
43
|
|
|
38
|
-
context.trace(`Evaluating the '${
|
|
44
|
+
context.trace(`Evaluating the '${reduceString}' reduce...`);
|
|
39
45
|
|
|
40
46
|
value = this.variable.evaluate(context);
|
|
41
47
|
|
|
@@ -50,68 +56,62 @@ export default domAssigned(class Some {
|
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
const nodes = value.getNodes(),
|
|
53
|
-
|
|
54
|
-
let value;
|
|
55
|
-
|
|
56
|
-
const { Value, Values } = dom;
|
|
57
|
-
|
|
58
|
-
value = Value.fromNode(node, context);
|
|
59
|
-
|
|
60
|
-
const values = Values.fromValue(value, context);
|
|
59
|
+
initialValue = this.initialValue.evaluate(context);
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
value = nodes.reduce((currentValue, node) => {
|
|
62
|
+
let value;
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
const { Value, Values } = dom;
|
|
65
65
|
|
|
66
|
-
|
|
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);
|
|
66
|
+
value = currentValue; ///
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
}
|
|
68
|
+
const values = Values.fromValue(value, context);
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
value = Value.fromNode(node, context);
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
});
|
|
72
|
+
values.addValue(value);
|
|
78
73
|
|
|
79
|
-
|
|
74
|
+
value = this.anonymousProcedure.call(values, context);
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
return value;
|
|
77
|
+
}, initialValue);
|
|
82
78
|
|
|
83
|
-
context.trace(`...evaluated the '${
|
|
79
|
+
context.trace(`...evaluated the '${reduceString}' reduce.`);
|
|
84
80
|
|
|
85
81
|
return value;
|
|
86
82
|
}
|
|
87
83
|
|
|
88
|
-
static name = "
|
|
84
|
+
static name = "Reduce";
|
|
89
85
|
|
|
90
86
|
static fromValueNode(valueNode, context) {
|
|
91
|
-
let
|
|
87
|
+
let reduce = null;
|
|
92
88
|
|
|
93
|
-
const
|
|
89
|
+
const valueReduceNode = valueReduceNodeQuery(valueNode);
|
|
94
90
|
|
|
95
|
-
if (
|
|
96
|
-
const { Variable, AnonymousProcedure } = dom,
|
|
97
|
-
|
|
98
|
-
string =
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
if (valueReduceNode !== null) {
|
|
92
|
+
const { Value, Variable, AnonymousProcedure } = dom,
|
|
93
|
+
reduceNode = valueReduceNode, ///
|
|
94
|
+
string = stringFromReduceNode(reduceNode, context),
|
|
95
|
+
value = Value.fromReduceNode(reduceNode, context),
|
|
96
|
+
variable = Variable.fromReduceNode(reduceNode, context),
|
|
97
|
+
initialValue = value, ///
|
|
98
|
+
anonymousProcedure = AnonymousProcedure.fromReduceNode(reduceNode, context);
|
|
101
99
|
|
|
102
|
-
|
|
100
|
+
reduce = new Reduce(string, variable, initialValue, anonymousProcedure);
|
|
103
101
|
}
|
|
104
102
|
|
|
105
|
-
return
|
|
103
|
+
return reduce;
|
|
106
104
|
}
|
|
107
105
|
});
|
|
108
106
|
|
|
109
|
-
function
|
|
110
|
-
const variableNode = variableNodeQuery(
|
|
111
|
-
parametersNode = parametersNodeQuery(
|
|
107
|
+
function stringFromReduceNode(reduceNode, context) {
|
|
108
|
+
const variableNode = variableNodeQuery(reduceNode),
|
|
109
|
+
parametersNode = parametersNodeQuery(reduceNode),
|
|
110
|
+
initialValueNode = initialValueNodeQuery(reduceNode),
|
|
112
111
|
variableString = context.nodeAsString(variableNode),
|
|
113
112
|
parametersString = context.nodeAsString(parametersNode),
|
|
114
|
-
|
|
113
|
+
initialValueString = context.nodeAsString(initialValueNode),
|
|
114
|
+
string = `Reduce(${variableString}, (${parametersString}) { ... }, ${initialValueString})`;
|
|
115
115
|
|
|
116
116
|
return string;
|
|
117
117
|
}
|
|
@@ -40,11 +40,17 @@ export default domAssigned(class ReturnStatement {
|
|
|
40
40
|
static fromReturnBlockNode(returnBlockNode, context) {
|
|
41
41
|
const { Value } = dom,
|
|
42
42
|
returnStatementNode = returnStatementNodeQuery(returnBlockNode),
|
|
43
|
-
node = returnStatementNode, ///
|
|
44
|
-
string = context.nodeAsString(node),
|
|
45
43
|
value = Value.fromReturnStatementNode(returnStatementNode, context),
|
|
44
|
+
string = stringFromValue(value, context),
|
|
46
45
|
returnStatement = new ReturnStatement(string, value);
|
|
47
46
|
|
|
48
47
|
return returnStatement;
|
|
49
48
|
}
|
|
50
49
|
});
|
|
50
|
+
|
|
51
|
+
function stringFromValue(value, context) {
|
|
52
|
+
const valueString = value.asString(context),
|
|
53
|
+
string = `Return ${valueString};`;
|
|
54
|
+
|
|
55
|
+
return string;
|
|
56
|
+
}
|
package/src/dom/ternary.js
CHANGED
|
@@ -7,8 +7,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
8
|
import { BOOLEAN_TYPE } from "../types";
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
ifValueNodeQuery = nodeQuery("/ternary/value[1]"),
|
|
10
|
+
const ifValueNodeQuery = nodeQuery("/ternary/value[1]"),
|
|
12
11
|
ternaryNodeQuery = nodeQuery("/value/ternary"),
|
|
13
12
|
elseValueNodeQuery = nodeQuery("/ternary/value[2]");
|
|
14
13
|
|
|
@@ -75,12 +74,12 @@ export default domAssigned(class Ternary {
|
|
|
75
74
|
|
|
76
75
|
if (ternaryNode !== null) {
|
|
77
76
|
const { Value } = dom,
|
|
78
|
-
string = stringFromTernaryNode(ternaryNode, context),
|
|
79
77
|
ifValueNode = ifValueNodeQuery(ternaryNode),
|
|
80
78
|
elseValueNode = elseValueNodeQuery(ternaryNode),
|
|
81
79
|
value = Value.fromTernaryNode(ternaryNode, context),
|
|
82
80
|
ifValue = Value.fromValueNode(ifValueNode, context),
|
|
83
|
-
elseValue = Value.fromValueNode(elseValueNode, context)
|
|
81
|
+
elseValue = Value.fromValueNode(elseValueNode, context),
|
|
82
|
+
string = stringFromValueIfValueAndElseValue(value, ifValue, elseValue, context);
|
|
84
83
|
|
|
85
84
|
ternary = new Ternary(string, value, ifValue, elseValue);
|
|
86
85
|
}
|
|
@@ -89,17 +88,11 @@ export default domAssigned(class Ternary {
|
|
|
89
88
|
}
|
|
90
89
|
});
|
|
91
90
|
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
elseValueNode = elseValueNodeQuery(ternaryNode),
|
|
98
|
-
ifValueString = context.nodeAsString(ifValueNode),
|
|
99
|
-
elseValueString = context.nodeAsString(elseValueNode),
|
|
100
|
-
valueString = context.nodeAsString(valueNode);
|
|
101
|
-
|
|
102
|
-
string = `If (${valueString}) ${ifValueString} ${elseValueString}`;
|
|
91
|
+
function stringFromValueIfValueAndElseValue(value, ifValue, elseValue, context) {
|
|
92
|
+
const valueString = value.getString(),
|
|
93
|
+
ifValueString = ifValue.getString(),
|
|
94
|
+
elseValueString = elseValue.getString(),
|
|
95
|
+
string = `If (${valueString}) ${ifValueString} ${elseValueString}`;
|
|
103
96
|
|
|
104
97
|
return string;
|
|
105
98
|
}
|
package/src/dom/value/bitwise.js
CHANGED
|
@@ -5,8 +5,8 @@ import Exception from "../../exception";
|
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
import { domAssigned } from "../../dom";
|
|
8
|
-
import { DISJUNCTION } from "../../constants";
|
|
9
8
|
import { BOOLEAN_TYPE } from "../../types";
|
|
9
|
+
import { CONJUNCTION, DISJUNCTION } from "../../constants";
|
|
10
10
|
|
|
11
11
|
const terminalNodeQuery = nodeQuery("/bitwiseValue/@*"),
|
|
12
12
|
leftValueNodeQuery = nodeQuery("/bitwiseValue/value[0]"),
|
|
@@ -93,14 +93,13 @@ export default domAssigned(class BitwiseValue {
|
|
|
93
93
|
|
|
94
94
|
if (bitwiseValueNode !== null) {
|
|
95
95
|
const { Value } = dom,
|
|
96
|
-
node = bitwiseValueNode, //
|
|
97
|
-
string = context.nodeAsString(node),
|
|
98
96
|
type = BOOLEAN_TYPE,
|
|
99
97
|
leftValueNode = leftValueNodeQuery(bitwiseValueNode),
|
|
100
98
|
rightValueNode = rightValueNodeQuery(bitwiseValueNode),
|
|
101
99
|
disjoint = disjointFromBitwiseValueNode(bitwiseValueNode, context),
|
|
102
100
|
leftValue = Value.fromValueNode(leftValueNode, context),
|
|
103
|
-
rightValue = Value.fromValueNode(rightValueNode, context)
|
|
101
|
+
rightValue = Value.fromValueNode(rightValueNode, context),
|
|
102
|
+
string = stringFromTypeDisjointLeftValueAndRightValue(disjoint, leftValue, rightValue, context);
|
|
104
103
|
|
|
105
104
|
bitwiseValue = new BitwiseValue(string, type, disjoint, leftValue, rightValue);
|
|
106
105
|
}
|
|
@@ -116,3 +115,14 @@ function disjointFromBitwiseValueNode(bitwiseValueNode, context) {
|
|
|
116
115
|
|
|
117
116
|
return disjoint;
|
|
118
117
|
}
|
|
118
|
+
|
|
119
|
+
function stringFromTypeDisjointLeftValueAndRightValue(disjoint, leftValue, rightValue, context) {
|
|
120
|
+
const operatorString = disjoint ?
|
|
121
|
+
DISJUNCTION :
|
|
122
|
+
CONJUNCTION,
|
|
123
|
+
leftValueString = leftValue.asString(context),
|
|
124
|
+
rightValueString = rightValue.asString(context),
|
|
125
|
+
string = `${leftValueString} ${operatorString} ${rightValueString}`;
|
|
126
|
+
|
|
127
|
+
return string;
|
|
128
|
+
}
|
|
@@ -48,10 +48,9 @@ export default domAssigned(class BracketedValue {
|
|
|
48
48
|
if (valueBracketedValueNode !== null) {
|
|
49
49
|
const { Value } = dom,
|
|
50
50
|
bracketedValueNode = valueBracketedValueNode, ///
|
|
51
|
-
node = bracketedValueNode, ///
|
|
52
|
-
string = context.nodeAsString(node),
|
|
53
51
|
valueNode = valueNodeQuery(bracketedValueNode),
|
|
54
|
-
value = Value.fromValueNode(valueNode, context)
|
|
52
|
+
value = Value.fromValueNode(valueNode, context),
|
|
53
|
+
string = stringFromValue(value, context);
|
|
55
54
|
|
|
56
55
|
bracketedValue = new BracketedValue(string, value);
|
|
57
56
|
}
|
|
@@ -59,3 +58,10 @@ export default domAssigned(class BracketedValue {
|
|
|
59
58
|
return bracketedValue;
|
|
60
59
|
}
|
|
61
60
|
});
|
|
61
|
+
|
|
62
|
+
function stringFromValue(value, context) {
|
|
63
|
+
const valueString = value.asString(context),
|
|
64
|
+
string = `(${valueString})`;
|
|
65
|
+
|
|
66
|
+
return string;
|
|
67
|
+
}
|
package/src/dom/value/negated.js
CHANGED
|
@@ -70,11 +70,10 @@ export default domAssigned(class NegatedValue {
|
|
|
70
70
|
|
|
71
71
|
if (negatedValueNode !== null) {
|
|
72
72
|
const { Value } = dom,
|
|
73
|
-
node = negatedValueNode, //
|
|
74
|
-
string = context.nodeAsString(node),
|
|
75
73
|
type = BOOLEAN_TYPE,
|
|
76
74
|
valueNode = valueNodeQuery(negatedValueNode),
|
|
77
|
-
value = Value.fromValueNode(valueNode, context)
|
|
75
|
+
value = Value.fromValueNode(valueNode, context),
|
|
76
|
+
string = stringFromValue(value, context);
|
|
78
77
|
|
|
79
78
|
negatedValue = new NegatedValue(string, type, value);
|
|
80
79
|
}
|
|
@@ -82,3 +81,10 @@ export default domAssigned(class NegatedValue {
|
|
|
82
81
|
return negatedValue;
|
|
83
82
|
}
|
|
84
83
|
});
|
|
84
|
+
|
|
85
|
+
function stringFromValue(value, context) {
|
|
86
|
+
const valueString = value.asString(context),
|
|
87
|
+
string = `!${valueString}`;
|
|
88
|
+
|
|
89
|
+
return string;
|
|
90
|
+
}
|
package/src/dom/value.js
CHANGED
|
@@ -12,7 +12,8 @@ import { NODE_TYPE, NODES_TYPE, NUMBER_TYPE, STRING_TYPE, BOOLEAN_TYPE } from ".
|
|
|
12
12
|
|
|
13
13
|
const { match } = arrayUtilities;
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const reduceValueNodeQuery = nodeQuery("/reduce/value"),
|
|
16
|
+
ternaryValueNodeQuery = nodeQuery("/ternary/value"),
|
|
16
17
|
numberTerminalNodeQuery = nodeQuery("/value/@number"),
|
|
17
18
|
conditionValueNodeQuery = nodeQuery("/condition/value"),
|
|
18
19
|
primitiveTerminalNodeQuery = nodeQuery("/value/@primitive"),
|
|
@@ -29,7 +30,7 @@ export default domAssigned(class Value {
|
|
|
29
30
|
this.string = string;
|
|
30
31
|
this.boolean = boolean;
|
|
31
32
|
this.some = some;
|
|
32
|
-
this.every
|
|
33
|
+
this.every = every;
|
|
33
34
|
this.reduce = reduce;
|
|
34
35
|
this.ternary = ternary;
|
|
35
36
|
this.variable = variable;
|
|
@@ -171,37 +172,37 @@ export default domAssigned(class Value {
|
|
|
171
172
|
} else if (this.nodes !== null) {
|
|
172
173
|
string = nodesAsString(this.nodes, context);
|
|
173
174
|
} else if (this.number !== null) {
|
|
174
|
-
string = numberAsString(this.number
|
|
175
|
+
string = numberAsString(this.number);
|
|
175
176
|
} else if (this.string !== null) {
|
|
176
|
-
string = stringAsString(this.string
|
|
177
|
+
string = stringAsString(this.string)
|
|
177
178
|
} else if (this.boolean !== null) {
|
|
178
|
-
string = booleanAsString(this.boolean
|
|
179
|
+
string = booleanAsString(this.boolean)
|
|
179
180
|
} else if (this.some !== null) {
|
|
180
|
-
string = this.some.
|
|
181
|
+
string = this.some.getString();
|
|
181
182
|
} else if (this.every !== null) {
|
|
182
|
-
string = this.every.
|
|
183
|
+
string = this.every.getString();
|
|
183
184
|
} else if (this.reduce !== null) {
|
|
184
|
-
string = this.reduce.
|
|
185
|
+
string = this.reduce.getString();
|
|
185
186
|
} else if (this.ternary !== null) {
|
|
186
|
-
string = this.ternary.
|
|
187
|
+
string = this.ternary.getString();
|
|
187
188
|
} else if (this.variable !== null) {
|
|
188
|
-
string = this.variable.
|
|
189
|
+
string = this.variable.getString();
|
|
189
190
|
} else if (this.nodeQuery !== null) {
|
|
190
|
-
string = this.nodeQuery.
|
|
191
|
+
string = this.nodeQuery.getString();
|
|
191
192
|
} else if (this.nodesQuery !== null) {
|
|
192
|
-
string = this.nodesQuery.
|
|
193
|
+
string = this.nodesQuery.getString();
|
|
193
194
|
} else if (this.comparison !== null) {
|
|
194
|
-
string = this.comparison.
|
|
195
|
+
string = this.comparison.getString();
|
|
195
196
|
} else if (this.negatedValue !== null) {
|
|
196
|
-
string = this.negatedValue.
|
|
197
|
+
string = this.negatedValue.getString();
|
|
197
198
|
} else if (this.bitwiseValue !== null) {
|
|
198
|
-
string = this.bitwiseValue.
|
|
199
|
+
string = this.bitwiseValue.getString();
|
|
199
200
|
} else if (this.bracketedValue !== null) {
|
|
200
|
-
string = this.bracketedValue.
|
|
201
|
+
string = this.bracketedValue.getString();
|
|
201
202
|
} else if (this.procedureCall !== null) {
|
|
202
|
-
string = this.procedureCall.
|
|
203
|
+
string = this.procedureCall.getString();
|
|
203
204
|
} else if (this.anonymousProcedureCall !== null) {
|
|
204
|
-
string = this.anonymousProcedureCall.
|
|
205
|
+
string = this.anonymousProcedureCall.getString();
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
return string;
|
|
@@ -401,6 +402,14 @@ export default domAssigned(class Value {
|
|
|
401
402
|
return value;
|
|
402
403
|
}
|
|
403
404
|
|
|
405
|
+
static fromReduceNode(reduceNode, context) {
|
|
406
|
+
const reduceValueNode = reduceValueNodeQuery(reduceNode),
|
|
407
|
+
valueNode = reduceValueNode, ///
|
|
408
|
+
value = valueFromValueNode(valueNode, context);
|
|
409
|
+
|
|
410
|
+
return value;
|
|
411
|
+
}
|
|
412
|
+
|
|
404
413
|
static fromTernaryNode(ternaryNode, context) {
|
|
405
414
|
const ternaryValueNode = ternaryValueNodeQuery(ternaryNode),
|
|
406
415
|
valueNode = ternaryValueNode, ///
|
|
@@ -504,7 +513,7 @@ function nodesAsString(nodes, context) {
|
|
|
504
513
|
return string;
|
|
505
514
|
}
|
|
506
515
|
|
|
507
|
-
function numberAsString(number
|
|
516
|
+
function numberAsString(number) {
|
|
508
517
|
let string;
|
|
509
518
|
|
|
510
519
|
string = `${number}`;
|
|
@@ -512,13 +521,13 @@ function numberAsString(number, context) {
|
|
|
512
521
|
return string;
|
|
513
522
|
}
|
|
514
523
|
|
|
515
|
-
function stringAsString(string
|
|
524
|
+
function stringAsString(string) {
|
|
516
525
|
string = `"${string}"`; ///
|
|
517
526
|
|
|
518
527
|
return string;
|
|
519
528
|
}
|
|
520
529
|
|
|
521
|
-
function booleanAsString(boolean
|
|
530
|
+
function booleanAsString(boolean) {
|
|
522
531
|
let string;
|
|
523
532
|
|
|
524
533
|
string = `'${boolean}'`;
|
package/src/dom/values.js
CHANGED
package/src/dom/variable.js
CHANGED
|
@@ -9,6 +9,7 @@ import { domAssigned } from "../dom";
|
|
|
9
9
|
const someVariableNodeQuery = nodeQuery("/some/variable"),
|
|
10
10
|
valueVariableNodeQuery = nodeQuery("/value/variable"),
|
|
11
11
|
everyVariableNodeQuery = nodeQuery("/every/variable"),
|
|
12
|
+
reduceVariableNodeQuery = nodeQuery("/reduce/variable"),
|
|
12
13
|
nodeQueryVariableNodeQuery = nodeQuery("/nodeQuery/variable"),
|
|
13
14
|
nodesQueryVariableNodeQuery = nodeQuery("/nodesQuery/variable"),
|
|
14
15
|
variableNameTerminalNodeQuery = nodeQuery("/variable/@name"),
|
|
@@ -146,6 +147,14 @@ export default domAssigned(class Variable {
|
|
|
146
147
|
return variable;
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
static fromReduceNode(reduceNode, context) {
|
|
151
|
+
const reduceVariableNode = reduceVariableNodeQuery(reduceNode),
|
|
152
|
+
variableNode = reduceVariableNode, ///
|
|
153
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
154
|
+
|
|
155
|
+
return variable;
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
static fromNodeQueryNode(nodeQueryNode, context) {
|
|
150
159
|
const nodeQueryVariableNode = nodeQueryVariableNodeQuery(nodeQueryNode),
|
|
151
160
|
variableNode = nodeQueryVariableNode, ///
|