Handling Brackets and Literals.

ID: 247

See: Tokens
				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
// Capture a function call.
// {@Alpha} matches the name.
// '(' and ')' are Bracket tokens that ensure the content is captured correctly.
t.FromTo("{@Alpha:func} ( {args} )", "Call: {func} with {args}");

Console.WriteLine(t.Transform("myfunc('Hello World', (x + y) * 2 )"));
				
			
Call: myfunc with 'Hello World', (x + y) * 2
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   // Capture a function call.
   // {@Alpha} matches the name.
   // '(' and ')' are Bracket tokens that ensure the content is captured correctly.
   t.FromTo("{@Alpha:func} ( {args} )", "Call: {func} with {args}");

   cout << t.Transform("myfunc('Hello World', (x + y) * 2 )") << endl;
}
				
			
Call: myfunc with 'Hello World', (x + y) * 2
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      '// Capture a function call. 
      '// {@Alpha} matches the name. 
      '// '(' and ')' are Bracket tokens that ensure the content is captured correctly.
      t.FromTo("{@Alpha:func} ( {args} )", "Call: {func} with {args}")
      
      Console.WriteLine(t.Transform("myfunc('Hello World', (x + y) * 2 )"))
   End Sub
End Module
				
			
Call: myfunc with 'Hello World', (x + y) * 2