Пример #1
0
        private IEnumerable <string> GetSymbolsAsList(string f)
        {
            var physFile = new PhysicalFile
            {
                Filepath   = f,
                Sourcecode = File.ReadAllText(f)
            };

            var dtu                    = new DafnyTranslationUnit(physFile);
            var dafnyProg              = dtu.Verify().DafnyProgram;
            ISymbolTableGenerator st   = new SymbolTableGenerator(dafnyProg);
            ISymbolInformation    root = st.GenerateSymbolTable();
            ISymbolTableManager   sm   = new SymbolTableManager(root);

            ISymbolNavigator          navigator = new SymbolNavigator();
            List <ISymbolInformation> symbols   = new List <ISymbolInformation>();

            foreach (var modul in root.Children)
            {
                symbols.AddRange(navigator.TopDownAll(modul));
            }

            var actual = symbols.Select(x => x.ToDebugString()).ToList();

            Console.WriteLine("SymboleTable for " + f);
            Console.Write(((SymbolTableManager)sm).CreateDebugReadOut());

            return(actual);
        }
Пример #2
0
 /// <summary>
 /// Sets the SymbolTableManager Property.
 /// Makes use of the dafnyProgram inside the Result property.
 /// </summary>
 private void AddSymbolTable()
 {
     if (Result.TranslationStatus >= TranslationStatus.Resolved && Result.DafnyProgram != null)
     {
         SymbolTableGenerator s        = new SymbolTableGenerator(Result.DafnyProgram);
         ISymbolInformation   rootnode = s.GenerateSymbolTable();
         SymbolTableManager = new SymbolTableManager(rootnode);
     }
 }