Beispiel #1
0
        public bool start(string[] arrayOfStringsFromCommandLine)
        {
            //Console.WriteLine(arrayOfStringsFromCommandLine[1]);
            if (arrayOfStringsFromCommandLine.GetLength(0) == 0)
            {
                return(false);
            }

            try
            {
                if (!File.Exists(arrayOfStringsFromCommandLine[0]))
                {
                    Console.WriteLine("File not found");
                    return(true);
                }

                SIL_Program program = SIL_IO.Load(arrayOfStringsFromCommandLine[0]);

                Console.WriteLine("Loaded Program: " + arrayOfStringsFromCommandLine[0]);
                // program.Name += "\n\r" + program.Text;
                // program.Text = program.Name;
                // SymbolTable.Initialize();
                program.Parse();
                program.Execute();
            }

            catch (FileNotFoundException ex)
            {
                // Write error.
                Console.WriteLine("File not Found");
                return(true);
            }

            catch (Exception e)
            {
                string[] err = e.Message.Split('%');
                for (int i = 0; i < err.Length - 1; ++i)
                {
                    Console.WriteLine(err[i]);
                }
                Console.WriteLine("LineNumber:" + err[err.Length - 1]);
            }

            return(true);
        }
Beispiel #2
0
 public void ExecuteProgram(SIL_Program program, frmErrList errList)
 {
     this.Text = "Output - " + program.Name;
     try
     {
         program.Parse();
         program.Execute();
     }
     catch (Exception e)
     {
         string[] err = e.Message.Split('%');
         if (err.Length > 1)
         {
             errList.AddError(err[0], int.Parse(err[1]));
         }
         else
         {
             errList.AddError(err[0], 0);
         }
     }
 }