/// <summary> /// 条件部分 /// </summary> private void Where() { this.ValidChar('('); var w = new ValueEleme(); w.Father = this.NEleme; this.pifEleme.Where = w; var vSpan = new ValueSpan(this.PBParser, w); vSpan.Init(); this.ValidChar(')'); }
/// <summary> /// /// </summary> /// <returns></returns> public bool Foreach() { this.SetUpPoint(); string varName = string.Empty; this.GetTag(); if (this._Tag == "var") { this.GetTagNotNull(); varName = this._Tag; } else { varName = this._Tag; } this.GetTag(); if (this._Tag != "in") { this.ResetUpPoint(); return(false); } pFEleme = new JForeachEleme(); pFEleme.Father = this.NEleme; pForeachEleme = pFEleme as JForeachEleme; pForeachEleme.Name = varName + "_" + this.PBParser.VarIndexCount++ + "_"; var def = new JDefinitionEleme(); def.SetPoint(this.PBParser.Point); def.Name = varName; var exists = this.ValidateNameExists(varName); if (exists != null) { def.Name = exists.GetAliasName(); def.PVariableType = Entity.EVariableType.SetValue; } this.AddFather(def, new JConstEleme(pForeachEleme.Name, Entity.EValueType.Const)); this.AddFather(pForeachEleme, def); var vE = new ValueEleme(); vE.Father = this.NEleme; var vS = new ValueSpan(this.PBParser, vE); vS.Init(); pForeachEleme.Where = vE; return(true); }
private void NewClass() { var exists = this.ValidateNameExists(this._Tag); var newE = new JNewEleme(); if (exists == null) { this.Error(this._Tag + " 未定义"); } newE.Name = exists.GetAliasName(); this.AddFather(newE); this.SetUpPoint(); this.GetChar(); if (this._Char == ')') { return; } this.ResetUpPoint(); if (newE.Arguments == null) { newE.Arguments = new List <ValueEleme>(); } Loop: var valueE = new ValueEleme(); valueE.Father = this.NEleme; var valueS = new ValueSpan(this.PBParser, valueE); valueS.Init(); newE.Arguments.Add(valueE); this.GetChar(); switch (this._Char) { case ',': goto Loop; case ')': break; default: this.Error(); break; } }
private void SetValue() { var varElem = new JPropertyEleme(); varElem.IsSetValue = true; varElem.Name = this._Tag; varElem.Father = this.NEleme; this.pVariableAttr.Property = varElem; var valueE = new ValueEleme(); valueE.Father = this.NEleme; varElem.Value = valueE; var valueSpan = new ValueSpan(this.PBParser, valueE); valueSpan.Init(); }
//private bool isVar = false; public override void Init() { if (pValueEleme == null) { this.pValueEleme = new JValueEleme(); this.AddFather(this.pValueEleme); } string oper = string.Empty; Start: this.GetChar(); switch (this._Char) { case '(': this.AutoFun(); break; case '[': this.Array(); break; case '{': this.Dictionary(); break; case '!': case '~': #region 加减 case '+': case '-': oper += this._Char.ToString(); goto Start; #endregion #region 数字 case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': this.Number(oper); break; #endregion #region 字符串 case '\'': case '"': this._String(oper); break; #endregion default: Var(oper); break; } this.End(); }
public void SetValueEleme(ValueEleme valueEleme) { this.pValueEleme = valueEleme; }
public void For() { pFEleme = new JForEleme(); pForEleme = pFEleme as JForEleme; #region 定义参数 this.SetUpPoint(); this.GetChar(); if (this._Char != ';') { this.ResetUpPoint(); this.GetTag(); var valueS = new VarSpan(this); if (this._Tag != "var") { var exists = this.ValidateNameExists(this._Tag); if (exists != null) { valueS.IsDef = true; valueS.VarName = exists.GetAliasName(); } else { valueS.VarName = this._Tag; } } valueS.Init(); } #endregion #region Statement2 this.SetUpPoint(); this.GetChar(); if (this._Char != ';') { this.ResetUpPoint(); pForEleme.Statement2 = new ValueEleme(); pForEleme.Statement2.Father = this.NEleme; var valueE = new ValueEleme(); this.AddFather(pForEleme.Statement2, valueE); var valueS = new ValueSpan(this.PBParser, valueE); valueS.Init(); } #endregion #region where this.SetUpPoint(); this.GetChar(); if (this._Char != ';') { this.ResetUpPoint(); pForEleme.Where = new ValueEleme(); pForEleme.Where.Father = this.NEleme; var valueE = new ValueEleme(); this.AddFather(pForEleme.Where, valueE); var valueS = new ValueSpan(this.PBParser, valueE); valueS.Init(); } #endregion }