diff options
Diffstat (limited to 'src/Compiler/Parser.java')
| -rw-r--r-- | src/Compiler/Parser.java | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/src/Compiler/Parser.java b/src/Compiler/Parser.java index 433035c..9f5e68d 100644 --- a/src/Compiler/Parser.java +++ b/src/Compiler/Parser.java @@ -408,7 +408,7 @@ public class Parser {       */      private Expression equality(){          Expression createdExpression = logical(); -        while (matchAndAdvance(TokenType.EQUALITY)){ +        while (matchAndAdvance(TokenType.EQUALITY)||matchAndAdvance(TokenType.NOT_EQUAL)){              Token op = getPreviousToken();              Expression right = logical();              createdExpression = new Expression.Binary(createdExpression, op, right); @@ -471,10 +471,21 @@ public class Parser {       * @return an expression of rank factor or lower        */      private Expression factor(){ -        Expression createdExpression = primary(); +        Expression createdExpression = exponent();          //Check for multiplication or division expressions          while (matchAndAdvance(TokenType.STAR)||matchAndAdvance(TokenType.SLASH)){              Token op = getPreviousToken(); +            Expression right = exponent(); +            createdExpression = new Expression.Binary(createdExpression, op, right); +        } +        return createdExpression; +    } + +    private Expression exponent(){ +        Expression createdExpression = primary(); +        //Check for multiplication or division expressions +        while (matchAndAdvance(TokenType.EXPONENT)){ +            Token op = getPreviousToken();              Expression right = primary();              createdExpression = new Expression.Binary(createdExpression, op, right);          } | 
