#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   // Rule 1: Replace 'A' with 'B'. Rewind is off by default.
   t.FromTo("A", "B");
   // Rule 2: Replace 'B' with 'C'.
   t.FromTo("B", "C");

   cout << "--- Rewind Disabled ---" << endl;
   // The 'A' becomes 'B', but the scan continues *after* the 'B', so rule 2 is not triggered.
   cout << t.Transform("Start A End") << endl;
   t.Reset();

   // Now, enable rewind on the first rule.
   t.FromTo("A", "B").RewindOnChange(true);
   t.FromTo("B", "C");

   cout << "" << endl;
   cout << "--- Rewind Enabled ---" << endl;
   // The 'A' becomes 'B', rewind occurs, the 'B' is re-scanned and becomes 'C'.
   cout << t.Transform("Start A End") << endl;
}