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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();

   // Define a custom string literal using pipe characters `|...|`.
   // The regex `\|([^\|]*)\|` captures the inner content in group 1.
   // We set `subMatchGroup` to 1 to use this group as the token's value.
   auto pipeStringToken = t.Tokens().Add(R"(\|([^\|]*)\|)", TokenType::Literal, "", 1);

   // Complete the definition by setting the data type and QuotedText property.
   pipeStringToken.DataType(uc.DataTypeOf("String"));
   pipeStringToken.IsProperty(ItemIs::QuotedText, true);

   // Define a simple rule to prove the token works.
   t.FromTo("Test: {@String:s}", "Found: {s(0)} | Content: {s(1)}");

   // The transformer now recognizes |...| as a string literal.
   cout << t.Transform("Test: |hello|") << endl;
}