{@Bracketed}

Product: 

Class: 

Warning

uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments.The next phase envolves some structural changes, performance optimizations, and API refinements.The API is subject to breaking changes prior to the stable release. Please evaluate the preview version thoroughly before production use.

Remarks

[revisit]Description: A structural token pattern that matches content enclosed within balanced opening and closing delimiters (parentheses, brackets, or braces).

The {@Bracket} token is a specialized pattern used within a uCalc::Transformer. It is designed to solve the "Nested Delimiter Problem" that often plagues traditional string parsing.

By default, {@Bracket} recognizes:

  • Parentheses: ( ... )
  • Square Brackets: [ ... ]
  • Curly Braces: { ... }

Why use {@Bracket} instead of Regex?

Standard regular expressions are typically regular (Finite Automata) and cannot handle recursive nesting without complex extensions.

FeatureRegex (.*)uCalc {@Bracket}
Nesting AwarenessMatches to the last closing bracket (greedy) or first (non-greedy), often breaking inner logic.Tracks nesting levels; only stops when the initial opening bracket is balanced.
Mixed DelimitersRequires separate patterns for (), [], and {}.Automatically detects and balances all standard types.
Logic SpeedCan encounter "Catastrophic Backtracking" on deep nests.Linear-time token scanning.

Examples

This page last modified on: 

8/21/2026