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

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   // StatementSensitive() is set to false so that ";" and newline are not treated as special

   auto t = uc.NewTransformer();
   cout << "StatementSensitive: " << tf(t.DefaultRuleSet().StatementSensitive()) << endl;
   cout << "Setting StatementSensitive to False" << endl;

   t.DefaultRuleSet().StatementSensitive(false); // so that newline does not behave as a statement separator

   cout << "StatementSensitive: " << tf(t.DefaultRuleSet().StatementSensitive()) << endl;
   cout << "" << endl;

   auto Content =
   R"(
<nav aria-label="Main navigation">
  <ul>
    <li><a href="#intro">Intro</a></li>
    <li><a href="#examples">Examples</a></li>
    <!-- <li><a href="#contact">Contact</a></li> -->
  </ul>
</nav>

<!-- 
<h2>Ingredients</h2>
<ul>
  <li>3 cups flour</li>
  <li>1.5 cups water</li>
  <li>1 tsp salt</li>
</ul>
-->

<nav aria-label="Chapter navigation">
    <ul>
      <li><a href="#one">One</a></li>
      <li><a href="#two">Two</a></li>
      <li><a href="#three">Three</a></li>
    </ul>
</nav>
)";

   t.Str(Content);
   auto Pattern = t.Pattern("<li>{item}</li>");
   t.Find();
   cout << t.Matches().Text() << endl;
   cout << "" << endl;

   cout << "<!-- Skip over commented lines -->" << endl;
   cout << "----------------------------------" << endl;
   t.SkipOver("<!-- {comment} -->");
   t.Find();
   cout << t.Matches().Text() << endl;
   cout << "" << endl;

}