mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-23 07:50:09 -08:00
Fix function argument order.
This commit is contained in:
parent
edbef67b8a
commit
65a6265cf6
|
@ -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.
|
* @param node the child to add.
|
||||||
*/
|
*/
|
||||||
public void addChild(TreeNode node){
|
public void appendChild(TreeNode node){
|
||||||
children.add(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
|
@Override
|
||||||
public <T> T reduce(Reducer<T> reducer) {
|
public <T> T reduce(Reducer<T> reducer) {
|
||||||
Object[] reducedChildren = new Object[children.size()];
|
Object[] reducedChildren = new Object[children.size()];
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class TreeBuilder {
|
||||||
while(!matches.isEmpty() && matches.get(0).getType() != TokenType.INTERNAL_FUNCTION_END){
|
while(!matches.isEmpty() && matches.get(0).getType() != TokenType.INTERNAL_FUNCTION_END){
|
||||||
TreeNode argument = fromStringRecursive(source, matches);
|
TreeNode argument = fromStringRecursive(source, matches);
|
||||||
if(argument == null) return null;
|
if(argument == null) return null;
|
||||||
node.addChild(argument);
|
node.prependChild(argument);
|
||||||
}
|
}
|
||||||
if(matches.isEmpty()) return null;
|
if(matches.isEmpty()) return null;
|
||||||
matches.remove(0);
|
matches.remove(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user