From 40858cee415643769ee5f6216b0cd4335996ff2f Mon Sep 17 00:00:00 2001 From: bjculkin Date: Tue, 11 Apr 2017 17:51:13 -0400 Subject: General cleanup and fixes --- dice-lang/src/bjc/dicelang/expr/Shunter.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'dice-lang/src/bjc/dicelang/expr/Shunter.java') diff --git a/dice-lang/src/bjc/dicelang/expr/Shunter.java b/dice-lang/src/bjc/dicelang/expr/Shunter.java index 5d8cb7c..bbece0f 100644 --- a/dice-lang/src/bjc/dicelang/expr/Shunter.java +++ b/dice-lang/src/bjc/dicelang/expr/Shunter.java @@ -39,7 +39,12 @@ public class Shunter { * respecting their left associativity. */ int leftPriority = tok.type.operatorPriority; - int rightPriority = curOp == null ? 0 : curOp.type.operatorPriority; + + int rightPriority; + if(curOp == null) + rightPriority = 0; + else + rightPriority = curOp.type.operatorPriority; boolean isHigherPrec = leftPriority >= rightPriority; @@ -53,7 +58,11 @@ public class Shunter { curOp = opStack.peek(); leftPriority = tok.type.operatorPriority; - rightPriority = curOp == null ? 0 : curOp.type.operatorPriority; + + if(curOp == null) + rightPriority = 0; + else + rightPriority = curOp.type.operatorPriority; isHigherPrec = leftPriority >= rightPriority; } @@ -65,7 +74,8 @@ public class Shunter { Token curOp = opStack.peek(); /* - * Pop things until we find the matching paren. + * Pop things until we find the matching + * parenthesis. */ while(curOp.type != TokenType.OPAREN) { Token tk = opStack.pop(); @@ -92,4 +102,4 @@ public class Shunter { return postfixTokens.toArray(new Token[0]); } -} +} \ No newline at end of file -- cgit v1.2.3