コード例 #1
0
        /// <summary>Generates code</summary>
        /// <param name="tree">Root of a syntax tree</param>
        /// <param name="table">Table of symbols</param>
        /// <param name="columns">Columns layout</param>
        public void Generate(TypeCobol.Compiler.Nodes.Root tree, TypeCobol.Compiler.CodeModel.SymbolTable table, TypeCobol.Compiler.Text.ColumnsLayout columns = TypeCobol.Compiler.Text.ColumnsLayout.FreeTextFormat)
        {
            // STEP 0: Initialize the global values.
            RootNode = tree;
            SymTable = table;
            Layout   = columns;
            //Create the Initial target document.
            CreateTargetDocument();
            // STEP 1: modify tree to adapt it to destination language
            // 1.1 Run the Qualifier action on this node
            Qualifier qualifier = new Qualifier(this, tree);

            qualifier.Execute();
            // 1.2 Perform other actions
            Actions.Perform(tree);
            // STEP 2: convert tree to destination language code
            TreeToCode();
        }
コード例 #2
0
 /// <summary>
 /// Use a pre-existing text document, already initialized from a Cobol file
 /// </summary>
 public FileCompiler(string libraryName, string fileName, SourceFileProvider sourceFileProvider, IProcessedTokensDocumentProvider documentProvider, ColumnsLayout columnsLayout, TypeCobolOptions compilerOptions, CodeModel.SymbolTable customSymbols, bool isCopyFile, MultilineScanState scanState, CompilationProject compilationProject, List <RemarksDirective.TextNameVariation> copyTextNameVariations) :
     this(libraryName, fileName, null, sourceFileProvider, documentProvider, columnsLayout, null, compilerOptions, customSymbols, isCopyFile, scanState, compilationProject, copyTextNameVariations)
 {
 }
コード例 #3
0
 /// <summary>
 /// Load a Cobol source file in memory
 /// </summary>
 public FileCompiler(string libraryName, string fileName, SourceFileProvider sourceFileProvider, IProcessedTokensDocumentProvider documentProvider, ColumnsLayout columnsLayout, TypeCobolOptions compilerOptions, CodeModel.SymbolTable customSymbols, bool isCopyFile, CompilationProject compilationProject) :
     this(libraryName, fileName, null, sourceFileProvider, documentProvider, columnsLayout, null, compilerOptions, customSymbols, isCopyFile, null, compilationProject, null)
 {
 }
コード例 #4
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <Program> > GetProgramsTable(SymbolTable symbolTable)
 {
     return(symbolTable.Programs);
 }
コード例 #5
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <FunctionDeclaration> > GetFunctionTable(SymbolTable symbolTable)
 {
     return(symbolTable.Functions);
 }
コード例 #6
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <TypeDefinition> > GetTypeTable(SymbolTable symbolTable)
 {
     return(symbolTable.Types);
 }
コード例 #7
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <Paragraph> > GetParagraphTable(SymbolTable symbolTable)
 {
     return(symbolTable.Paragraphs);
 }
コード例 #8
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <Section> > GetSectionTable(SymbolTable symbolTable)
 {
     return(symbolTable.Sections);
 }
コード例 #9
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
        private List <T> GetFromTableAndEnclosing <T>(string head,
                                                      Func <SymbolTable, IDictionary <string, List <T> > > getTableFunction, SymbolTable symbolTable = null) where T : Node
        {
            symbolTable = symbolTable ?? this;
            var table  = getTableFunction.Invoke(symbolTable);
            var values = GetFromTable(head, table);

            if (EnclosingScope != null)
            {
                values.AddRange(EnclosingScope.GetFromTableAndEnclosing(head, getTableFunction));
            }
            return(values);
        }
コード例 #10
0
ファイル: SymbolTable.cs プロジェクト: jdrew1303/TypeCobol
 private IDictionary <string, List <DataDefinition> > GetDataDefinitionTable(SymbolTable symbolTable)
 {
     return(symbolTable.DataEntries);
 }
コード例 #11
0
 public SourceProgram(SymbolTable EnclosingScope, CodeElement codeElement) : base(codeElement)
 {
     IsNested    = false;
     SymbolTable = new SymbolTable(EnclosingScope);
     SyntaxTree.Root.SymbolTable = SymbolTable;
 }