Esempio n. 1
0
    public InteractiveContext(DyaOptions options)
    {
        Options      = options;
        BuildOptions = CreateBuildOptions(options);
        var nofn = options.FileNames is null || options.FileNames.Length == 0 || string.IsNullOrWhiteSpace(options.FileNames[0]);

        var lookup = FileLookup.Create(BuildOptions,
                                       nofn ? Environment.CurrentDirectory ! : Path.GetDirectoryName(options.FileNames ![0]) !, options.Paths);
Esempio n. 2
0
    private static bool Run(DyaOptions options)
    {
        Printer.Header();

        ctx        = new(options);
        dispatcher = new(ctx);

        if (options.Test)
        {
            Printer.LineFeed();
            return(RunTests(options));
        }
        else if (options.Compile)
        {
            Printer.LineFeed();
            return(Compile(options));
        }
        else if (options.GenerateIL)
        {
            Printer.LineFeed();
            return(GenerateIL(options));
        }
        else if (options.FileNames is not null && options.FileNames.Length > 0)
        {
            Printer.LineFeed();
            var i = 0;

            foreach (var f in options.GetFileNames())
            {
                if (i > 0)
                {
                    ctx.Reset();
                }

                if (!ctx.EvalFile(f, options.MeasureTime))
                {
                    return(false);
                }

                i++;
            }

            if (options.StayInInteractive)
            {
                RunInteractive();
            }
            else
            {
                return(true);
            }
        }
Esempio n. 3
0
 public TestRunner(BuilderOptions buildOptions, DyaOptions dyaOptions) =>
 (this.buildOptions, this.dyaOptions, this.stdOut) = (buildOptions, dyaOptions, Console.Out);