using uCalcSoftware;

var uc = new uCalc();

static void MyErrorHandler(Handle_uCalc h) {
   var uc = new uCalc(h);
   Console.WriteLine("--- Error Captured ---");
   Console.WriteLine($"Message: {uc.Error.Message}");
   Console.WriteLine($"Symbol: '{uc.Error.Symbol}'");
   Console.WriteLine($"Location: {uc.Error.Location}");
   Console.WriteLine($"Expression: '{uc.Error.Expression}'");
}


uc.Error.AddHandler(MyErrorHandler);

Console.WriteLine("Demonstrating a PARSING error:");
uc.EvalStr("123//456");

Console.WriteLine("");
Console.WriteLine("Demonstrating an EVALUATION error:");
uc.Error.TrapOnDivideByZero = true;
uc.EvalStr("5/0");