public void DeclareVariableInSubscopes() { Tokenizer t = new Tokenizer(s_errorHandler, true); Parser p = new Parser(t.process(File.OpenText("code16.txt")), s_errorHandler); p.process(); ScopeBuilder scopeBuilder = new ScopeBuilder(p.getAST(), s_errorHandler); scopeBuilder.process(); }
public void DeclareAndReferenceFunctionsAndVariables() { Tokenizer t = new Tokenizer(s_errorHandler, true); Parser p = new Parser(t.process(File.OpenText("code13.txt")), s_errorHandler); p.process(); ScopeBuilder scopeBuilder = new ScopeBuilder(p.getAST(), s_errorHandler); scopeBuilder.process(); }
public void DefineVariableFromCode() { Tokenizer t = new Tokenizer(s_errorHandler, true); Parser p = new Parser(t.process(File.OpenText("code11.txt")), s_errorHandler); p.process(); ScopeBuilder scopeBuilder = new ScopeBuilder(p.getAST(), s_errorHandler); scopeBuilder.process(); Scope globalScope = scopeBuilder.getGlobalScope(); Assert.IsNotNull(globalScope.resolve("x")); }
public void ForgettingEndStatement() { Tokenizer t = new Tokenizer(s_errorHandler, true); ErrorHandler e = new ErrorHandler(); Parser p = new Parser(t.process(File.OpenText("code68.txt")), e); p.process(); ScopeBuilder scopeBuilder = new ScopeBuilder(p.getAST(), e); scopeBuilder.process(); e.printErrorsToConsole(); Assert.AreEqual(1, e.getErrors().Count); }
public void Should_Initialize() { _ = new ScopeBuilder(); }
/// <summary> /// /// </summary> public Application(CurrentMappings mappings) { this.sb = new ScopeBuilder(mappings); }
public void Run(ICoreApplication application, IServicesProvider servicesProvider = null) { FormsApplication.SetHighDpiMode(HighDpiMode.SystemAware); FormsApplication.SetCompatibleTextRenderingDefault(false); Sequence.CreateSequenceFunc = SequenceImpl.Create; Sequence.NextFrameSequence = SequenceImpl.Create(0, 0, null, null); dispatcher.DispatcherThread = Thread.CurrentThread; using (var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero)) { UiUnit.PixelsPerUnit = graphics.DpiX / 96f; } var scopeBuilder = new ScopeBuilder(servicesProvider); scopeBuilder.WithSkia() .WithInstance(gamePads).As <IGamePads>() .WithInstance(keyboard).As <IKeyboard>() .WithType <UiInput>().As <IUiInput>().AsSingleton() .WithCrossTypes() .WithInstance(dispatcher).As <ISystemDispatcher>().As <IDispatcher>() .WithInstance(sequencer).As <ISequencer>() .WithType <SelectFileServiceWinForms>().As <ISelectFileService>().AsSingleton(); var services = scopeBuilder.Build(); application.AfterInitServices += (s, b) => { b.WithType <WindowServiceWinForms>().AsSelf().As <IWindowsService>().AsSingleton() .WithType <AppColorTable>().AsSelf().AsSingleton(); }; services = application.Initialize(services); application.Load(); var windowsService = services.GetService <WindowServiceWinForms>(); var stopwatch = new Stopwatch(); stopwatch.Start(); TimeSpan lastUpdateTimeSpan = stopwatch.Elapsed; while (windowsService.MainWindow != null) { TimeSpan currentTimeSpan = stopwatch.Elapsed; TimeSpan timeDelta = currentTimeSpan - lastUpdateTimeSpan; lastUpdateTimeSpan = currentTimeSpan; gamePads.Update(); keyboard.Update(); dispatcher.Process(); sequencer.Update(timeDelta); for (var idx = 0; idx < windowsService.Windows.Count; ++idx) { var hostWindow = windowsService.Windows[idx]; hostWindow.Window.Update((float)timeDelta.TotalSeconds); if (hostWindow.Window.IsDirty) { hostWindow.Redraw(); } } FormsApplication.DoEvents(); Thread.Sleep(1); } foreach (var wnd in windowsService.Windows) { wnd.Window.Close(); } }