private bool ToggleLabelMode() { bool labelMode = !m_LabelMode; MainForm.m_CompileResult.ClearMessages(); Parser.BasicFileParser parser = new C64Studio.Parser.BasicFileParser(DocumentInfo.FullPath); parser.LabelMode = m_LabelMode; if (!parser.Parse(editSource.Text, null, C64Studio.Types.AssemblerType.AUTO)) { MainForm.m_CompileResult.UpdateFromMessages(parser, DocumentInfo.Project); MainForm.m_CompileResult.Show(); btnToggleLabelMode.Checked = false; return(false); } string result; if (labelMode) { result = parser.EncodeToLabels(); } else { result = parser.DecodeFromLabels(); } if (parser.Errors > 0) { MainForm.m_CompileResult.UpdateFromMessages(parser, DocumentInfo.Project); MainForm.m_CompileResult.Show(); return(false); } editSource.Text = result; m_LabelMode = labelMode; return(true); }
private C64Studio.Parser.BasicFileParser CreateParser(C64Studio.Parser.BasicFileParser.BasicVersion Version) { var parser = new C64Studio.Parser.BasicFileParser(new C64Studio.Parser.BasicFileParser.ParserSettings()); parser.SetBasicVersion(Version); return(parser); }
private C64Studio.Parser.BasicFileParser CreateParser(string BASICDialectName) { var parser = new C64Studio.Parser.BasicFileParser(new C64Studio.Parser.BasicFileParser.ParserSettings()); parser.Settings.StripSpaces = false; parser.Settings.StripREM = false; parser.SetBasicDialect(ReadDialectFromFile("BASIC Dialects/" + BASICDialectName + ".txt")); return(parser); }
private GR.Memory.ByteBuffer TestCompile(string Source) { C64Studio.Parser.BasicFileParser parser = new C64Studio.Parser.BasicFileParser(); C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig(); config.OutputFile = "test.prg"; config.TargetType = C64Studio.Types.CompileTargetType.PRG; config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO; Assert.IsTrue(parser.Parse(Source, null, config)); Assert.IsTrue(parser.Assemble(config)); return(parser.AssembledOutput.Assembly); }
public void TestRenumberWithSpaces() { string source = @"20 ifa=1then 20"; C64Studio.Parser.BasicFileParser parser = new C64Studio.Parser.BasicFileParser(); C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig(); config.OutputFile = "test.prg"; config.TargetType = C64Studio.Types.CompileTargetType.PRG; config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO; Assert.IsTrue(parser.Parse(source, null, config)); string result = parser.Renumber(10, 3); Assert.AreEqual("10IFA=1THEN10", result); }
public void TestRenumberOverLines() { string source = @"10 goto 300 300 goto 10"; C64Studio.Parser.BasicFileParser parser = new C64Studio.Parser.BasicFileParser(); C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig(); config.OutputFile = "test.prg"; config.TargetType = C64Studio.Types.CompileTargetType.PRG; config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO; Assert.IsTrue(parser.Parse(source, null, config)); string result = parser.Renumber(10, 3); Assert.AreEqual(@"10GOTO13 13GOTO10", result); }
public void TestRenumberOnGosub() { string source = @"10 onxgosub100,400,700 100printa 400 printb 700 printc"; C64Studio.Parser.BasicFileParser parser = new C64Studio.Parser.BasicFileParser(); C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig(); config.OutputFile = "test.prg"; config.TargetType = C64Studio.Types.CompileTargetType.PRG; config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO; Assert.IsTrue(parser.Parse(source, null, config)); string result = parser.Renumber(10, 3); Assert.AreEqual(@"10ONXGOSUB13,16,19 13PRINTA 16PRINTB 19PRINTC", result); }
private C64Studio.Parser.BasicFileParser CreateParser(string BASICDialectName) { var parser = new C64Studio.Parser.BasicFileParser(new C64Studio.Parser.BasicFileParser.ParserSettings()); parser.Settings.StripSpaces = false; parser.Settings.StripREM = false; if (BASICDialectName == "BASIC V2") { parser.SetBasicDialect(Dialect.BASICV2); } else { string error; var dialect = Dialect.ReadBASICDialect("BASIC Dialects/" + BASICDialectName + ".txt", out error); if (dialect == null) { Assert.Fail(error); } parser.SetBasicDialect(dialect); } return(parser); }