示例#1
0
 public override void EnterCobolProgram(ProgramClassParser.CobolProgramContext context)
 {
     if (Program == null) {
         Program = new SourceProgram(TableOfGlobals);
         programsStack = new Stack<CodeModel.Program>();
         CurrentProgram = Program;
     } else {
         var enclosing = CurrentProgram;
         CurrentProgram = new NestedProgram(enclosing);
         Enter(CurrentProgram.SyntaxTree.Root, context, new SymbolTable(TableOfGlobals));
     }
     var pgm = context.programAttributes();
     if (pgm != null) CurrentProgram.Identification = (ProgramIdentification)pgm.ProgramIdentification().Symbol;
     Enter(new Nodes.Program(CurrentProgram.Identification), pgm, CurrentProgram.SymbolTable);
     if (pgm != null && pgm.LibraryCopy() != null) { // TCRFUN_LIBRARY_COPY
         var cnode = new Nodes.LibraryCopy((LibraryCopyCodeElement)pgm.LibraryCopy().Symbol);
         Enter(cnode, pgm, CurrentProgram.SymbolTable);
         Exit();
     }
 }