protected internal virtual Unit createDSNode(DataSet ds, string id, bool check) { if (id[0] == '#') { int colNo = 0; try { colNo = int.Parse(id.Substring(1)); } catch (FormatException) { throw new ReportError("数据集列索引格式不正确"); } if (check) { if (ds == null) { throw new ReportError("数据集未产生"); } if (colNo > ds.ColumnCount) { throw new ReportError("数据集列索引超出范围"); } return(new DSVar(ds, colNo)); } } if (!this.Boolean_0) { if (!check) { return(new DSVar(ds, id)); } if (ds == null) { throw new ReportError("数据集未产生"); } if (ds.isColumnName(id)) { return(new DSVar(ds, ds.getColumnNo(id))); } } else if (LoadFunction.isDSFunName(id)) { FunctionUnit unit2 = check ? LoadFunction.newDSFunction(id, this.env_0, this.cellExt1_0, ds) : LoadFunction.newDSFunction(id, this.env_0, this.cellExt1_0); unit2.setParameter(this.scanParameter()); return(unit2); } return(null); }
protected internal virtual Unit createNode() { char ch = this.string_0[this.int_0]; int num = -1; switch (ch) { case '"': case '\'': { num = ExpString.scanQuotation(this.string_0, this.int_0); if (num == -1) { throw new ReportError("引号不匹配"); } string str3 = this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1)); this.int_0 = num + 1; return(new Constant(str3)); } } if ((this.cellExt1_0 != null) && (ch == '{')) { num = ExpString.scanBrace(this.string_0, this.int_0); if (num == -1) { throw new ReportError("大括号不匹配"); } FunctionUnit unit7 = LoadFunction.newFunction("select", this.env_0, this.cellExt1_0, this.dataSet_0); unit7.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1))); this.int_0 = num + 1; return(unit7); } if ((this.cellExt1_0 != null) && (ch == '[')) { FunctionUnit unit6; num = ExpString.scanBracket(this.string_0, this.int_0); if (num == -1) { throw new ReportError("中括号不匹配"); } if ((this.unit_1 != null) && !this.unit_1.Operator) { if (this.unit_1 is CSVar) { unit6 = LoadFunction.newFunction("move", this.env_0, this.cellExt1_0, this.dataSet_0); unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1))); } else { unit6 = LoadFunction.newFunction("offset", this.env_0, this.cellExt1_0, this.dataSet_0); unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1))); } } else { unit6 = LoadFunction.newFunction("list", this.env_0, this.cellExt1_0, this.dataSet_0); unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1))); } this.int_0 = num + 1; return(unit6); } string id = this.scanId(); if (id.ToUpper().Equals("and".ToUpper())) { return(new And()); } if (id.ToUpper().Equals("or".ToUpper())) { return(new Or()); } if (id.ToUpper().Equals("not".ToUpper())) { return(new Not()); } if (id.ToUpper().Equals("in".ToUpper())) { return(new In()); } if (id.ToUpper().Equals("to".ToUpper())) { return(new To()); } if (id.ToUpper().Equals("like".ToUpper())) { return(new Like()); } DataSet ds = this.dataSet_0; int index = id.IndexOf('.'); if ((index > 0) && !char.IsDigit(id[0])) { string str2 = id.Substring(0, index); if (this.env_0.isDataSetName(str2)) { ds = this.env_0.getDataSet(str2); id = id.Substring(index + 1); Unit unit5 = this.createDSNode(ds, id, true); if (unit5 == null) { throw new ReportError("有不可识别的数据集函数" + id.ToString().ToString()); } return(unit5); } } if (this.dataSet_0 != null) { Unit unit4 = this.createDSNode(this.dataSet_0, id, true); if (unit4 != null) { return(unit4); } } if (this.unit_1 is DSMember) { Unit unit3 = this.createDSNode(this.dataSet_0, id, false); if (unit3 != null) { return(unit3); } } bool isSaved = false; if (id[0] != '@') { if (id[0] == '$') { id = id.Substring(1); isSaved = true; } } else { id = id.Substring(1); } if ((this.cellExt1_0 != null) && id.ToUpper().Equals("value".ToUpper())) { return(new CSCurrent(this.cellExt1_0)); } if (this.env_0.isParamName(id)) { return(new Constant(this.env_0.getParam(id))); } if ((this.cellExt1_0 != null) && this.cellExt1_0.isSource(id.ToLower())) { id = id.ToLower(); if (this.cellExt1_0.getSource(id) != null) { return(new CSVar(this.cellExt1_0.getSource(id), isSaved)); } return(new CSVar(this.cellExt1_0, id)); } if (!this.Boolean_0) { return(new Constant(ConvertTool.parse(id))); } if (!LoadFunction.isFunName(id)) { throw new ReportError("未知的函数" + id.ToString().ToString()); } FunctionUnit unit2 = LoadFunction.newFunction(id, this.env_0, this.cellExt1_0, this.dataSet_0); unit2.setParameter(this.scanParameter()); return(unit2); }