Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        //-----------------------------------------------------------

        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
        }
Exemplo n.º 3
0
        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;
            }
        }