Ejemplo n.º 1
0
        //    public CToken oprator( CToken param)
        //{
        //    return this;
        //}

        protected OPERAND GetFinalOperator(CToken _token)
        {
            OPERAND tempoperand = new OPERAND();

            switch (_token.m_token)
            {
            case Token_Type.Token_Constant:
                tempoperand.Index = ((CTokenOperand)_token).m_Index;
                tempoperand.Token = (byte)((CTokenOperand)_token).m_token;
                //tempoperand.type = ((CTokenOperand)_token).m_Type;
                break;

            case Token_Type.Token_String:
                tempoperand.Index = ((CTokenOperand)_token).m_Index;
                tempoperand.Token = (byte)((CTokenOperand)_token).m_token;
                //tempoperand.type = ((CTokenOperand)_token).m_Type;
                break;

            case Token_Type.Token_Variable:
                //_operand8[0].type = (VarType) ((CTokenVariable*)tok)->m_PropertyType ;
                tempoperand.Token = (byte)_token.m_token;
                //_operand8[0].Index = ((CTokenVariable*)tok)->m_Index;
                tblFunction tblfunction = tblSolution.m_tblSolution().GetFunctionbyType(((CTokenVariable)_token).tblvariable.Type);
                if (((CTokenVariable)_token).isrefernce)
                {
                    tempoperand.Index         = ((CTokenVariable)_token).tblvariable.VarNameID;
                    tempoperand.PropertyNo    = 0;
                    tempoperand.HasSubPropety = 0;
                    tempoperand.SubProperty   = 0;
                    tempoperand.IsReference   = 1;
                }
                else
                {
                    tempoperand.IsReference = 0;
                    if (Common.IsSimpleType(((CTokenVariable)_token).tblvariable.Type) ||
                        (tblfunction.IsStandard && !tblfunction.IsFunction))
                    {
                        tempoperand.Index         = ((CTokenVariable)_token).tblvariable.VarNameID;
                        tempoperand.PropertyNo    = (byte)((CTokenVariable)_token).tblformalparameter.oIndex;
                        tempoperand.HasSubPropety = ((CTokenVariable)_token).HasSubPropety;
                        tempoperand.SubProperty   = ((CTokenVariable)_token).SubProperty;
                    }
                    else
                    {
                        foreach (tblVariable _linktblvariable in ((CTokenVariable)_token).tblvariable.m_tblFInstanceVariableList)
                        {
                            if (_linktblvariable.ParentVarLinkName == ((CTokenVariable)_token).tblformalparameter.PinName)
                            {
                                tempoperand.Index      = _linktblvariable.VarNameID;
                                tempoperand.PropertyNo = 0;
                                break;
                            }
                        }
                    }
                }


                break;

            case Token_Type.Token_TempString:
            case Token_Type.Token_TempValue:
                tempoperand.Index = ((CTokenTempVariable)_token).m_Index;
                tempoperand.Token = (byte)((CTokenTempVariable)_token).m_token;
                tempoperand.type  = ((CTokenTempVariable)_token).m_Type;
                Compiler.FreeAssignedTempVar(tempoperand.type, (int)tempoperand.Index);
                break;

            case Token_Type.Token_FBDPin:
                tempoperand.Index         = ((CTokenFBDPin)_token).tblvariable.VarNameID;
                tempoperand.PinID         = ((CTokenFBDPin)_token).PinID;
                tempoperand.PropertyNo    = (byte)((CTokenFBDPin)_token).tblformalparameterVariable.oIndex;
                tempoperand.HasSubPropety = ((CTokenFBDPin)_token).HasSubPropety;
                tempoperand.SubProperty   = ((CTokenFBDPin)_token).SubProperty;
                tempoperand.PinNo         = (byte)((CTokenFBDPin)_token).tblformalparameterPin.oIndex;
                tempoperand.Token         = (byte)((CTokenOperand)_token).m_token;
                break;

            default:
                break;
            }
            return(tempoperand);
        }
Ejemplo n.º 2
0
 protected int ReturnType(CToken t1, CToken t2)
 {
     return(ReturnType(t1.GetTokenPinType(), t2.GetTokenPinType()));
 }