Inheritance: OperatorExpression
Ejemplo n.º 1
0
 public abstract void Visit(BinaryExpression expression);
Ejemplo n.º 2
0
 private Expression ParseMultiplicativeBinary()
 {
     Expression expr = ParseRelationalBinary();
     while (!_scanner.IsEof() && (_current.Type == TokenType.Multiply ||
         _current.Type == TokenType.Divide || _current.Type == TokenType.Modulo))
     {
         var binaryMulDiv = new BinaryExpression
             {
                 Operator = ((PunctuatorToken)_current).ToOperatorType(),
                 Left = expr
             };
         Expect(MiddleGroupMultiplicative);
         binaryMulDiv.Right = ParseRelationalBinary();
         expr = binaryMulDiv;
     }
     return expr;
 }
Ejemplo n.º 3
0
 private Expression ParseRelationalBinary()
 {
     Expression expr = ParseIdentifier();
     while (!_scanner.IsEof() && (_current.Type == TokenType.Equality || _current.Type == TokenType.Inequality ||
         _current.Type == TokenType.LessThan || _current.Type == TokenType.GreaterThan ||
         _current.Type == TokenType.LessThanOrEqual || _current.Type == TokenType.GreaterThanOrEqual))
     {
         var binaryExp = new BinaryExpression
             {
                 Operator = ((PunctuatorToken) _current).ToOperatorType(),
                 Left = expr
             };
         Expect(MiddleGroupAdditiveRelational);
         binaryExp.Right = ParseIdentifier();
         expr = binaryExp;
     }
     return expr;
 }
Ejemplo n.º 4
0
 private Expression ParseAdditiveBinary()
 {
     Expression expr = ParseMultiplicativeBinary();
     while (!_scanner.IsEof() && (_current.Type == TokenType.Plus || _current.Type == TokenType.Minus))
     {
         var binaryAddSub = new BinaryExpression
             {
                 Operator = ((PunctuatorToken)_current).ToOperatorType(),
                 Left = expr
             };
         Expect(MiddleGroupAdditiveRelational);
         binaryAddSub.Right = ParseMultiplicativeBinary();
         expr = binaryAddSub;
     }
     return expr;
 }