private Dat10Synth AssembleSynth() { var outputs = ParseSynthOutputs(); var variables = ParseSynthVariables(); bool error = false; var result = Dat10Synth.Assemble(SynthTextBox.Text, variables, (errorMsg, lineNumber) => error = true); if (error) { return(null); } currentSynth = new Dat10Synth(CurrentFile) { BuffersCount = result.BuffersCount, RegistersCount = result.RegistersCount, StateBlocksCount = result.StateBlocksCount, ConstantsCount = result.Constants.Count, Constants = result.Constants.ToArray(), Bytecode = result.Bytecode, OutputsCount = outputs.Length, OutputsIndices = outputs, VariablesCount = variables.Length, Variables = variables, RuntimeCost = 123 }; return(currentSynth); }
private void SynthTextBox_TextChangedDelayed(object sender, TextChangedEventArgs e) { string errors = ""; SynthTextBox.Range.ClearStyle(ErrorStyle); SynthAssemblySyntaxHighlight(SynthTextBox.Range); var variables = ParseSynthVariables(); Dat10Synth.Assemble(SynthTextBox.Text, variables, (errorMsg, lineNumber) => { errors += $"Line {lineNumber}: {errorMsg}" + Environment.NewLine; var line = SynthTextBox.GetLine(lineNumber - 1); line.ClearStyle(GreenStyle, OrangeRedStyle, BlueStyle, MaroonStyle, RedStyle); line.SetStyle(ErrorStyle); }); StatusLabel.Text = errors; }