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.
Product:
Class:
Defines a global stop pattern that acts as an uncrossable boundary for all variable captures within the transformer.
Returns the newly created Rule object representing the stop pattern, which can be used to modify or release it.
Note: This feature is currently in the design phase and is not yet implemented in the production engine.
The Stop method defines a global "hard stop" boundary for an entire Transformer instance. When any rule's variable (e.g., {body}) is capturing text, it will immediately stop if it encounters a match for a Stop pattern. The stop pattern itself is not consumed and is not part of any match.
This is a powerful feature for parsing text with well-defined but un-consumable terminators, such as an END keyword or a block delimiter that should not be part of any capture.
Stop pattern applies to all rules within the Transformer. It is not tied to a specific FromTo or Pattern rule.Stop patterns, the most recently defined one has the highest precedence and will be checked for first.It is crucial to understand how Stop differs from other boundary types in uCalc:
| Mechanism | Scope | Behavior | Use Case |
|---|---|---|---|
| Rule Anchor | Rule-specific | Consumed. Becomes part of the match ({@Self}). | Defining the start or end of a specific pattern. |
| Statement Separator | Instance-wide | Consumed. A token type (like ;) that terminates a capture if StatementSensitive is true. | Parsing code or line-based data where newlines are significant. |
{@Stop} Directive | Rule-specific | Not Consumed. Truncates what is included in the {@Self} capture for a single rule. | Creating a lookahead within a single pattern. |
Stop() Method | Transformer-wide | Not Consumed. A global boundary that terminates any variable capture in any rule. | Defining a universal terminator for a document format. |
Transformer.Stop is conceptually similar to a positive lookahead in regular expressions ((?=...pattern...)), which asserts that a pattern must exist without consuming it.
However, uCalc's Stop patterns have a key advantage: they are token-aware. A regex lookahead operates on raw characters and can be difficult to write for structured data. A Stop pattern operates on the token stream, so it inherently respects word boundaries, quoted strings, and other language constructs, making it a more robust and reliable tool for parsing.