#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); // This creates a simpler (not very useful) set of tokens for sake of example auto MyTokens = t.Tokens(); MyTokens.Clear(); // removes the default list of tokens MyTokens.Add("."); // Should always have a fallback token like this one MyTokens.Add(";", TokenType::StatementSep); MyTokens.Add("<", TokenType::Generic, ">"); MyTokens.Add("[0-9]+", TokenType::Literal); MyTokens.Add(" +", TokenType::Whitespace); MyTokens.Add("[a-z]+", TokenType::AlphaNumeric); t.FromTo("{ This | That} {etc}", "[{@Self}]"); // {etc} stops at the semicolon ";" TokenType.StatementSep cout << t.Transform("This is a test; That < 123.456; abc >; ABC") << endl; cout << "" << endl; uCalc::Transformer OtherTransform(uc); // This is an alternative way of constructing a new transformer OtherTransform.Tokens().Add(MyTokens); // Imports the entire token list from the other transformer OtherTransform.Pattern("{word:1}"); cout << OtherTransform.Filter("This is a test; That < 123.456; abc >; ABC").Matches().Text() << endl; }