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.
{@StatementSeparator}
Product:Â
Class:Â
Remarks
Description: A structural category matcher that identifies any token defined as a terminator or separator between distinct logic statements (e.g., ; or a newline).
The {@StatementSeparator} directive (shorthand {@Sep}) is used within a uCalc::Transformer to identify the boundaries of a statement. In many programming and data-formatting languages, statements must be separated to prevent ambiguity.
By targeting the category of a separator rather than a specific character, uCalc allows you to write transformation rules that are portable across different syntax styles.
Supported Separators
By default, the engine typically recognizes:
- Semicolons:
;(The standard explicit separator). - Newlines:
\nor\r\n(use uCalc.ItemOf("_Token_Newline").Release() to remove newline as a separator).
Why use {@StatementSeparator}?
Using this directive instead of a literal ; is a "Best Practice" for parser building:
- Flexibility: Your transformer can process both "C-style" code (semicolons) and "Basic-style" or "Python-style" code (newlines) using the same logic.
- Accuracy: It prevents matching delimiters that exist inside strings or comments, as
{@StatementSeparator}only triggers on tokens recognized by the lexer as functional separators.
Inverse Matching with !
The universal inversion operator ! can be applied:
{@StatementSeparator}: Matches a statement terminator.{!StatementSeparator}: Matches any token that is not a separator (useful for capturing the entire "meat" of a statement).
Strategy & Critique
- Structural Abstraction: This is one of uCalc's most powerful architectural features. It treats "Statement Termination" as a logical concept rather than a character-matching task.
- Ambiguity Note: In some languages, a newline is only a separator if the current statement isn't "open" (e.g., inside an unclosed parenthesis). Because
{@StatementSeparator}relies on the engine's tokenization, it automatically inherits this advanced context-awareness. - See Also: Refer to Topic 811 (
{@Newline}) for matching line breaks specifically.
Current Time: Tuesday, January 13, 2026 at 8:55 PM EST.
Examples
{@StatementSeparator}
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@StatementSeparator}", "");
Console.WriteLine(t.Transform("a = b + c; x = y + 1;"));
a = b + c<sep> x = y + 1<sep> using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("{@StatementSeparator}", "<sep>"); Console.WriteLine(t.Transform("a = b + c; x = y + 1;"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("{@StatementSeparator}", "");
cout << t.Transform("a = b + c; x = y + 1;") << endl;
}
a = b + c<sep> x = y + 1<sep> #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("{@StatementSeparator}", "<sep>"); cout << t.Transform("a = b + c; x = y + 1;") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("{@StatementSeparator}", "")
Console.WriteLine(t.Transform("a = b + c; x = y + 1;"))
End Sub
End Module
a = b + c<sep> x = y + 1<sep> Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("{@StatementSeparator}", "<sep>") Console.WriteLine(t.Transform("a = b + c; x = y + 1;")) End Sub End Module
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
Identifying any statement separator and replacing it with a standardized tag.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@StatementSeparator}", " [END_STMT]");
Console.WriteLine(t.Transform("x = 10; y = 20"));
x = 10 [END_STMT] y = 20 using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@StatementSeparator}", " [END_STMT]"); Console.WriteLine(t.Transform("x = 10; y = 20"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@StatementSeparator}", " [END_STMT]");
cout << t.Transform("x = 10; y = 20") << endl;
}
x = 10 [END_STMT] y = 20 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@StatementSeparator}", " [END_STMT]"); cout << t.Transform("x = 10; y = 20") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("{@StatementSeparator}", " [END_STMT]")
Console.WriteLine(t.Transform("x = 10; y = 20"))
End Sub
End Module
x = 10 [END_STMT] y = 20 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@StatementSeparator}", " [END_STMT]") Console.WriteLine(t.Transform("x = 10; y = 20")) End Sub End Module
Internal Test (Configurability) Verifying that `{@StatementSeparator}` respects the engine's definition (e.g., checking if it correctly ignores a comma used as a parameter separator).
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@StatementSeparator}", "STMT");
// Comma is not a StatementSeparator, so it should be ignored.
Console.WriteLine(t.Transform("func(a, b); next();"));
func(a, b)STMT next()STMT using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@StatementSeparator}", "STMT"); // Comma is not a StatementSeparator, so it should be ignored. Console.WriteLine(t.Transform("func(a, b); next();"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@StatementSeparator}", "STMT");
// Comma is not a StatementSeparator, so it should be ignored.
cout << t.Transform("func(a, b); next();") << endl;
}
func(a, b)STMT next()STMT #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@StatementSeparator}", "STMT"); // Comma is not a StatementSeparator, so it should be ignored. cout << t.Transform("func(a, b); next();") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("{@StatementSeparator}", "STMT")
'// Comma is not a StatementSeparator, so it should be ignored.
Console.WriteLine(t.Transform("func(a, b); next();"))
End Sub
End Module
func(a, b)STMT next()STMT Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@StatementSeparator}", "STMT") '// Comma is not a StatementSeparator, so it should be ignored. Console.WriteLine(t.Transform("func(a, b); next();")) End Sub End Module