public static void Test4_still_fanning_and_analyz0r(bool analyz0r = false) { var lhsCH = new TypedSingleCH <TestcasesLHSType>(); var FanGE = new GrammarEntry { StartProd = MG.Fan, TR_constructor = (nnode) => new FanTU(new adapter_preCH(lhsCH), (MG.FanNode)nnode) }; var trslLHS = new TranslateLHS { preCH_LHS = new adapter_preCH(lhsCH), scope = new CH_closedScope() }; var compilat = TranslateEntry.TranslateFully_incomplete_tolerant(" { ..intMem1 -> x <- @4 ->x2 , ..intMem2 <- $x2 } ", FanGE, trslLHS); if (analyz0r) { Analyz0r.A.JsonifyCompilat(compilat, "_Test4_still_fanning"); } var MM = new MemMapper(); var LHS_column = MM.get(lhsCH); LHS_column.AddVal(new TestcasesLHSType()); LHS_column.AddVal(new TestcasesLHSType()); LHS_column.AddVal(new TestcasesLHSType()); Evaluate.Eval(compilat, MM); if (analyz0r) { Analyz0r.A.JsonifyEval(compilat, MM, "_Test4_still_fanning"); } }
public static ShellCommon.EVAL_Resp EVAL_stateless(ShellCommon.EVAL_Req eval_req, bool analyz0r = false) { // fetch evaluation entry from the current junkjard that is EvaluatorTests_and_random_fux0ring.cs GrammarEntry GE = new GrammarEntry { StartProd = MG.ProvStart, TR_constructor = NN => new TranslateAndEval.ProvStartTU((MG.ProvStartNode)NN) }; TranslateLHS TLHS = new TranslateLHS { preCH_LHS = null, scope = new TranslateAndEval.CH_closedScope() }; Compilat compilat; try { compilat = TranslateEntry.TranslateFully_incomplete_tolerant(eval_req.expr, GE, TLHS); } catch (Exception e) { return(new ShellCommon.EVAL_Resp { success = false, msg = "translate ERROR : " + e.Message + "\n" + e.StackTrace, result = new SObject[0] }); } if (analyz0r) { Analyz0r.A.JsonifyCompilat(compilat); } var MM = new TranslateAndEval.MemMapper(); TranslateAndEval.Column resultColumn; try { resultColumn = Evaluate.Eval(compilat, MM); } catch (Exception e) { return(new ShellCommon.EVAL_Resp { success = false, msg = "eval ERROR : " + e.Message + "\n" + e.StackTrace, result = new SObject[0] }); } try { if (analyz0r) { Analyz0r.A.JsonifyEval(compilat, MM); } } catch (Exception) {} // TODO - write a message to the file about how this crashed var resp = new ShellCommon.EVAL_Resp { success = true, msg = "OK", result = resultColumn.values.ToArray() // <- current serialization (ShellNetworkGlue.cs) simply does a ToString() for all Objects }; return(resp); }
public static Column Eval_incomplete_tolerant(string strExpr, GrammarEntry GE, TranslateLHS trans_LHS, MemMapper MM, out CH_closedScope scope_out) { var compilat = TranslateEntry.TranslateFully_incomplete_tolerant(strExpr, GE, trans_LHS); scope_out = compilat.deltaScope.close(); #if todo_fixme // external refs in the scopes still need implementation ( done . todo plug this shit in ) foreach (var sc_ref in compilat.ownDecls) { scope_out = (ClosedScope)scope_out.decl(sc_ref); } #endif compilat.run(MM); // atm the MM keeps references on tmp columns around forever - some pruning mechanism is needed VBoxTU last_VBT = compilat.VBoxTrs.Last(); return(MM.getGen(last_VBT.CH_out)); }
public static ShellCommon.TYPEINFO_Resp TYPEINFO(ShellCommon.TYPEINFO_Req req) { // only do this for requests that are valid to be exectuted -> no relaxed grammar // thus, most of this is copypasta from Operations_EVAL.cs GrammarEntry GE = new GrammarEntry { StartProd = MG.ProvStart, TR_constructor = NN => new TranslateAndEval.ProvStartTU((MG.ProvStartNode)NN) }; TranslateLHS TLHS = new TranslateLHS { preCH_LHS = null, scope = new TranslateAndEval.CH_closedScope() }; Compilat compilat; try { compilat = TranslateEntry.TranslateFully_incomplete_tolerant(req.expression, GE, TLHS); } catch (Exception e) { return(new ShellCommon.TYPEINFO_Resp { success = false, msg = e.Message, // defaults to make serialization easier -- little use in specifying a contract here, as this is likely to change anyway members = new System.Type[0] }); } var result_type = compilat.VBoxTrs.Last().CH_out.ttuple.PayT; // out-Type of last column var memIs = result_type .GetMembers() .Where(x => x.MemberType == System.Reflection.MemberTypes.Field || x.MemberType == System.Reflection.MemberTypes.Property) .ToArray(); return(new ShellCommon.TYPEINFO_Resp { success = true, msg = "", expr_unity_type = result_type, unique = true, // FIXME : todo members = memIs }); }
public static void GreenCameraTest() { #if NetworklessShell Console.WriteLine(" --- GreenCameraTest() ---"); var go_foo_cam = new GameObject(); go_foo_cam.AddComponent <Camera>(); go_foo_cam.GetComponent <Camera>().name = "foo"; var go_other_cam = new GameObject(); go_other_cam.AddComponent <Camera>(); Resources.roots = new [] { go_foo_cam, go_other_cam }; var query = ">> :Camera .%projectionMatrix <- @[[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4]]"; var GramE = new GrammarEntry { StartProd = MG.ProvStart, TR_constructor = (prov_start_node) => new ProvStartTU((MG.ProvStartNode)prov_start_node) }; var transl_LHS = new TranslateLHS { preCH_LHS = null, scope = new CH_closedScope() }; var compilat1 = TranslateEntry.TranslateFully_incomplete_tolerant(query, GramE, transl_LHS); var MM = new MemMapper(); var res = Evaluate.Eval(compilat1, MM); Console.WriteLine(res); var query2 = ">> :Camera {.name == @\"foo\"} .projectionMatrix <- @[[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4]]"; var compilat2 = TranslateEntry.TranslateFully_incomplete_tolerant(query2, GramE, transl_LHS); Analyz0r.A.JsonifyCompilat(compilat2, "_GreenCam_with_fan"); var res2 = Evaluate.Eval(compilat2, MM); Console.WriteLine(res2); Analyz0r.A.JsonifyEval(compilat2, MM, "_GreenCam_with_fan"); Console.WriteLine(" --- GreenCameraTest() done ---"); #endif }