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); } }
/**** * 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); } }
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); }
protected override bool OperationIsCorrect() => OperandType.Equals(SimpleType.Boolean);
protected override bool OperationIsCorrect() => OperandType.Equals(SimpleType.Integer) || OperandType.Equals(SimpleType.Real);