fable 3.0.133 → 3.0.134
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/debug/Harness.js +27 -39
- package/dist/fable.compatible.js +273 -54
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +239 -20
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/example_applications/data/Fruit-Data.json +694 -0
- package/example_applications/data/Fruit-Manyfest.json +56 -0
- package/example_applications/mathematical_playground/AppData.json +8 -0
- package/example_applications/mathematical_playground/Equations.json +12 -0
- package/example_applications/mathematical_playground/Math-Solver-Harness.js +89 -0
- package/package.json +1 -1
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json +80 -20
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js +5 -5
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js +1 -1
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json +1 -0
- package/source/services/Fable-Service-ExpressionParser.js +22 -3
- package/source/services/Fable-Service-Math.js +570 -19
- package/test/ExpressionParser_tests.js +17 -0
- package/test/Math_test.js +54 -3
- package/test/data/chocodata.json +248 -0
package/debug/Harness.js
CHANGED
|
@@ -1,47 +1,35 @@
|
|
|
1
|
-
//let libBookstore = require('../retold-harness/bookstore-serve-meadow-endpoint-apis-run.js');
|
|
2
1
|
const libFable = require('../source/Fable.js');
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const _Fable = new libFable({"Product": "Hn"});
|
|
4
|
+
const _ExpressionParser = _Fable.instantiateServiceProviderIfNotExists('ExpressionParser');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
const _Expression = "TotalCost = SUM(ItemCosts)";
|
|
7
|
+
const _Values = (
|
|
8
|
+
{
|
|
9
|
+
"ItemCosts": [100,200,50,45,5]
|
|
10
|
+
});
|
|
11
|
+
const _Manyfest = _Fable.newManyfest(
|
|
12
|
+
{
|
|
13
|
+
"Scope":"None",
|
|
14
|
+
"Descriptors":
|
|
15
|
+
{
|
|
16
|
+
"Bill.Items[].Cost":
|
|
17
|
+
{
|
|
18
|
+
"Name":"Costs of the Bill Items",
|
|
19
|
+
"Hash":"BillItemCosts"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
const _SolveResultsObject = {};
|
|
25
|
+
const _DataDestinationObject = {};
|
|
19
26
|
|
|
20
|
-
let
|
|
21
|
-
let
|
|
22
|
-
let complexLintedResults = testFable.ExpressionParser.lintTokenizedExpression(complexTokenizedResults, tmpResultsObject);
|
|
23
|
-
let complexPostfixedResults = testFable.ExpressionParser.buildPostfixedSolveList(complexTokenizedResults, tmpResultsObject);
|
|
24
|
-
testFable.ExpressionParser.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects, tmpSimpleDataObject);
|
|
25
|
-
for (let i = 0; i < tmpResultsObject.PostfixSolveList.length; i++)
|
|
27
|
+
let tmpResult = _ExpressionParser.solve(_Expression, _Values, _SolveResultsObject, _Manyfest, _DataDestinationObject);
|
|
28
|
+
for (let i = 0; i < _SolveResultsObject.PostfixSolveList.length; i++)
|
|
26
29
|
{
|
|
27
|
-
let tmpToken =
|
|
28
|
-
console.log(`${i}: ${tmpToken.VirtualSymbolName} = ${
|
|
30
|
+
let tmpToken = _SolveResultsObject.PostfixSolveList[i];
|
|
31
|
+
console.log(`${i}: ${tmpToken.VirtualSymbolName} = (${tmpToken.LeftValue.Token}::${tmpToken.LeftValue.Value}) ${tmpToken.Operation.Token} (${tmpToken.RightValue.Token}::${tmpToken.RightValue.Value}) `)
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
console.log(`Result: ${tmpResultValue}`);
|
|
32
|
-
console.log('QED');
|
|
33
|
-
//41.32965489638783839821'
|
|
33
|
+
console.log(`Result: ${tmpResult}`);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
switch (pToken.Type)
|
|
38
|
-
{
|
|
39
|
-
case 'Token.Symbol':
|
|
40
|
-
return `(${pToken.Token} = ${pToken.Value})`;
|
|
41
|
-
case 'Token.StateAddress':
|
|
42
|
-
return `({${pToken.Token}} = ${pToken.Value})`;
|
|
43
|
-
case 'Token.Constant':
|
|
44
|
-
default:
|
|
45
|
-
return pToken.Token;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
35
|
+
// const libMathHarness = require('../example_applications/mathematical_playground/Math-Solver-Harness.js');
|