Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Write you code");
            Energy e = new Energy();
            e.parse(Console.ReadLine());
            if(e.getRunningStatus() == RunningState.Error){
                ScriptError se = e.getError();
                Console.WriteLine("#Error");
                Console.WriteLine(se.Message);
                Console.WriteLine("On line [" + se.Posision.Line + "] Row [" + se.Posision.Row + "]");
            }

            Console.ReadLine();
        }
Ejemplo n.º 2
0
 private static void showErrro(string name, Energy error)
 {
     isError = true;
     Console.WriteLine("Error in file: " + name);
     if (error.getRunningStatus() != RunningState.Error)
     {
         Console.WriteLine("Unknown end status code: " + error.getRunningStatus().ToString());
         return;
     }
     
     Console.WriteLine("Message: " + error.getError().Message);
     if (error.getError().Posision != null)
     {
         Console.WriteLine("Line: " + error.getError().Posision.Line);
         Console.WriteLine("Row: " + error.getError().Posision.Row);
     }
     isError = true;
 }
Ejemplo n.º 3
0
        private static void doFile(string name)
        {
            string file = File.ReadAllText(name);

            Function print = new Function();
            print.Name = "print";
            print.agument.push("string", "context");
            print.call += Print_call;

            Function useage = new Function();
            useage.Name = "useage";
            useage.call += Useage_call;
             

            for (int i = 1; i <= ticks; i++)
            {
                if (isError)
                    return;
                Energy e = new Energy();
                e.setConfig("file.enabled", "true", false);
                e.setConfig("error.log.file", "tests/log.txt", false);
                e.push(print);
                e.push(useage);
                e.parse(file);
                if(e.getRunningStatus() != RunningState.Normal)
                {
                    showErrro(name, e);
                }
            }
        }