1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-09-25 21:02:38 +00:00

Abstract the call functionality, and add TreeValueFunctionNode.

This commit is contained in:
2017-08-25 01:17:52 -07:00
parent c5cd0f81ad
commit bc26ad0b88
5 changed files with 48 additions and 37 deletions

View File

@@ -144,7 +144,7 @@ public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListe
while (!matches.isEmpty() && matches.get(0).getType() != TokenType.INTERNAL_FUNCTION_END) {
TreeNode argument = constructRecursive(matches);
if (argument == null) return null;
node.prependChild(argument);
node.getChildren().add(0, argument);
}
if (matches.isEmpty()) return null;
matches.remove(0);

View File

@@ -46,7 +46,7 @@ public class NumberReducer implements Reducer<NumberInterface> {
for (int i = 0; i < convertedChildren.length; i++) {
convertedChildren[i] = (NumberInterface) children[i];
}
Function function = abacus.getPluginManager().functionFor(((FunctionNode) node).getFunction());
Function function = abacus.getPluginManager().functionFor(((FunctionNode) node).getCallTo());
if (function == null) return null;
return function.apply(convertedChildren);
}