#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call MyErrorHandler(Handle_uCalc h) { auto uc = uCalc(h); cout << "--- Error Captured ---" << endl; cout << "Message: " << uc.Error().Message() << endl; cout << "Symbol: '" << uc.Error().Symbol() << "'" << endl; cout << "Location: " << uc.Error().Location() << endl; cout << "Expression: '" << uc.Error().Expression() << "'" << endl; } int main() { uCalc uc; uc.Error().AddHandler(MyErrorHandler); cout << "Demonstrating a PARSING error:" << endl; uc.EvalStr("123//456"); cout << "" << endl; cout << "Demonstrating an EVALUATION error:" << endl; uc.Error().TrapOnDivideByZero(true); uc.EvalStr("5/0"); }