Esempio n. 1
0
        private void ParseBetweenExpr(TokenType t)
        {
            BinaryExpr lhs = new BinaryExpr();
            BinaryExpr rhs = new BinaryExpr();
            BinaryExpr expr = new BinaryExpr();

            Expression center = _exprs.Pop();
            Expression left = _exprs.Pop();

            if (_tokens.LookAhead().TokenType != TokenType.OP_AND_L) {
                throw new Exception("missing AND statement");
            }
            _tokens.Read();

            ParseExpression();
            Expression right = _exprs.Pop();

            lhs.Left = left;
            lhs.Operation = GetOperator(TokenType.OP_GTE);
            lhs.Right = center;

            rhs.Left = left;
            rhs.Operation = GetOperator(TokenType.OP_LTE);
            rhs.Right = right;

            expr.Left = lhs;
            expr.Right = rhs;

            expr.Operation = GetOperator(TokenType.OP_AND_L);
            _exprs.Push(expr);
        }
Esempio n. 2
0
 private void MakeBinaryExpr(TokenType op)
 {
     BinaryExpr expr = new BinaryExpr();
     expr.Operation = GetOperator(op);
     expr.Right = _exprs.Pop();
     expr.Left = _exprs.Pop();
     _exprs.Push(expr);
 }