コード例 #1
0
ファイル: TestHelper.cs プロジェクト: bitsummation/pickaxe
 public static void CompileExpectError(Type errorType, string code, IHttpRequestFactory requestFactory)
 {
     var compiler = new Compiler(code);
     var assembly = compiler.ToAssembly();
     Assert.IsTrue(compiler.Errors.Count == 1);
     Assert.IsTrue(compiler.Errors[0].GetType() == errorType);
 }
コード例 #2
0
ファイル: TestHelper.cs プロジェクト: bitsummation/pickaxe
 public static Runable Compile(string code, IHttpRequestFactory requestFactory)
 {
     var compiler = new Compiler(code);
     var assembly = compiler.ToAssembly();
     Assert.IsTrue(compiler.Errors.Count == 0);
     var runable = new Runable(assembly);
     if(requestFactory != null)
         runable.SetRequestFactory(requestFactory);
     return runable;
 }
コード例 #3
0
        public void Procedure_TestBasic()
        {
            var input = @"

              procedure temp (a string, b string) {

            select *
            from download page 'http://test.com'

            }

            ";

            var compiler = new Compiler(input);
            var sources = compiler.ToCode();
        }
コード例 #4
0
ファイル: EditControl.cs プロジェクト: bitsummation/pickaxe
        private void Compile(string source)
        {
            ThreadContext.Properties[Config.LogKey] = _logValue;
            ThreadedDownloadTable.LogValue = _logValue;

            DoInvoke(new Action(() =>
            {
                messagesTextBox.Clear();
                statusLabel.Text = "Running...";

                //var highlightingStrategy = textEditorControl1.Document.HighlightingStrategy as DefaultHighlightingStrategy;
                //highlightingStrategy.SetColorFor("Selection", _executionHighlight);
            }));

            var compiler = new Compiler(source);
            var generatedAssembly = compiler.ToAssembly();

            if (compiler.Errors.Any())
                ListErrors(compiler.Errors.Select(x => x.Message).ToArray());

            if (!compiler.Errors.Any())
            {
                _runable = new Runable(generatedAssembly);
                _runable.Select += OnSelectResults;
                _runable.Progress += OnProgress;
                _runable.Highlight += OnHighlight;

                try
                {
                    _runable.Run();
                }
                catch (ThreadAbortException)
                {
                    Log.Info("Program aborted");
                }
                catch (Exception e)
                {
                    Log.Fatal("Unexpected Exception", e);
                }
            }

            ProgramFinished();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: bitsummation/pickaxe
        private static void Compile(string[] source, string[] args)
        {
            ConsoleAppender.PlatConsole.StartLine = ConsoleAppender.PlatConsole.CurrentLine + 1;
            ConsoleAppender.PlatConsole.MoveCursor(ConsoleAppender.PlatConsole.StartLine);

            var watch = new Stopwatch();
            watch.Start();

            var compiler = new Compiler(source);
            var generatedAssembly = compiler.ToAssembly();

            if (compiler.Errors.Any())
                ListErrors(compiler.Errors.Select(x => x.Message).ToArray());

            if (!compiler.Errors.Any())
            {
                var runable = new Runable(generatedAssembly, args);
                runable.Select += OnSelectResults;
                runable.Progress += OnProgress;

                try
                {
                    PrintRunning();
                    runable.Run();
                }
                catch (ThreadAbortException)
                {
                    Log.Info("Program aborted");
                }
                catch (Exception e)
                {
                    Log.Fatal("Unexpected Exception", e);
                }
            }

            watch.Stop();
            ConsoleAppender.PlatConsole.Print("");
            ConsoleAppender.PlatConsole.Print(string.Format("Finished in {0} seconds", watch.Elapsed.TotalSeconds));
        }