예제 #1
0
 private OperatorsType getOperatorsType(OperandType leftType, OperandType rightType)
 {
     if (leftType.Equals(rightType) && leftType.Equals(OperandType.attr))
     {
         return(OperatorsType.attr2attr);
     }
     else if (!leftType.Equals(OperandType.attr) && !rightType.Equals(OperandType.attr))
     {
         return(OperatorsType.constant2constant);
     }
     else if (leftType.Equals(OperandType.attr))
     {
         return(OperatorsType.attr2constant);
     }
     else if (!leftType.Equals(OperandType.attr))
     {
         swapTwo(this.leftOpd, this.rightOpd);
         return(OperatorsType.attr2constant);
     }
     else
     {
         //???????
         return(OperatorsType.attr2constant);
     }
 }
예제 #2
0
 /****
  * if type is attr, get the name string
  * if type is num, get the int number
  * if type is str, get the string without leading and trailing '
  */
 public dynamic getOperand()
 {
     if (type.Equals(OperandType.str))
     {
         return(content.Replace(",", ""));
     }
     else if (type.Equals(OperandType.num))
     {
         return(content);
     }
     else
     {
         return(content);
     }
 }
예제 #3
0
        public override ISemanticType GetSemanticType()
        {
            OperandType = Operand.GetSemanticType();
            if (OperationIsCorrect())
            {
                return(ReturnType());
            }

            if (!OperandType.Equals(SimpleType.Undefined))
            {
                GenerateFind(new NotApplicableOperatorTypes(Token.Operator, Token, OperandType.FullType));
            }

            return(SimpleType.Undefined);
        }
예제 #4
0
 protected override bool OperationIsCorrect() => OperandType.Equals(SimpleType.Boolean);
예제 #5
0
 protected override bool OperationIsCorrect()
 => OperandType.Equals(SimpleType.Integer) || OperandType.Equals(SimpleType.Real);