public override void eval(Context ctx) { foreach (var obj in generator_func(ctx)) { Col_out.AddVal(obj, null); } }
public override void eval(Context c) { foreach (VBox vb in Col_in.boxes) { Col_out.AddVal(pay, vb); } }
public override void eval(Context _) { foreach (var box_in in Col_in.boxesT) { Col_out.AddVal((Tprop)pi.GetValue(box_in.value(), new object [0]), box_in); } }
public override void eval(Context _) { foreach (var box_in in Col_in.boxesT) { Col_out.AddVal((Tfield)fi.GetValue(box_in.value()), box_in); } }
public override void eval(Context c) { IEnumerator <B> arg_enum; // what happens to cyclic if the in-Enumerable has zero Elements ? -- even in the absence of bugs, that would be a valid use case for $vars in the arg // Cyclic throws if the in_seq is empty // default behaviour in this case? // i'm leaning towards silently nope-ing the entire in-Column - but leave this Exception uncought for now as a reminder that this question needs further thought if (use_repeater) { arg_enum = Col_arg.valuesT.NonEmptyCyclic().GetEnumerator(); } else { arg_enum = Col_arg.valuesT.GetEnumerator(); } foreach (var box_in in Col_in.boxesT) { if (!arg_enum.MoveNext()) { throw new Exception("binary filter (repeater: " + use_repeater + ") : arg column exhausted before in_column -- this is likely bug in #fetch "); } B arg_val = arg_enum.Current; if (FilterF(box_in.valueT(), arg_val)) { Col_res.AddVal(box_in.valueT(), box_in); } } if ((!use_repeater) && arg_enum.MoveNext()) // no repeater means #fetch in this case the enumerator is expected to be exhausted at this point { throw new Exception("binary filter : non exhausted arg enumerator "); } }
public override void eval(Context c) { foreach (var box_in in Col_in.boxesT) { foreach (Transform ch_go_transform in box_in.valueT().transform) { Col_out.AddVal(ch_go_transform.gameObject); } } }
public override void eval(Context c) { foreach (VBox <CollectionT> coll_Box in Col_in.boxesT) { foreach (ElementT elem in coll_Box.valueT()) { Col_out.AddVal(elem, coll_Box); } } }
public override void eval(Context c) { var values = referenced_Column.valuesT.NonEmptyCyclic(); var zipped = AUX.Zip(LHS_Column.boxes, values, (b, v) => new { box = b, val = v }); foreach (var anon_tpl in zipped) { out_Column.AddVal(anon_tpl.val, anon_tpl.box); } }
public override void eval(Context c) { foreach (var box_in in Col_in.boxesT) { if (FilterF(box_in.valueT())) { Col_out.AddVal(box_in.valueT(), box_in); } } }
public override void eval(Context c) { foreach (var box_in in Col_in.boxesT) { T_comp_out comp = box_in.valueT().GetComponent <T_comp_out>(); if (comp != null) { Col_out.AddVal(comp, box_in); } } }
public override void eval(Context c) { if (MI.IsStatic) // todo : lotsa exceptions n sheet { foreach (var lhs_box in args_Column.boxesT) { var res = MI.Invoke(null, lhs_box.valueT().args); out_Column.AddVal((OutT)res, lhs_box); } } else { foreach (var lhs_box in args_Column.boxesT) { SObject[] args = lhs_box.valueT().args; var res = MI.Invoke(args[0], args.Skip(1).ToArray()); out_Column.AddVal((OutT)res, lhs_box); } } }
public override void eval(Context c) { if (data_CHs.Length == 0) { foreach (var lhs_box in lhs_Column.boxes) { out_Column.AddVal(new arg_tuple(new SObject[0]), lhs_box); } return; } /* * with non-zero FrameElems lhs_CH is a Column generated as part of the Frame and can be assumed single * likewise the leftmost DataCH ( immediate predecessor of the leftmost BShift ) * is also neccesarily generated by Frame * [ Exp , ... ] ( until there is a way to translate the first Exp without generating a Column, which there currently isn't and likely never will be ) * * ... from a type safety point of view, it would make more sense to simply have two OPCodes for the zero and N-arg cases though ... */ var lhs_ColumnSingle = (ColumnSingle)lhs_Column; var args = new SObject[data_CHs.Length]; foreach (VBoxSingle lhs_box in lhs_ColumnSingle.boxesSingle) { VBoxSingle currentBox = lhs_box; for (int i_per_arg = data_CHs.Length - 1; i_per_arg >= 0; i_per_arg--) { for (int i_step = 0; i_step < steps2CH[i_per_arg]; i_step++) { // .... i'm not going to introduce N-types expressing "this is `single` and N of its predecessors must be too" :) currentBox = (VBoxSingle)currentBox.pred(); } args[i_per_arg] = currentBox.value(); } out_Column.AddVal(new arg_tuple(args), lhs_box); } }
public override void eval(Context c) { foreach (var box_lhs in lhsCol.boxesT) { VBox currBox = box_lhs; for (int i = 0; i < backsteps; i++) // walk back from lhs_boxes to add only those from origColumn, that are reachable from lhs { currBox = (currBox as VBoxSingle).pred(); // this operation is only valid if the entire path had no multi columns - if this cast fails the error is in translate // todo : check this in constructor } var origBox = (VBox <PayOrig>)currBox; out_Col.AddVal(origBox.valueT(), box_lhs); } }
public static void Test1() { //LexxAndRun( ".*foo -> x <- y -> z " ); Console.WriteLine(LexxAndParse(".*foo", MG.MemA)); Console.WriteLine(LexxAndParse(".*foo -> x ", MG.MemAVT)); Console.WriteLine(LexxAndParse(".*foo -> x ", MGRX.MemAVT_RX)); Console.WriteLine(LexxAndParse("..str", MGRX.MemAVT_RX)); Console.WriteLine(LexxAndParse("..str -> foo", MGRX.MemAVT_RX)); Console.WriteLine(LexxAndParse("..str -> foo", TestMG1.TestStartRX)); Console.WriteLine("----------- whoooo ------- "); Console.WriteLine(LexxAndParse(" <- $XX ", MG.SingleAssign)); Console.WriteLine(LexxAndParse(" <- $XX -> a -> b ", MG.AssignVT)); Console.WriteLine(LexxAndParse(" .*foo -> decl1 <- $ARG -> decl2 ", TestMG1.TestStart)); // ----------------------------------------------------------------- var MM = new MemMapper(); var dollar_arg_CH = new TypedSingleCH <int>(); // Method I: hack column entries into MM directly ColumnSingle <int> dollar_arg_Column = (ColumnSingle <int>)dollar_arg_CH.SpawnColumn(); // todo: maybe provide SpawnColumnT that "kinda-overloads" on the return type MM.D[dollar_arg_CH] = dollar_arg_Column; dollar_arg_Column.AddVal(3, null); dollar_arg_Column.AddVal(4, null); // Method II: abuse MemMapper for column creation ColumnSingle <TestcasesLHSType> LHS_column; LHS_column = MM.get(DummyInstances.TestcasesLHSsingletonTypedCH); // TypedSingle<DummyType> LHS_column.AddVal(new TestcasesLHSType(), null); LHS_column.AddVal(new TestcasesLHSType(), null); LHS_column.AddVal(new TestcasesLHSType(), null); CH_closedScope scope = new CH_closedScope(); scope = scope.decl("ARG", dollar_arg_CH); CH_closedScope out_scope; var TR_LHS = new TranslateLHS { preCH_LHS = new adapter_preCH(DummyInstances.TestcasesLHSsingletonTypedCH), scope = scope }; Console.WriteLine("in -> " + LHS_column); Column res = Evaluate.Eval_incomplete_tolerant(" ..intMem1 -> decl1 <- $ARG -> decl2 ", DummyInstances.GE_TestStart, TR_LHS, MM, out out_scope); foreach (var s in ColumnChainPrttS( res, CH => MM.D[CH] ).Reverse()) { Console.WriteLine(s); } }
public override void eval(Context _) { Col_out.AddVal(payload); }