using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
// 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");

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

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

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