Example #1
0
 public GreaterThanExpression(Expression left, Expression right)
 {
     Operands.Add(left);
     Operands.Add(right);
     //TODO validate ParamType
     ReturnType = typeof(bool);
 }
 public JoinExpression(Expression src, Expression dest,
                       Expression onCriteria)
 {
     Operands.Add(src);
     Operands.Add(dest);
     Operands.Add(onCriteria);
     //No  Return Type ,Can't Excute!
 }
Example #3
0
 public DummyInstructionPattern(DummyOpCode opCode, params Pattern <object>[] operands)
 {
     OpCode = new LiteralPattern <DummyOpCode>(opCode);
     foreach (var operand in operands)
     {
         Operands.Add(operand);
     }
 }
Example #4
0
 public DummyInstructionPattern(Pattern <DummyOpCode> opCode, params Pattern <object>[] operands)
 {
     OpCode = opCode;
     foreach (var operand in operands)
     {
         Operands.Add(operand);
     }
 }
Example #5
0
 public MetaTableExpression(NewExpression newExpression, IList <SqlExpression> values) : base(SqlExpressionType.MetaTable, newExpression.Type)
 {
     SourceExpression = newExpression;
     Values           = values;
     foreach (var v in Values)
     {
         Operands.Add(v);
     }
 }
 private void Operation(string operation)
 {
     if (Number != "0")
     {
         Operands.Add(Number);
         Operands.Add(operation);
         Number      = "0";
         AllOperands = string.Join(" ", Operands);
     }
 }
Example #7
0
        //--------------------------------------------------------------------------------------------------

        #endregion

        #region Operands

        public bool AddOperand(IShapeOperand operandShape)
        {
            Operands.Add(operandShape);
            operandShape.AddDependent(this);

            RaisePropertyChanged("ChildCount");
            Invalidate();

            return(true);
        }
Example #8
0
 public AndExpression(Expression expression
                      , IList <Expression> rightExpressions)
 {
     if (rightExpressions == null || !rightExpressions.Any())
     {
         throw new ArgumentException("And Expression Create Arg Error!", "rightExpressions");
     }
     Operands.Add(expression);
     Operands.AddRange(rightExpressions);
     ReturnType = typeof(bool);
 }
Example #9
0
        public void ParseEquationAdv(string equation)
        {
            string eq = equation.Replace("(", "( ");

            eq = eq.Replace(")", " )");

            var parts = eq.Split(' ', StringSplitOptions.RemoveEmptyEntries);

            foreach (var part in parts)
            {
                if (int.TryParse(part, out int ival))
                {
                    // number push
                    Operands.Add(part);
                }
                else
                {
                    if (part == "+" || part == "*")
                    {
                        if (Operators.Count > 0 && Operators.Peek() != "(")
                        {
                            if (part == "*" && Operators.Peek() == "+")
                            {
                                Operands.Add(Operators.Pop());
                            }
                            else if (part == Operators.Peek())
                            {
                                Operands.Add(Operators.Pop());
                            }
                        }
                        Operators.Push(part);
                    }
                    else if (part == "(")
                    {
                        Operators.Push(part);
                    }
                    else if (part == ")")
                    {
                        // find the match
                        string op;
                        while (Operators.Count > 0 && (op = Operators.Pop()) != "(")
                        {
                            Operands.Add(op);
                        }
                    }
                }
            }

            while (Operators.Count > 0)
            {
                Operands.Add(Operators.Pop());
            }
        }
Example #10
0
 public SearchOperator(Operator op, List <ISearch> operands)
 {
     if (op == Operator.Invalid)
     {
         op = Operator.And;                         // set to be the default search type.
     }
     Op = op;
     foreach (var item in operands)
     {
         Operands.Add(item);
     }
 }
Example #11
0
        private bool ReadTwoOperands(byte[] buffer)
        {
            int op1 = GetByte(buffer, PC++);



            int op2 = GetByte(buffer, PC++);

            Operands.Add((Opcode & 0x040) == 0 ? new Operand(OperandType.SmallConst, op1) : new Operand(OperandType.Variable, op1));
            Operands.Add((Opcode & 0x020) == 0 ? new Operand(OperandType.SmallConst, op2) : new Operand(OperandType.Variable, op2));

            return(false);
        }
 public void AddOperand(Node operand)
 {
     if (Type == ConnectorType.IMPLY && Operands.Count > 0)
     {
         throw new Exception("An imply connection must only have one operand");
     }
     Operands.Add(operand);
     if (IsRoot || Type == ConnectorType.IMPLY || operand.OperandParents.Contains(this))
     {
         return;
     }
     operand.OperandParents.Add(this);
 }
Example #13
0
 public MemberExpress(Expression parameter, string memberName, Type ofType = null)
 {
     if (ofType != null)
     {
         ReturnType = ofType;
     }
     else
     {
         ReturnType = typeof(object);
     }
     Operands.Add(parameter);
     MemberName = memberName;
 }
Example #14
0
 // SortEquation Method - Sorts each subequation's character's into its respective list
 public void SortEquation()
 {
     foreach (var c in subEquation.Split(' '))
     {
         if (HasNumber(c) || IsX(c))
         {
             Operands.Add(c);
         }
         else if (IsOperator(c))
         {
             Operators.Add(c);
         }
     }
 }
Example #15
0
        internal override unsafe void ParseDetails(CsDetailBase *detail)
        {
            var ad = (CsArm64Detail *)&detail->ArchSpecificPlaceholder;

            Condition = (ConditionCode)ad->CC;
            var ops = (CsArm64Op *)&ad->OpsPlaceholder;

            for (var i = 0; i < ad->OpCount; ++i)
            {
                var op = ops[i];
                switch (op.OpType)
                {
                case 1:
                    Operands.Add(new RegOperand(*(Reg *)&op.Placeholder0));
                    break;

                case 2:
                    Operands.Add(new ImmOperand(*(ulong *)&op.Placeholder0));
                    break;

                case 3:
                    Operands.Add(new MemOperand(
                                     *(Reg *)&op.Placeholder0,
                                     *(Reg *)&op.Placeholder1,
                                     *(int *)&op.Placeholder2
                                     ));
                    break;

                case 4:
                    Operands.Add(new FpOperand(*(double *)&op.Placeholder0));
                    break;

                case 65:
                case 66:
                case 67:
                case 68:
                case 69:
                    Operands.Add(null);
                    break;

                case 70:
                    Operands.Add(new BarrierOperand(*(Barrier *)&op.Placeholder0));
                    break;

                default:
                    throw new NotImplementedException($"Operand type {op.OpType} not supported");
                }
            }
        }
        private void ParseOperands()
        {
            if (Instruction.Operands.Count == 0)
            {
                return;
            }

            // Word 0 describes this instruction so we can ignore it
            int currentWord    = 1;
            int currentOperand = 0;

            var     varyingOperandValues = new List <object> ();
            var     varyingWordStart     = 0;
            Operand varyingOperand       = null;

            for (; currentWord < Words.Count;)
            {
                var operand = Instruction.Operands [currentOperand];

                operand.Type.ReadValue(Words.Skip(currentWord).ToList(),
                                       out object value, out int wordsUsed);

                if (operand.Quantifier == OperandQuantifier.Varying)
                {
                    varyingOperandValues.Add(value);
                    varyingWordStart = currentWord;
                    varyingOperand   = operand;
                }
                else
                {
                    Operands.Add(new ParsedOperand(Words.Skip(currentWord).Take(wordsUsed).ToList(),
                                                   value, operand));
                }

                currentWord += wordsUsed;

                if (operand.Quantifier != OperandQuantifier.Varying)
                {
                    ++currentOperand;
                }
            }

            if (varyingOperand != null)
            {
                Operands.Add(new ParsedOperand(Words.Skip(currentWord).ToList(),
                                               new VaryingOperandValue(varyingOperandValues), varyingOperand));
            }
        }
Example #17
0
        private void ParseOperands()
        {
            if (Instruction.Operands.Count == 0)
            {
                return;
            }

            // Word 0 describes this instruction so we can ignore it
            int           currentWord          = 1;
            int           currentOperand       = 0;
            List <object> varyingOperandValues = new List <object>();
            int           varyingWordStart     = 0;
            Operand       varyingOperand       = null;

            while (currentWord < Words.Count)
            {
                Operand operand = Instruction.Operands[currentOperand];
                operand.Type.ReadValue(Words, currentWord, out object value, out int wordsUsed);
                if (operand.Quantifier == OperandQuantifier.Varying)
                {
                    varyingOperandValues.Add(value);
                    varyingWordStart = currentWord;
                    varyingOperand   = operand;
                }
                else
                {
                    int           wordCount     = Math.Min(Words.Count - currentWord, wordsUsed);
                    ParsedOperand parsedOperand = new ParsedOperand(Words, currentWord, wordCount, value, operand);
                    Operands.Add(parsedOperand);
                }

                currentWord += wordsUsed;
                if (operand.Quantifier != OperandQuantifier.Varying)
                {
                    ++currentOperand;
                }
            }

            if (varyingOperand != null)
            {
                VaryingOperandValue varOperantValue = new VaryingOperandValue(varyingOperandValues);
                ParsedOperand       parsedOperand   = new ParsedOperand(Words, currentWord, Words.Count - currentWord, varOperantValue, varyingOperand);
                Operands.Add(parsedOperand);
            }
        }
Example #18
0
        public ContainsFunction(string propertyName, OperandValue operandValue)
        {
            OperatorType = FunctionOperatorType.Custom;
            Operands.Clear();
            Operands.Add(new OperandValue(ContainsFunctionName));
            Operands.Add(new OperandProperty(propertyName));
//            string[] strings = operandValue.Value.ToString().Split(' ');
//            string value = "";
//            for (int i = 0; i < strings.Length; i++)
//            {
//                strings[i] = strings[i].Trim() + " NEAR ";
//                value += strings[i];
//            }
//            value = value.Substring(0, value.LastIndexOf(" NEAR "));
//            operandValue.Value=value;
            operandValue.Value = "\"" + operandValue.Value + "\"";
            Operands.Add(operandValue);
        }
Example #19
0
        private bool ReadVariableOperands(byte[] buffer)
        {
            int types = GetByte(buffer, PC++);
            var value = 0;

            for (var j = 6; j >= 0; j -= 2)
            {
                var t = (OperandType)(((uint)types >> j) & (uint)OperandType.Omitted);

                if (t == OperandType.Omitted)
                {
                    continue;
                }
                switch (t)
                {
                case OperandType.LargeConst:
                    value = GetWord(buffer, PC);
                    PC   += 2;
                    break;

                case OperandType.SmallConst:
                case OperandType.Variable:
                    value = GetByte(buffer, PC++);
                    break;

                case OperandType.Omitted:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                Operands.Add(new Operand(t, value));
            }

            return(false);
        }
Example #20
0
 public Instruction([NotNull] string name, [NotNull] AsmExpr operand1, [NotNull] AsmExpr operand2, [NotNull] AsmExpr operand3, [NotNull] AsmExpr operand4)
     : this(name, operand1, operand2, operand3)
 {
     Operands.Add(operand4);
 }
Example #21
0
 public OrderByExpression(bool descending, Expression columnExpression) : base(SqlExpressionType.OrderBy, columnExpression.Type)
 {
     Descending       = descending;
     ColumnExpression = columnExpression;
     Operands.Add(ColumnExpression);
 }
Example #22
0
        public bool Read(int pc, byte[] buffer)
        {
            PC = pc;
            if (Opcode == 0xBE)
            {
                Type = InstructionType.Ext;
                // Error: Unsupported
                Logger.Error("Opcode 0xBE unsupported");
            }
            else if (Opcode >= 0xC0)
            {
                // Form: Variable
                if ((Opcode & 0x20) == 0x20)
                {
                    Type = InstructionType.Var;
                    // VAR count
                    //                  Logger.Debug($"{Opcode:X2} Variable : VAR count");
                }
                else
                {
                    Type = InstructionType.TwoOp;
                    // 2OP count
                    //                  Logger.Debug($"{Opcode:X2} Variable : 2OP count");
                }

                ReadVariableOperands(buffer);
                Opcode = Opcode & 0x1f;
            }
            else if (Opcode >= 0x80)
            {
                // Form: Short
                var operandType = (OperandType)((uint)(Opcode & 0x30) >> 4);
                if (operandType == OperandType.Omitted)
                {
                    Type = InstructionType.ZeroOp;
                    // 0OP count
                    //                  Logger.Debug($"{Opcode:X2} Short : 0OP count");
                }
                else
                {
                    Type = InstructionType.OneOp;
                    // 1OP count
                    //                   Logger.Debug($"{Opcode:X2} Short : 1OP count");
                    if (operandType == OperandType.LargeConst)
                    {
                        Operands.Add(new Operand(operandType, GetWord(buffer, PC)));
                        PC += 2;
                    }
                    else
                    {
                        Operands.Add(new Operand(operandType, GetByte(buffer, PC++)));
                    }
                }

                Opcode = Opcode & 0xf;
            }
            else
            {
                Type = InstructionType.TwoOp;
                // Form: Long
                // 2OP Count
//                Logger.Debug($"{Opcode:X2} Long : 2OP count");
                var b = ReadTwoOperands(buffer);

                Opcode = Opcode & 0x1f;
            }

            return(true);
        }
Example #23
0
 public YearFunction()
 {
     OperatorType = FunctionOperatorType.Custom;
     Operands.Clear();
     Operands.Add(new OperandValue(YearFunctionName));
 }
Example #24
0
 public YearFunction(string propertyName, int year) : this(propertyName)
 {
     Operands.Add(new OperandValue(year));
 }
Example #25
0
 public YearFunction(string propertyName) : this()
 {
     Operands.Add(new OperandProperty(propertyName));
 }
Example #26
0
            public LineInfo(string RawLine, int SourceFileLine, Dictionary <string, LineInfo> SymbolTable)
            {
                string text = this.RawLine = RemoveSpaces(RawLine);

                this.SourceFileLine = SourceFileLine;
                this.SymbolTable    = SymbolTable;

                Label    = String.Empty;
                Mnemonic = String.Empty;

                if (text.Contains(";"))
                {
                    Comment = text.Substring(text.IndexOf(';') + 1);
                    text    = text.Substring(0, text.IndexOf(';')).TrimEnd();
                }
                else
                {
                    Comment = String.Empty;
                }

                string[] cols = text.Split('\t').Select(c => c.Trim()).ToArray();

                if (cols.Length == 0)
                {
                    return;
                }

                // LABEL

                string label = cols[0];

                if (label.Length == 0)
                {
                    // Nothing to do
                }
                else if (ValidateLabel(ref label))
                {
                    Label = label;
                }
                else
                {
                    SetError("Invalid Label: " + label);
                    return;
                }

                // MNEMONIC

                if (cols.Length > 1)
                {
                    string mnemonic = cols[1];
                    if (mnemonic.Length == 0)
                    {
                    }
                    else if (ValidateMnemonic(ref mnemonic))
                    {
                        Mnemonic = mnemonic;
                    }
                    else
                    {
                        SetError("Invalid Mnemonic: " + mnemonic);
                        return;
                    }
                }

                // OPERANDS

                if (cols.Length > 2)
                {
                    string[] ops = GetCSV(cols[2], 1000);

                    foreach (var o in ops)
                    {
                        Operands.Add(new Operand(this, o.Trim()));
                    }
                }

                if (IsMultiline)
                {
                    switch (Mnemonic)
                    {
                    case "DEFB":
                    case "DEFW":
                    case "DEFM":
                        break;

                    default:
                        SetError("Unexpected number of operands");
                        break;
                    }
                }
                else
                {
                    switch (Mnemonic)
                    {
                    case "ADD":
                    case "ADC":
                    case "SUB":
                    case "SBC":
                    case "AND":
                    case "OR":
                    case "XOR":
                    case "CP":
                        // Change lines like "ADD A, B" to "ADD B"
                        TrimAccumlatorOperand(0);
                        break;
                    }
                }
            }
Example #27
0
 public StartIndexOffsetExpression(bool startsAtOne, Expression startExpression) : base(SqlExpressionType.StartIndexOffset, typeof(int))
 {
     this.InnerExpression = startExpression;
     this.StartsAtOne     = startsAtOne;
     Operands.Add(InnerExpression);
 }
Example #28
0
 public Instruction([NotNull] string name, [NotNull] AsmExpr operand1)
     : this(name)
 {
     Operands.Add(operand1);
 }