Skip to content

Commit

Permalink
Issue fasseg#88: Fixed multiple function concatenation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrustana committed Aug 21, 2017
1 parent 8a4e210 commit 197de37
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public static Token[] convertToRPN(final String expression, final Map<String, Fu
output.add(token);
break;
case Token.TOKEN_FUNCTION:
stack.add(token);
break;
if(!stack.empty() && stack.peek().getType() == Token.TOKEN_FUNCTION) {
throw new IllegalArgumentException("Mismatched parentheses detected. Please check the expression");
}
stack.add(token);
break;
case Token.TOKEN_SEPARATOR:
while (!stack.empty() && stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) {
output.add(stack.pop());
Expand Down

0 comments on commit 197de37

Please sign in to comment.