uCalc API Version: 2.1.3-preview.2 Released: 6/17/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.

Aliases

Product: 

Class: 

Remarks

Description: A collection of shorthand names for common structural directives and category matchers used to improve pattern readability and conciseness.

In the uCalc::Transformer, patterns can often become lengthy when using full descriptive names for every token type. Aliases are functionally identical counterparts to standard directives that allow you to express the same logic with fewer characters.

Case Sensitivity

Directives and their aliases are not case-sensitive. For example, {@Tab}, {@tab}, and {@TAB} are all evaluated identically by the engine.

Common Alias Map

The following table lists the most frequently used aliases:

AliasFull NamePurpose
{@nl}{@Newline}Matches vertical line breaks.
{@Alpha}{@Alphanumeric}Matches alphabetic or alphanumeric identifiers.
{@ws}{@Whitespace}Matches horizontal spaces and tabs.
{@str} / {@s}{@String}Matches any full quoted string (auto-detected).
{@dqs}{@StringDQ}Matches a full string enclosed in ".
{@sqs}{@StringSQ}Matches a full string enclosed in '.
{@dq}{@DoubleQuoteChar}Matches a literal " character.
{@sq}{@SingleQuoteChar}Matches a literal ' character.
{@Sep}{@StatementSeparator}Matches boundaries like ;.

Naming Conventions and Nuance

  • Character vs. String: It is important to distinguish between character aliases and string aliases.
    • {@dq} matches only the double-quote character.
    • {@dqs} matches the quote character plus all the text inside until the closing quote.
  • The "Alpha" Distinction: In uCalc, {@Alpha} (and its full name {@Alphanumeric}) follows the standard for programming identifiers, meaning it includes digits and underscores.
  • API Symmetry: Establishing full names like {@DoubleQuoteChar} to match the existing alias {@dq} ensures that the library feels complete for developers who prefer verbose code.

Examples

1. Succinct (Char vs String Aliases)

Showing the difference between matching a quote character and a full quoted string.

New(uCalc::Transformer, t)// Pattern: Match 'msg' followed by a literal quotet.FromTo("msg {@dq}", "MSG_START")// Pattern: Match 'msg' followed by a full quoted stringt.FromTo("msg {@dqs:val}", "MESSAGE({val})")wl(t.Transform("msg \"Hello World\""))

2. Practical (Shorthand Cleanup)

Using {@ws} and {@nl} to keep a pattern concise while stripping trailing space.

New(uCalc::Transformer, t)// Verbose: {@Alpha:w} {@Whitespace} {@Newline}t.FromTo("{@Alpha:w} {@ws} {@nl}", "{w}{@nl}")wl(t.Transform("Test   \n"))

[Expected Output]Test\n


Strategy & Critique

  • Precision: The distinction between {@dq} (char) and {@dqs} (string) is vital. Mapping {@dq} to a full string is a common mistake in early pattern design; these aliases help reinforce the correct logic.
  • Readability: Shortening common markers makes the "meat" of the pattern stand out.
  • Consistency: Standardizing on aliases like {@Sep} and {@nl} across a project ensures that different developers are speaking the same shorthand.
  • See Also: Refer to Topic 812 ({@nl}) and Topic 827 ({@dq}) for detailed behavioral documentation.

Examples