Defining a token bracket pair
ID: 165
using uCalcSoftware;
var uc = new uCalc();
// Here we define < and > as a bracket pair.
// Such pairs can be part of a pattern match
// and a match can be found within a bracket pair
// but a match will not cross boundaries with one
// part of the match out and another part inside
var t = uc.NewTransformer();
var txt = "a < b c > c, < a > b c, < a b c >";
t.Tokens.Add("<", TokenType.Generic, ">");
t.FromTo("a {etc} c", "((a {etc} c))");
Console.WriteLine(txt);
Console.WriteLine(t.Transform(txt));
a < b c > c, < a > b c, < a b c >
((a < b c > c)), < a > b c, < ((a b c)) > using uCalcSoftware; var uc = new uCalc(); // Here we define < and > as a bracket pair. // Such pairs can be part of a pattern match // and a match can be found within a bracket pair // but a match will not cross boundaries with one // part of the match out and another part inside var t = uc.NewTransformer(); var txt = "a < b c > c, < a > b c, < a b c >"; t.Tokens.Add("<", TokenType.Generic, ">"); t.FromTo("a {etc} c", "((a {etc} c))"); Console.WriteLine(txt); Console.WriteLine(t.Transform(txt));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// Here we define < and > as a bracket pair.
// Such pairs can be part of a pattern match
// and a match can be found within a bracket pair
// but a match will not cross boundaries with one
// part of the match out and another part inside
auto t = uc.NewTransformer();
auto txt = "a < b c > c, < a > b c, < a b c >";
t.Tokens().Add("<", TokenType::Generic, ">");
t.FromTo("a {etc} c", "((a {etc} c))");
cout << txt << endl;
cout << t.Transform(txt) << endl;
}
a < b c > c, < a > b c, < a b c >
((a < b c > c)), < a > b c, < ((a b c)) > #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Here we define < and > as a bracket pair. // Such pairs can be part of a pattern match // and a match can be found within a bracket pair // but a match will not cross boundaries with one // part of the match out and another part inside auto t = uc.NewTransformer(); auto txt = "a < b c > c, < a > b c, < a b c >"; t.Tokens().Add("<", TokenType::Generic, ">"); t.FromTo("a {etc} c", "((a {etc} c))"); cout << txt << endl; cout << t.Transform(txt) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// Here we define < and > as a bracket pair.
'// Such pairs can be part of a pattern match
'// and a match can be found within a bracket pair
'// but a match will not cross boundaries with one
'// part of the match out and another part inside
Dim t = uc.NewTransformer()
Dim txt = "a < b c > c, < a > b c, < a b c >"
t.Tokens.Add("<", TokenType.Generic, ">")
t.FromTo("a {etc} c", "((a {etc} c))")
Console.WriteLine(txt)
Console.WriteLine(t.Transform(txt))
End Sub
End Module
a < b c > c, < a > b c, < a b c >
((a < b c > c)), < a > b c, < ((a b c)) > Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// Here we define < and > as a bracket pair. '// Such pairs can be part of a pattern match '// and a match can be found within a bracket pair '// but a match will not cross boundaries with one '// part of the match out and another part inside Dim t = uc.NewTransformer() Dim txt = "a < b c > c, < a > b c, < a b c >" t.Tokens.Add("<", TokenType.Generic, ">") t.FromTo("a {etc} c", "((a {etc} c))") Console.WriteLine(txt) Console.WriteLine(t.Transform(txt)) End Sub End Module