#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t1 = uc.NewTransformer(); auto CommentRegex = R"(/\*([\s\S]*?)\*/)"; auto WhitespaceToken = t1.Tokens().Add(CommentRegex, TokenType::Whitespace); WhitespaceToken.Description("Treats text between /* and */ as whitespace"); auto txt = "a b, a /* comment a b */ b, a x b, ab, a b, a, b"; auto t2 = uc.NewTransformer(); t2.FromTo("a b", "<{@Self}>"); t2.Transform(txt); cout << t2 << endl; // The token defined in the other transformer (WhitespaceToken) is imported into this one. // Now, everything between /* and */ will be treated as whitespace t2.Tokens().Add(WhitespaceToken); cout << t2.Transform(txt) << endl; }