#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 source = R"(<data>
  content spans
  multiple lines
</data>)";
      t.FromTo("<data>{body}</data>", "Body: [{body}]");

      cout << "--- Default (Newline is a Separator) ---" << endl;
      // This fails because {body} stops at the first newline
      cout << t.Transform(source).Text() << endl;
      cout << "" << endl;

      cout << "--- Modified (Newline is Whitespace) ---" << endl;
      // Find the newline token and change its type
      auto newlineToken = t.Tokens()["_token_newline"];
      newlineToken.TypeOfToken(TokenType::Whitespace);
      // Now the transform succeeds
      cout << t.Transform(source).Text() << endl;
   }
}