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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::Transformer t;
      t.Owned(); // Causes t to be released when it goes out of scope
      auto text = "An apple, an apple pie, and an apple cider.";

      // Rule 1 (Lowest precedence for this anchor)
      t.FromTo("an apple", "[FRUIT]");

      // Rule 2 (Higher precedence)
      t.FromTo("an apple pie", "[DESSERT]");

      // The transformer will match "an apple pie" first because it was defined last.
      // For the remaining "an apple" occurrences, it will fall back to the first rule.
      cout << t.Transform(text) << endl;
   };
}