1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-17 16:09:32 -08:00

Fix function argument order.

This commit is contained in:
Danila Fedorin 2017-07-27 16:52:16 -07:00
parent edbef67b8a
commit 65a6265cf6
2 changed files with 11 additions and 3 deletions

View File

@ -39,13 +39,21 @@ public class FunctionNode extends TreeNode {
}
/**
* Adds a child to this node.
* Adds a child to the end of this node's child list.
* @param node the child to add.
*/
public void addChild(TreeNode node){
public void appendChild(TreeNode node){
children.add(node);
}
/**
* Adds a new child to the beginning of this node's child list.
* @param node the node to add.
*/
public void prependChild(TreeNode node) {
children.add(0, node);
}
@Override
public <T> T reduce(Reducer<T> reducer) {
Object[] reducedChildren = new Object[children.size()];

View File

@ -155,7 +155,7 @@ public class TreeBuilder {
while(!matches.isEmpty() && matches.get(0).getType() != TokenType.INTERNAL_FUNCTION_END){
TreeNode argument = fromStringRecursive(source, matches);
if(argument == null) return null;
node.addChild(argument);
node.prependChild(argument);
}
if(matches.isEmpty()) return null;
matches.remove(0);