Nested grouping for complex commands.
ID: 243
See: Nested Patterns
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
// Pattern: "Set" followed by (Color OR (Size followed by Big/Small))
t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}");
Console.WriteLine(t.Transform("Set Color"));
Console.WriteLine(t.Transform("Set Size Big"));
Console.WriteLine(t.Transform("Set Size Small"));
Property: Color
Property: Size Big
Property: Size Small using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); // Pattern: "Set" followed by (Color OR (Size followed by Big/Small)) t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}"); Console.WriteLine(t.Transform("Set Color")); Console.WriteLine(t.Transform("Set Size Big")); Console.WriteLine(t.Transform("Set Size Small"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
// Pattern: "Set" followed by (Color OR (Size followed by Big/Small))
t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}");
cout << t.Transform("Set Color") << endl;
cout << t.Transform("Set Size Big") << endl;
cout << t.Transform("Set Size Small") << endl;
}
Property: Color
Property: Size Big
Property: Size Small #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); // Pattern: "Set" followed by (Color OR (Size followed by Big/Small)) t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}"); cout << t.Transform("Set Color") << endl; cout << t.Transform("Set Size Big") << endl; cout << t.Transform("Set Size Small") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
'// Pattern: "Set" followed by (Color OR (Size followed by Big/Small))
t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}")
Console.WriteLine(t.Transform("Set Color"))
Console.WriteLine(t.Transform("Set Size Big"))
Console.WriteLine(t.Transform("Set Size Small"))
End Sub
End Module
Property: Color
Property: Size Big
Property: Size Small Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() '// Pattern: "Set" followed by (Color OR (Size followed by Big/Small)) t.FromTo("Set {prop: Color | Size { Big | Small } }", "Property: {prop}") Console.WriteLine(t.Transform("Set Color")) Console.WriteLine(t.Transform("Set Size Big")) Console.WriteLine(t.Transform("Set Size Small")) End Sub End Module