@@ -603,18 +603,18 @@ function Parser:expressionStrCat(scope)
603603end
604604
605605function Parser :expressionAddSub (scope )
606- local curr = self :expressionMulDiv (scope );
606+ local curr = self :expressionMulDivMod (scope );
607607
608608 repeat
609609 local found = false ;
610610 if (consume (self , TokenKind .Symbol , " +" )) then
611- local rhs = self :expressionMulDiv (scope );
611+ local rhs = self :expressionMulDivMod (scope );
612612 curr = Ast .AddExpression (curr , rhs , true );
613613 found = true ;
614614 end
615615
616616 if (consume (self , TokenKind .Symbol , " -" )) then
617- local rhs = self :expressionMulDiv (scope );
617+ local rhs = self :expressionMulDivMod (scope );
618618 curr = Ast .SubExpression (curr , rhs , true );
619619 found = true ;
620620 end
@@ -624,39 +624,30 @@ function Parser:expressionAddSub(scope)
624624 return curr ;
625625end
626626
627- function Parser :expressionMulDiv (scope )
628- local curr = self :expressionMod (scope );
627+ function Parser :expressionMulDivMod (scope )
628+ local curr = self :expressionUnary (scope );
629629
630630 repeat
631631 local found = false ;
632632 if (consume (self , TokenKind .Symbol , " *" )) then
633- local rhs = self :expressionMod (scope );
633+ local rhs = self :expressionUnary (scope );
634634 curr = Ast .MulExpression (curr , rhs , true );
635635 found = true ;
636636 end
637637
638638 if (consume (self , TokenKind .Symbol , " /" )) then
639- local rhs = self :expressionMod (scope );
639+ local rhs = self :expressionUnary (scope );
640640 curr = Ast .DivExpression (curr , rhs , true );
641641 found = true ;
642642 end
643- until not found ;
644-
645- return curr ;
646- end
647643
648- function Parser :expressionMod (scope )
649- local curr = self :expressionUnary (scope );
650-
651- repeat
652- local found = false ;
653644 if (consume (self , TokenKind .Symbol , " %" )) then
654645 local rhs = self :expressionUnary (scope );
655646 curr = Ast .ModExpression (curr , rhs , true );
656647 found = true ;
657648 end
658649 until not found ;
659-
650+
660651 return curr ;
661652end
662653
0 commit comments