public static void clean( ) { last_label_no = 0; last_temp_no_internal = 0; current_context = null; current_program_unit = null; current_routine_decl = null; // Keep global tree for reporting!! // CONTEXT.enter(TREE.global); }
//----------------------------------------------------------- public static void init( ) { last_label_no = 0; last_temp_no_internal = 0; current_context = null; current_program_unit = null; current_routine_decl = null; string suffix = ""; string output = ""; if (options.Output != null) { output = options.Output.Substring(0); } else if (options.OutputAssembly != null) { output = options.OutputAssembly.Substring(0); } int slash_index = output.LastIndexOf('/'); if (slash_index == -1) { slash_index = output.LastIndexOf('\\'); } int dot_index = output.LastIndexOf('.'); if (dot_index == -1) { dot_index = output.Length; } if (slash_index == -1) { suffix = output.Substring(slash_index + 1, dot_index); } else { suffix = output.Substring(slash_index + 1, dot_index - slash_index + 1); } suffix.Replace("-", "_minus_"); globalMath = new MathGenerator(suffix); _kernelRegistry = new KernelRegistry(); _operationRegistry = new OperationRegistry(); // current_namespace_decl = null; globalTree = null; //-- do not do: it's required afterwards for reporting }
public static void enter(DECLARATION block) { if (current_context != null && current_context != block.enclosing) // System error { ERROR.SystemErrorIn("enter", "attempt to enter to an unrelated scope"); return; } current_context = block; if (block is UNIT_DECL && !(block is NAMESPACE_DECL)) { current_program_unit = (UNIT_DECL)block; current_routine_decl = null; } if (block is ROUTINE_DECL) { current_routine_decl = (ROUTINE_DECL)block; } else if (block is NAMESPACE_DECL) { current_namespace_decl = (NAMESPACE_DECL)block; } }