public ICLS_Expression Compiler_Expression_DefineAndSet(IList <Token> tlist, CLS_Content content, int pos, int posend) { int expbegin = pos + 3; int bdep; int expend = FindCodeAny(tlist, ref expbegin, out bdep); if (expend != posend) { expend = posend; } ICLS_Expression v; bool succ = Compiler_Expression(tlist, content, expbegin, expend, out v); if (succ && v != null) { CLS_Expression_Define define = new CLS_Expression_Define(pos, posend); if (tlist[pos].text == "bool") { define.value_type = typeof(bool); } else { ICLS_Type type = content.environment.GetTypeByKeyword(tlist[pos].text); define.value_type = type.type; } define.value_name = tlist[pos + 1].text; define.listParam.Add(v); return(define); } LogError(tlist, "不正确的定义表达式:", pos, posend); return(null); }
public ICLS_Expression Compiler_Expression_DefineAndSet(IList<Token> tlist, CLS_Content content, int pos, int posend) { int expbegin =pos+3; int bdep; int expend = FindCodeAny(tlist, ref expbegin, out bdep); if(expend!=posend) { expend = posend; } ICLS_Expression v; bool succ = Compiler_Expression(tlist,content, expbegin, expend, out v); if(succ&&v!=null) { CLS_Expression_Define define = new CLS_Expression_Define(pos,posend); if (tlist[pos].text == "bool") { define.value_type = typeof(bool); } else { ICLS_Type type = content.environment.GetTypeByKeyword(tlist[pos].text); define.value_type = type.type; } define.value_name = tlist[pos + 1].text; define.listParam.Add(v); return define; } LogError(tlist,"不正确的定义表达式:" , pos,posend); return null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Expression_Define define = listParam[0] as CLS_Expression_Define; if (define == null) { } define.ComputeValue(content); System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable; ICLS_Expression expr_block = listParam[2] as ICLS_Expression; var it = emu.GetEnumerator(); while (it.MoveNext()) { content.Set(define.value_name, it.Current); if (expr_block != null) { var v = expr_block.ComputeValue(content); if (v != null && v.breakBlock > 1) { break; } ; } } //ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; //ICLS_Expression expr_step = listParam[2] as ICLS_Expression; //ICLS_Expression expr_block = listParam[3] as ICLS_Expression; //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content)) //{ // if(expr_block!=null) // { // var v = expr_block.ComputeValue(content); // if (v != null && v.breakBlock > 1) break; ; // //if (v.breakBlock == 1) continue; // //if (v.breakBlock == 2) break; // //if (v.breakBlock == 10) return v; // } //} content.DepthRemove(); content.OutStack(this); return(null); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public ICLS_Expression Compiler_Expression_Define(IList<Token> tlist,CLS_Content content, int pos,int posend) { CLS_Expression_Define define = new CLS_Expression_Define(pos, posend); if (tlist[pos].text == "bool") { define.value_type = typeof(bool); } else { ICLS_Type type = content.environment.GetTypeByKeyword(tlist[pos].text); define.value_type = type.type; } define.value_name = tlist[pos+1].text; return define; }
public ICLS_Expression Compiler_Expression_Define(IList <Token> tlist, CLS_Content content, int pos, int posend) { CLS_Expression_Define define = new CLS_Expression_Define(pos, posend); if (tlist[pos].text == "bool") { define.value_type = typeof(bool); } else { ICLS_Type type = content.environment.GetTypeByKeyword(tlist[pos].text); define.value_type = type.type; } define.value_name = tlist[pos + 1].text; return(define); }