Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a <c>DafnyTranslationUnit</c> and calls the verification process for the physical file of this instance.
        /// Afterwards, the updated content gets verified.
        /// </summary>
        private void GenerateTranslationResult()
        {
            if (PhysicalFile == null)
            {
                throw new InvalidOperationException(Resources.ExceptionMessages.file_repo_must_have_physical);
            }

            DafnyTranslationUnit translationUnit = new DafnyTranslationUnit(PhysicalFile);

            Result = translationUnit.Verify();
        }