uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
{@CloseBracket}
Product:
Class:
Remarks
Description: A category matcher that identifies any token defined as a closing delimiter (e.g., ), ], }, or custom patterns like > or end).
The {@CloseBracket} directive identifies the termination point of a scope or grouping. Like its counterpart {@Bracket}, it operates on token categories rather than character literals.
Category-Based Matching
By default, uCalc recognizes ), ], and } as closing brackets. However, because this matcher queries the engine's token definitions:
- Custom Keywords: If the token
endis defined as a closing bracket,{@CloseBracket}will successfully match it. - Configurability: Users can add tokens like
>or custom delimiters to the Closing Bracket category usinguCalc.Tokens.Add(Topic 373).
Inverse Matching with !
The inversion operator ! can be applied to this category:
{@CloseBracket}: Matches any token that is a closing bracket.{!CloseBracket}: Matches any token that is not a closing bracket.
This is particularly useful for patterns that need to "consume" all content inside a block until the final delimiter is reached.
Examples
Matching by token type
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@Newline}", "");
var s = """
This is 55.2*6 "Hello world";
'Single quote'(parenth)
""";
Console.WriteLine(t.Filter(s).Matches.Text);
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>"); t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>"); t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>"); t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>"); t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>"); t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>"); t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>"); t.FromTo("{@Reducible:r}", "<Reducible={r}>"); t.FromTo("{@Newline}", "<New line{@Newline}>"); var s = """ This is 55.2*6 "Hello world"; 'Single quote'(parenth) """; Console.WriteLine(t.Filter(s).Matches.Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@Newline}", "");
auto s = R"(This is 55.2*6 "Hello world";
'Single quote'(parenth))";
cout << t.Filter(s).Matches().Text() << endl;
}
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>"); t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>"); t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>"); t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>"); t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>"); t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>"); t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>"); t.FromTo("{@Reducible:r}", "<Reducible={r}>"); t.FromTo("{@Newline}", "<New line{@Newline}>"); auto s = R"(This is 55.2*6 "Hello world"; 'Single quote'(parenth))"; cout << t.Filter(s).Matches().Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("{@String:txt}", "<>")
t.FromTo("{@Number:MyNum}", "")
t.FromTo("{@Bracket:MyBrack}", "")
t.FromTo("{@CloseBracket:CloseBr}", "")
t.FromTo("{@StatementSeparator:Sep}", "")
t.FromTo("{@Alphanumeric:alpha}", "")
t.FromTo("{@Whitespace:ws}", "")
t.FromTo("{@Reducible:r}", "")
t.FromTo("{@Newline}", "")
Dim s = "This is 55.2*6 ""Hello world"";
'Single quote'(parenth)"
Console.WriteLine(t.Filter(s).Matches.Text)
End Sub
End Module
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>") t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>") t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>") t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>") t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>") t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>") t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>") t.FromTo("{@Reducible:r}", "<Reducible={r}>") t.FromTo("{@Newline}", "<New line{@Newline}>") Dim s = "This is 55.2*6 ""Hello world""; 'Single quote'(parenth)" Console.WriteLine(t.Filter(s).Matches.Text) End Sub End Module
(Default Matching) Identifying the end of any default bracket type and normalizing it to a standard closing parenthesis.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@CloseBracket}", ")");
Console.WriteLine(t.Transform("func( x ] }"));
func( x ) ) using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@CloseBracket}", ")"); Console.WriteLine(t.Transform("func( x ] }"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@CloseBracket}", ")");
cout << t.Transform("func( x ] }") << endl;
}
func( x ) ) #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@CloseBracket}", ")"); cout << t.Transform("func( x ] }") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("{@CloseBracket}", ")")
Console.WriteLine(t.Transform("func( x ] }"))
End Sub
End Module
func( x ) ) Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@CloseBracket}", ")") Console.WriteLine(t.Transform("func( x ] }")) End Sub End Module