#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Str("int result = (x + 3) * 2 - (y - 7 / z) * (5 ^ a + 10); /* (x + y) */"); // Capture standard blocks surrounded by parentheses t.Pattern("({expr})"); // Instruct the transformer to ignore any text inside C-style block comments. // This prevents the commented "(x + y)" from being falsely counted as a match. t.SkipOver("/* {etc} */"); // commented text between /* */ is skipped t.Find(); cout << t.Matches().Count() << endl; }