コード例 #1
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         string[] datos = Archivos.AbrirArchivo();
         if (datos != null)
         {
             richTextBox1.Lines = datos;
         }
     }
     catch { }
 }
コード例 #2
0
 private void toolopen_Click(object sender, EventArgs e)
 {
     try
     {
         string[] datos = Archivos.AbrirArchivo();
         if (datos != null)
         {
             richTextBox1.Lines = datos;
             LectorSintactico   = new LectorSintaxis("chumpe.syntax");
             this.CrearSintaxisColorAllText(richTextBox1.Text);
         }
     }
     catch { }
 }
コード例 #3
0
 private void toolguardar_Click(object sender, EventArgs e)
 {
     GetCodigoEscrito();
     Archivos.Guardar(CodigoEscrito);
 }
コード例 #4
0
        private void ANALIZAR_COMPILAR()
        {
            Compilador          compilador      = new Compilador();
            AnalizadorSemantico semantico       = new AnalizadorSemantico();
            List <string>       CodigoComputado = new List <string>();

            System.IO.Stream str         = Properties.Resources.chumsound;
            SoundPlayer      ChumpeSound = new SoundPlayer(str);

            ChumpeSound.Load();
            toolErrorSintaxis.Text = "";
            try
            {
                toolProgreso.Increment(20);
                toolnotificaciones.Text = "Analizando codigo... (20%)";
                List <string> Codigo = new List <string>();
                Codigo.AddRange(richTextBox1.Lines);
                semantico.SetCodigoAnalizar(Codigo);
                semantico.Computar(out CodigoComputado);
                toolProgreso.Increment(30);
                List <string> Errores = semantico.MostrarErrores();
                if (Errores.Count != 0)
                {
                    ChumpeSound.Play();
                    toolErrorSintaxis.Text          = "Error al compilar... ";
                    FormMostrarErrores.ListaErrores = Errores;
                    FormMostrarErrores FrmError = new FormMostrarErrores();
                    FrmError.Show();
                    toolnotificaciones.Text = "sin notificaciones...";
                    toolProgreso.Increment(100);
                    return;
                }
                string direccion = Archivos.Direccion;
                if (direccion == null || direccion == "")
                {
                    GetCodigoEscrito();
                    Archivos.Guardar(CodigoEscrito);
                    direccion = Archivos.Direccion;
                }

                string[] trozo_direccion = direccion.Split(new string[] { "\\", ".chumpe" }, StringSplitOptions.RemoveEmptyEntries);
                string   nombre          = trozo_direccion[trozo_direccion.Length - 1];
                if (nombre == "" || string.IsNullOrEmpty(nombre))
                {
                    nombre = "Chompipe";
                }
                toolnotificaciones.Text = "Compilando... (60%)";
                toolProgreso.Increment(60);

                var           d         = compilador.CheckCodigoAcompilar(CodigoComputado);
                var           k         = compilador.GenerarCodigoCsharp(d, "__IL_SISTEMA_INT");
                List <string> ILerr     = new List <string>();
                bool          compilado = compilador.CompilarCodigo(k, nombre + ".exe", out ILerr);

                if (compilado)
                {
                    Process          p   = new Process();
                    ProcessStartInfo psi = new ProcessStartInfo(System.IO.Directory.GetCurrentDirectory() + @"\" + nombre + ".exe");
                    p.StartInfo = psi;
                    p.Start();
                    toolErrorSintaxis.Text  = "UN CHUMPE SE HA COMPILADO... ";
                    toolnotificaciones.Text = "sin notificaciones...";
                }
                else
                {
                    if (ILerr.Count >= 1)
                    {
                        FormMostrarErrores.ListaErrores = ILerr;
                        FormMostrarErrores FrmError = new FormMostrarErrores();
                        FrmError.Show();
                    }
                    ChumpeSound.Play();
                    toolErrorSintaxis.Text = "Compilacion exitosa pero con error en IL";
                }
                toolProgreso.Increment(100);
            }
            catch (Exception ex)
            {
                ChumpeSound.Play();
                toolProgreso.Increment(0);
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     GetCodigoEscrito();
     Archivos.Guardar(CodigoEscrito);
     Application.Exit();
 }
コード例 #6
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GetCodigoEscrito();
     Archivos.Guardar(CodigoEscrito);
 }