uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Description: A category matcher that identifies any token defined as a literal constant value (e.g., numbers, quoted strings, or booleans).
The {@Literal} directive is a broad matcher used within a uCalc::Transformer to target data values. Unlike specific matchers like {@Number} or {@String}, {@Literal} matches any token that represents a fixed value rather than an identifier or an operator.
By default, {@Literal} will match:
123, 45.67, 0xFF"Hello World", 'Single Quote'true, false (if defined as literal tokens)While {@Literal} is convenient for general data manipulation, uCalc allows for higher precision. If your transformation logic depends on the type of data (e.g., you want to format numbers but leave strings alone), you should use the more specific directives:
{@Number}: For numeric values only.{@String}: For quoted text values only.!The universal inversion operator ! can be applied to this category:
{@Literal}: Matches any constant value.{!Literal}: Matches any token that is not a literal (e.g., variable names, keywords, operators like + or if).In many parsers, you have to write a complex regex that accounts for every possible numeric format and quote style. {@Literal} leverages uCalc's built-in token categorization, making your patterns immune to changes in how numbers or strings are defined.
ID: 914
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@Literal:val}", "VAL({val})");
Console.WriteLine(t.Transform("""
x = 10 + "abc"
"""));
x = VAL(10) + VAL("abc") using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@Literal:val}", "VAL({val})"); Console.WriteLine(t.Transform(""" x = 10 + "abc" """));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@Literal:val}", "VAL({val})");
cout << t.Transform(R"(x = 10 + "abc")") << endl;
}
x = VAL(10) + VAL("abc") #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@Literal:val}", "VAL({val})"); cout << t.Transform(R"(x = 10 + "abc")") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("{@Literal:val}", "VAL({val})")
Console.WriteLine(t.Transform("x = 10 + ""abc"""))
End Sub
End Module
x = VAL(10) + VAL("abc") Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@Literal:val}", "VAL({val})") Console.WriteLine(t.Transform("x = 10 + ""abc""")) End Sub End Module
ID: 915
using uCalcSoftware;
var uc = new uCalc();
// Creating a "Clean View" of a log or configuration file by replacing all
// actual data values with a placeholder, leaving only the structural identifiers.
var t = new uCalc.Transformer();
// Replace every literal with a generic placeholder
t.FromTo("{@Literal}", "?");
string input = """
setting_a = 500; setting_b = "active";
""";
Console.WriteLine(t.Transform(input));
setting_a = ?; setting_b = ?; using uCalcSoftware; var uc = new uCalc(); // Creating a "Clean View" of a log or configuration file by replacing all // actual data values with a placeholder, leaving only the structural identifiers. var t = new uCalc.Transformer(); // Replace every literal with a generic placeholder t.FromTo("{@Literal}", "?"); string input = """ setting_a = 500; setting_b = "active"; """; Console.WriteLine(t.Transform(input));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// Creating a "Clean View" of a log or configuration file by replacing all
// actual data values with a placeholder, leaving only the structural identifiers.
uCalc::Transformer t;
// Replace every literal with a generic placeholder
t.FromTo("{@Literal}", "?");
string input = R"(setting_a = 500; setting_b = "active";)";
cout << t.Transform(input) << endl;
}
setting_a = ?; setting_b = ?; #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Creating a "Clean View" of a log or configuration file by replacing all // actual data values with a placeholder, leaving only the structural identifiers. uCalc::Transformer t; // Replace every literal with a generic placeholder t.FromTo("{@Literal}", "?"); string input = R"(setting_a = 500; setting_b = "active";)"; cout << t.Transform(input) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// Creating a "Clean View" of a log or configuration file by replacing all
'// actual data values with a placeholder, leaving only the structural identifiers.
Dim t As New uCalc.Transformer()
'// Replace every literal with a generic placeholder
t.FromTo("{@Literal}", "?")
Dim input As String = "setting_a = 500; setting_b = ""active"";"
Console.WriteLine(t.Transform(input))
End Sub
End Module
setting_a = ?; setting_b = ?; Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// Creating a "Clean View" of a log or configuration file by replacing all '// actual data values with a placeholder, leaving only the structural identifiers. Dim t As New uCalc.Transformer() '// Replace every literal with a generic placeholder t.FromTo("{@Literal}", "?") Dim input As String = "setting_a = 500; setting_b = ""active"";" Console.WriteLine(t.Transform(input)) End Sub End Module