summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/math/ExpressionParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/math/ExpressionParser.java')
-rw-r--r--src/org/unitConverter/math/ExpressionParser.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/org/unitConverter/math/ExpressionParser.java b/src/org/unitConverter/math/ExpressionParser.java
index f34a0c2..b56fa71 100644
--- a/src/org/unitConverter/math/ExpressionParser.java
+++ b/src/org/unitConverter/math/ExpressionParser.java
@@ -479,6 +479,9 @@ public final class ExpressionParser<T> {
break;
}
+ // swap components based on what kind of operator there is
+ // 1 + 2 becomes 2 1 +
+ // - 1 becomes 1 -
switch (this.getTokenType(components.get(highestPriorityOperatorPosition))) {
case UNARY_OPERATOR:
final String unaryOperator = components.remove(highestPriorityOperatorPosition);