public override dynamic Execute(Ast_Scope scope) { var value = Exitcode.Execute(scope); var estr = $"Program terminated at {Token.Line}, {Token.Offset}. Exit code: {value}."; var v = scope.Variables["exitcode"]; if (v == null) { v = new Ast_Variable(null) { Name = "exitcode" }; scope.Variables.Add(v); } v.DoSetValue(estr); return(Ast_Terminate.Halt); }
private static void ShowVarArrayTree(Ast_Variable v, TreeNode tn) { if (v.Value.Type == ValueType.Record) { foreach (var key in v.Value.Value.Keys) { tn.Nodes.Add($"{v.ToString(key)}"); } } else { for (var i = 0; i < v.Value.Value.Count; i++) { tn.Nodes.Add($"{v.ToString(i)}"); } } }