Ejemplo n.º 1
0
        public Sql_Condition(String leftOpd_str, String op, String rightOpd_str)
        {
            //Console.WriteLine(leftOpd_str + " " + op + " " + rightOpd_str);
            if (leftOpd_str.Equals("") && op.Equals("") && rightOpd_str.Equals(""))
            {
                return;
            }

            OperandType leftType = getOperandType(leftOpd_str);

            this.leftOpd = new Sql_Operand(leftOpd_str, leftType);

            if (rightOpd_str.Equals("") && op.Equals(NULL_OPERATION))
            {
                this.op     = Operators.none;
                this.opType = OperatorsType.onlyOne;
                return;
            }

            OperandType rightType = getOperandType(rightOpd_str);

            this.rightOpd = new Sql_Operand(rightOpd_str, rightType);

            this.opType = getOperatorsType(leftType, rightType);

            this.op = getOperatorsOrThrowException(op, leftOpd_str, rightOpd_str);
        }
Ejemplo n.º 2
0
        void Woodification(TempNode node, ref int i, OperatorsType operatorsType)
        {
            if (node.Datas.Count > i + 1)
            {
                OperatorNode operatorNode = new OperatorNode();
                operatorNode.ThisOperatorsType = operatorsType;
                if (node.Datas[i + 1].Data == "-" || node.Datas[i + 1].Data == "+")
                {
                    node.Datas[i + 1].Data = node.Datas[i + 1].Data + node.Datas[i + 2].Data;
                    node.Datas.RemoveAt(i + 2);
                }

                operatorNode.LeftSide  = node.Datas[i - 1];
                operatorNode.RightSide = node.Datas[i + 1];
                for (int j = i - 1; j <= i + 1; j++)
                {
                    node.Datas.RemoveAt(i - 1);
                }
                node.Datas.Insert(i - 1, operatorNode);
                i--;
            }
            else
            {
                node.Datas.RemoveAt(i);
                i--;
            }
        }
Ejemplo n.º 3
0
 public Token(TokenType type, string value, OperatorsType op = OperatorsType.NONE)
 {
     this.Type     = type;
     this.Value    = value;
     this.Operator = op;
 }