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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // 1. Create a "base" HTML transformer template
   uCalc::Transformer baseHtmlParser;
   baseHtmlParser.Description("Base HTML Parser");
   // Rule to skip over comments
   baseHtmlParser.SkipOver("<!--{body}->");
   // Rule to find any tag
   baseHtmlParser.Pattern("<{tag}>");
   baseHtmlParser.DefaultRuleSet().SetStatementSensitive(false);

   // 2. Create a specialized clone to find only image tags
   auto imageParser = baseHtmlParser.Clone();
   imageParser.Description("Image Tag Finder");
   imageParser.FromTo("<img {attribs} />", "FOUND_IMG_TAG");

   string html = " <body> <img src='a.jpg' /> <!-- <img src='b.jpg' /> --> </body> ";

   // The clone inherits the SkipOver rule from the base, so the commented img tag is ignored.
   cout << imageParser.Transform(html) << endl;

   imageParser.Release();
   baseHtmlParser.Release();
}