private AbstractSyntaxComponent simplifyStatement(FunctionData data) { //注意,为了省内存ValueData上不附带注释了,相关接口无实际效果!!! if (!data.HaveParamOrStatement()) { //没有参数的调用退化为基本值数据 if (data.IsHighOrder) { //这种情况应该不会出现 return(data); } else { return(data.Name); } } else if (data.GetId() == "-" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData("-" + temp.GetId(), ValueData.NUM_TOKEN); return(ret); } else { return(data); } } else if (data.GetId() == "+" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData(temp.GetId(), ValueData.NUM_TOKEN); return(ret); } else { return(data); } } else { return(data); } }
protected override bool Load(FunctionData funcData) { if (!funcData.IsHighOrder && funcData.HaveParam()) { m_Func = funcData.GetId(); int num = funcData.GetParamNum(); for (int ix = 0; ix < num; ++ix) { Dsl.ISyntaxComponent param = funcData.GetParam(ix); m_Args.Add(Interpreter.Load(param)); } return(true); } return(false); }