This commit is contained in:
rusefi 2017-03-11 19:27:42 -05:00
parent 6c819429d7
commit fc1706d0c2
2 changed files with 5 additions and 1 deletions

View File

@ -302,7 +302,7 @@ public abstract class AbstractEvaluator<T> {
throw new IllegalArgumentException("Parentheses mismatched"); throw new IllegalArgumentException("Parentheses mismatched");
} }
if (!stack.isEmpty() && stack.peek().isFunction()) { if (!stack.isEmpty() && stack.peek().isFunction()) {
rpnPush("function", stack.peek().getLiteral()); rpnPush("function", stack.peek().getFunction().getName());
// If the token at the top of the stack is a function token, pop it // If the token at the top of the stack is a function token, pop it
// onto the output queue. // onto the output queue.
int argCount = values.size()-previousValuesSize.pop(); int argCount = values.size()-previousValuesSize.pop();

View File

@ -9,9 +9,13 @@ import java.util.Stack;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @see DoubleEvaluator
*/
public class ParserTest { public class ParserTest {
@Test @Test
public void testFunctionParameters() { public void testFunctionParameters() {
assertParse("3 log", "log(3)");
// todo: parameter order needs to be in postfix form // todo: parameter order needs to be in postfix form
// assertParseB("fsio_setting 0", "fsio_setting 0"); // assertParseB("fsio_setting 0", "fsio_setting 0");
} }