static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: FunctionalTester <filename>");
                return;
            }

            IParseTree root = null;

            using (var fileStream = new StreamReader(args[0]))
            {
                var inputStream = new AntlrInputStream(fileStream);
                var lexer       = new TesterLexer(inputStream);
                var tokens      = new CommonTokenStream(lexer);
                var parser      = new TesterParser(tokens);

                root = parser.prog();
            }

            /* var printer = new PrintVisitor();
             * Console.WriteLine(printer.Visit(root)); */

            var authManager = new SshAuthManager();

            authManager.SetUserPrompt(GetUser);
            authManager.SetPasswordPrompt(GetPassword);
            authManager.SetRepeatPrompt(GetRepeat);
            authManager.SetCachePrompt(GetCache);

            var translator = new TranslateVisitor(authManager);

            translator.Visit(root);

            Run(translator.Functions, translator.BaseEnvironment);
        }
Exemple #2
0
 public TranslateVisitor(SshAuthManager authManager)
 {
     m_authManager   = authManager;
     m_core          = new Dictionary <string, InterpBase>();
     BaseEnvironment = new InterpEnvironment();
 }