Esempio n. 1
0
        private static void Execute(string script)
        {
            var engine = new Motor();

            engine.Instalar(new WebModulo());
            engine.Instalar(new HtmlModulo());

            var modules = RetrieveModules();

            foreach (var module in modules)
                engine.Instalar(module);

            engine.Compilar(script);

            engine.Executar("page", new Infra(HttpContext.Current));
        }
Esempio n. 2
0
        protected Motor CreateEngine(string script, SymbolTable model)
        {
            var engine = new Motor();

            engine.Instalar(new WebModulo());
            engine.Instalar(new HtmlModulo());

            var modules = RetrieveModules();

            foreach (var module in modules)
                engine.Instalar(module);

            engine.Compilar(script);

            if (model != null)
                engine.RuntimeContext.Runnable.ScriptSymbolTable = model;

            return engine;
        }
Esempio n. 3
0
        private static void Run(string filename, string function, string parameters)
        {
            if (!FileExists(filename)) return;

            var engine = new Motor();
            engine.Load(new NPortugol.Npc().CompilarArquivo(filename));

            engine.Instalar(new ConsoleModulo());

            if (string.IsNullOrEmpty(function))
                engine.Executar();
            else
            {
                var list = new List<object>();

                foreach (var parameter in parameters.Split(','))
                {
                    list.Add(parameter.Trim());
                }

                engine.Executar(function, list.ToArray());
            }

            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("----------------------------------------");
            Console.WriteLine(string.Format("{0} executado com sucesso. <ENTER>", filename));
        }