1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-06-30 22:51:52 -07:00

Fix order of operations bug.

This commit is contained in:
Danila Fedorin 2017-08-03 13:14:09 -07:00
parent 20f6e0b0b2
commit 37261c2f58

View File

@ -89,7 +89,7 @@ public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListe
if (!(otherMatchType == TokenType.OP || otherMatchType == TokenType.FUNCTION)) break; if (!(otherMatchType == TokenType.OP || otherMatchType == TokenType.FUNCTION)) break;
if (otherMatchType == TokenType.OP) { if (otherMatchType == TokenType.OP) {
int otherPrecedence = precedenceMap.get(match.getContent()); int otherPrecedence = precedenceMap.get(otherMatch.getContent());
if (otherPrecedence < precedence || if (otherPrecedence < precedence ||
(associativity == OperatorAssociativity.RIGHT && otherPrecedence == precedence)) { (associativity == OperatorAssociativity.RIGHT && otherPrecedence == precedence)) {
break; break;