private void Switch() { this.ValidChar('('); //this.GetTagNotNull(); var switchE = new JSwitchEleme(); this.AddFather(switchE); switchE.Sign = (this.PBParser.VarIndexCount++).ToString(); this.SetUpPoint(); this.GetChar(); if (this._Char == ')') { this.Error(); } this.ResetUpPoint(); switchE.Where = new ValueEleme(); switchE.Where.Father = this.NEleme; var valueSpan = new ValueSpan(this.PBParser, switchE.Where); valueSpan.Init(); this.ValidChar(')'); //var exists = this.ValidateNameExists(this._Tag); //if (exists == null) // this.Error(this._Tag + " 未定义"); //else // this._Tag = exists.GetAliasName(); //switchE.Name = "SWITCH_NAME_"+ SW +"_"; this.ValidChar('{'); new JavaSciptSpan(this.PBParser, switchE).Init(); this.ValidChar('}'); }
public override void Init() { this.SetUpPoint(); this.GetChar(); bool isC = false; if (this._Char == '(') { isC = true; } else { this.ResetUpPoint(); } var tE = new JThrowEleme(); tE.Point = new CPoint(this.PBParser.Point); this.AddFather(tE); var vSpan = new ValueSpan(this.PBParser, tE); vSpan.Init(); if (isC) { this.ValidChar(')'); } }
private void AddKeyValue() { if (Tools.StrStartChars.Contains(this._Char)) { this._Tag = this.GetString(this._Char); } else { this._Tag = this.PBParser.GetTag(true, false); } this.ValidChar(':'); var vElem = new JValueEleme(); vElem.Father = this.pDictionaryEleme; var vSpan = new ValueSpan(this.PBParser, vElem); vSpan.Init(); this.pDictionaryEleme.Dict.Add(this._Tag, vElem); this.GetChar(); switch (this._Char) { case ',': this.GetChar(); this.AddKeyValue(); break; case '}': break; default: this.Error(); break; } }
private void Case() { if (!(this.NEleme is JSwitchEleme)) { this.Error(); } this.pSwwitchEleme = this.NEleme as JSwitchEleme; var caseE = new JCaseEleme(); caseE.Father = this.NEleme; if (this.pSwwitchEleme.Case == null) { this.pSwwitchEleme.Case = new List <JCaseEleme>(); } this.pSwwitchEleme.Case.Add(caseE); caseE.Value = new ValueEleme(); caseE.Value.Father = this.NEleme; var valueSpan = new ValueSpan(this.PBParser, caseE.Value); valueSpan.Init(); this.ValidChar(':'); var jSpan = new JavaSciptSpan(this.PBParser, caseE); jSpan.IsCase = true; jSpan.Init(); }
private void Return() { this.SetUpPoint(); this.GetChar(); var retE = new JReturnValue(); this.AddFather(retE); if (this._Char == ';' || this._Char == '}' || this._Char == Tools.AllEndChar) { if (this._Char != ';') { this.ResetUpPoint(); } return; } this.ResetUpPoint(); var fatherFun = retE.GetFather <JFunEleme>(); if (fatherFun == null) { this.Error("未知错误"); } retE.Sing = fatherFun.Sign; var vE = new JValueEleme(); vE.Father = this.NEleme; retE.Value = vE; var valueSpane = new ValueSpan(this.PBParser, vE); valueSpane.Init(); }
private void SetAutoFun() { var valueSpan = new ValueSpan(this); valueSpan.AutoFun(); this.AddFather(new MarkElem(";\r\n")); }
public override void Init() { this.SetUpPoint(); this.GetChar(); bool isC = false; if (this._Char == '(') { isC = true; } else { this.ResetUpPoint(); } var typeE = new JTypeofEleme(); this.AddFather(typeE); var vSpan = new ValueSpan(this.PBParser, typeE); vSpan.Continuous = false; vSpan.Init(); if (isC) { this.ValidChar(')'); } }
public override void Init() { this.SetUpPoint(); this.GetChar(); if (this._Char == this.ArrayEndChar) { return; } this.ResetUpPoint(); Start: var valueE = new JValueEleme(); this.AddFather(valueE); var valueSpan = new ValueSpan(this.PBParser, valueE); valueSpan.Init(); this.GetChar(); switch (this._Char) { case ',': goto Start; default: if (this._Char == ArrayEndChar) { break; } this.Error(); break; } }
/// <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); }
public override void Init() { var whileE = new JWhileEleme(); this.AddFather(whileE); this.ValidChar('('); whileE.Where = new ValueEleme(); whileE.Where.Father = this.NEleme; var vSpan = new ValueSpan(this.PBParser, whileE.Where); vSpan.Init(); this.ValidChar(')'); this.ValidChar('{'); new JavaSciptSpan(this.PBParser, whileE).Init(); this.ValidChar('}'); }
private void AddOrReduce() { var fchar = this._Char; this.GetChar(); if (this._Char != fchar) { this.Error(); } this.ResetUpPoint(); var line = new JLineEleme(); this.AddFather(line); var valueSpan = new ValueSpan(this.PBParser, line); valueSpan.Init(); }
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 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; } }
/// <summary> /// 索引 /// </summary> private void Index() { Start: this.SetUpPoint(); this.GetChar(); BEleme elem = null; if (Tools.StrStartChars.Contains(this._Char)) { elem = new JConstEleme("\"" + this.GetString(this._Char) + "\"", EValueType.Const); } else if (char.IsNumber(this._Char)) { elem = new JConstEleme(this.GetIntString(), EValueType.Const); } else { this.ResetUpPoint(); elem = new JValueEleme(); elem.Father = this.NEleme; var valueS = new ValueSpan(this.PBParser, elem); valueS.Init(); } this.GetChar(); switch (this._Char) { case ',': goto Start; case ']': var jIndex = new JIndexEleme(); jIndex.IndexEleme = elem; elem.Father = jIndex; this.pVariableAttr.Index = jIndex; jIndex.Father = this.NEleme; this.End(EPType.Index, jIndex); break; default: this.Error(); break; } }
private void Method() { this.SetUpPoint(); this.GetChar(); var varElem = new JMethodEleme(); varElem.Name = this._Tag; varElem.Father = this.NEleme; this.pVariableAttr.Method = varElem; if (this._Char != ')') { this.ResetUpPoint(); Start: var noElem = new NoEleme(); noElem.Father = this.NEleme; var valueSpan = new ValueSpan(this.PBParser, noElem); valueSpan.Init(); if (varElem.Arguments == null) { varElem.Arguments = new List <BEleme>(); } varElem.Arguments.Add(noElem.Childs[0]); this.GetChar(); switch (this._Char) { case ',': goto Start; case ')': break; default: this.Error(); break; } } this.End(EPType.Method, varElem); }
public override void Init() { if (string.IsNullOrEmpty(VarName)) { this.GetTag(); if (string.IsNullOrEmpty(this._Tag)) { this.Error("无法找到定义的变量名称"); } } else { this._Tag = this.VarName; } this.ValidVar(); var definition = new JDefinitionEleme(); definition.SetPoint(this.PBParser.Point); definition.Name = this._Tag; definition.OperationChar = this.OperationChar; this.AnalysisAnnotation(definition); BEleme vdef = null; if (string.IsNullOrEmpty(this.VarName)) { vdef = this.ValidateNameExists(this._Tag, false); } else if (this.IsDef) { definition.PVariableType = Entity.EVariableType.SetValue; } if (vdef != null) { definition.PVariableType = Entity.EVariableType.SetValue; definition.Name = definition.GetAliasName(); } this.SetUpPoint(); this.GetChar(); if (this._Char == '=') { this.ResetUpPoint(); this.ValidChar('='); this.AddFather(definition); var valueSpan = new ValueSpan(this.PBParser, definition); valueSpan.Init(); } else if (this._Char == ',') { this.AddFather(definition, new JConstEleme("", Entity.EValueType.Undefined)); this.AddFather(definition); this.ResetUpPoint(); } else { if (this._Char != ';') { this.ResetUpPoint(); this.GetChar(false); if (this._Char != Tools.LineEndChar) { this.Error(); } } if (!(string.IsNullOrEmpty(VarName) || this.IsFollowUp)) { this.Error(); } this.AddFather(definition, new JConstEleme("", Entity.EValueType.Undefined)); this.AddFather(definition); } this.SetUpPoint(); this.GetChar(); if (this._Char == ',') { FollowUp(); } else { this.ResetUpPoint(); } }
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 }