void BitShift(out Expression exp)
        {
            Expression second;

            PlusMinus(out exp);
            while (la.kind == 38 || la.kind == 39)
            {
                if (la.kind == 38)
                {
                    Get();
                }
                else
                {
                    Get();
                }
                Token tok = t;
                PlusMinus(out second);
                if (!ExpectInt(exp, tok, false))
                {
                    return;
                }
                if (!ExpectInt(second, tok, true))
                {
                    return;
                }
                if (tok.val == "<<")
                {
                    exp = new ShiftLeft((TypedExpression <int>)exp, (TypedExpression <int>)second);
                }
                else if (tok.val == ">>")
                {
                    exp = new ShiftRight((TypedExpression <int>)exp, (TypedExpression <int>)second);
                }
            }
        }
Exemplo n.º 2
0
        public override void Visit(ShiftLeft node)
        {
            ulong left  = thread.Pop().Read().GetAsInt().Value;
            ulong right = thread.Pop().Read().GetAsInt().Value;

            PushInteger(left << (int)right);
        }
Exemplo n.º 3
0
 public override bool Visit(ShiftLeft node)
 {
     traverse(node.left);
     outputCode(" << ", false, false);
     traverse(node.right);
     //Visit((ArithmethicBinaryExpression) node);
     return(true);
 }
Exemplo n.º 4
0
 public virtual T Visit(ShiftLeft node)
 {
     return(Visit((ArithmeticBinaryExpression)node));
 }
Exemplo n.º 5
0
 public virtual void Visit(ShiftLeft node)
 {
 }
Exemplo n.º 6
0
 public override bool Visit(ShiftLeft node)
 {
     Visit((ArithmeticBinaryExpression)node);
     return(true);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Shift self left operator.
 /// </summary>
 /// <param name="VariableName">Variable name..</param>
 /// <param name="Operand">Operand.</param>
 /// <param name="Start">Start position in script expression.</param>
 /// <param name="Length">Length of expression covered by node.</param>
 /// <param name="Expression">Expression containing script.</param>
 public ShiftSelfLeft(string VariableName, ScriptNode Operand, int Start, int Length, Expression Expression)
     : base(VariableName, Operand, Start, Length, Expression)
 {
     this.shiftLeft = new ShiftLeft(new VariableReference(VariableName, true, Start, Length, Expression), Operand, Start, Length, Expression);
 }
Exemplo n.º 8
0
 public virtual void Visit(ShiftLeft node)
 {
 }
Exemplo n.º 9
0
        public static ParamLessInstruction GetInstructionForOperator(
            string operatorVal,
            bool twoArg = true,
            DatSymbolType leftSideType = DatSymbolType.Void)
        {
            ParamLessInstruction instruction = new ParamLessInstruction();

            switch (operatorVal)
            {
            case "=":
                instruction = GetAssignInstructionForDatSymbolType(leftSideType);
                break;

            case "+=":
                instruction = new AssignAdd();
                break;

            case "-=":
                instruction = new AssignSubtract();
                break;

            case "*=":
                instruction = new AssignMultiply();
                break;

            case "/=":
                instruction = new AssignDivide();
                break;


            case "+":
                if (twoArg)
                {
                    instruction = new Add();
                }
                else
                {
                    instruction = new Plus();
                }

                break;

            case "-":
                if (twoArg)
                {
                    instruction = new Subtract();
                }
                else
                {
                    instruction = new Minus();
                }

                break;


            case "<<":
                instruction = new ShiftLeft();
                break;

            case ">>":
                instruction = new ShiftRight();
                break;


            case ">":
                instruction = new Greater();
                break;

            case ">=":
                instruction = new GreaterOrEqual();
                break;

            case "<":
                instruction = new Less();
                break;

            case "<=":
                instruction = new LessOrEqual();
                break;


            case "==":
                instruction = new Equal();
                break;

            case "!=":
                instruction = new NotEqual();
                break;


            case "!":
                instruction = new Not();
                break;

            case "~":
                instruction = new Negate();
                break;


            case "*":
                instruction = new Multiply();
                break;

            case "/":
                instruction = new Divide();
                break;

            case "%":
                instruction = new Modulo();
                break;


            case "&":
                instruction = new BitAnd();
                break;

            case "|":
                instruction = new BitOr();
                break;

            case "&&":
                instruction = new LogAnd();
                break;

            case "||":
                instruction = new LogOr();
                break;
            }

            if (instruction == null)
            {
                throw new Exception($"'{operatorVal}' does't have insctruction");
            }

            return(instruction);
        }
        void BitShift(out Expression exp)
        {
            Expression second;
            PlusMinus(out exp);
            while (la.kind == 38 || la.kind == 39) {
            if (la.kind == 38) {
                Get();
            } else {
                Get();
            }
            Token tok = t;
            PlusMinus(out second);
            if (!ExpectInt(exp, tok, false)) { return; }
            if (!ExpectInt(second, tok, true)) { return; }
            if (tok.val == "<<") {
                exp = new ShiftLeft((TypedExpression<int>)exp, (TypedExpression<int>)second);
            } else if (tok.val == ">>") {
                exp = new ShiftRight((TypedExpression<int>)exp, (TypedExpression<int>)second);
            }

            }
        }