示例#1
0
        public virtual void StartCobolProgram(ProgramIdentification programIdentification, LibraryCopyCodeElement libraryCopy)
        {
            if (Program == null)
            {
                if (SyntaxTree.Root.MainProgram == null)
                {
                    SyntaxTree.Root.MainProgram = new SourceProgram(TableOfGlobals, programIdentification);
                    Program = SyntaxTree.Root.MainProgram;
                }
                else
                {
                    Program = new StackedProgram(TableOfGlobals, programIdentification);
                }

                programsStack  = new Stack <Program>();
                CurrentProgram = Program;
                Enter(CurrentProgram, programIdentification, CurrentProgram.SymbolTable);
            }
            else
            {
                var enclosing = CurrentProgram;
                CurrentProgram = new NestedProgram(enclosing, programIdentification);
                Enter(CurrentProgram, programIdentification, CurrentProgram.SymbolTable);
            }

            if (libraryCopy != null)
            { // TCRFUN_LIBRARY_COPY
                var cnode = new LibraryCopy(libraryCopy);
                Enter(cnode, libraryCopy, CurrentProgram.SymbolTable);
                Exit();
            }

            TableOfNamespaces.AddProgram(CurrentProgram); //Add Program to Namespace table.
        }
    public static void Main()
    {
        ITest         nestedProgram = new NestedProgram();
        AnyOtherClass otherClass    = new AnyOtherClass();

        otherClass.AnyMethod(nestedProgram);
    }