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.
{@End}
Product:
Class:
Remarks
End-of-String Anchor
Description: A structural anchor directive that restricts a pattern match to the very end of the source text.
The {@End} directive is used within a uCalc::Transformer to ensure that a specific pattern only succeeds if it is found at the absolute conclusion of the input string. Like {@Beginning}, it is a zero-width anchor; it doesn't "consume" tokens, but validates that no more tokens remain in the stream following the match.
Positional Logic
{@End} is essential for tasks that require document-level integrity. It is commonly used to:
Append footers or closing tags.
Validate that a file ends with a required delimiter (like a semicolon or closing brace).
Trigger a final "clean-up" calculation using
{@@Eval}or{@Doc}.Comparison to Regex:
{@End}is functionally equivalent to the$anchor in standard Regular Expressions.Token Awareness: In a token-based engine,
{@End}ensures that the preceding pattern accounts for the final token in the stream before the end-of-file (EOF) state is reached.
Examples
1. Succinct (Quick Start: EOF Identification)
Matching a specific keyword only if it is the very last thing in the document.
New(uCalc::Transformer, t)// Match 'DONE' only if it's at the very endt.FromTo("DONE {@End}", "[FINISH]")wl(t.Transform("Processing... DONE"))wl(t.Transform("DONE - continuing..."))[Expected Output]Processing... [FINISH]DONE - continuing... (No change, since 'DONE' was not at the end)
2. Practical (Real World: Automatic Document Footer)
Using {@End} to identify the last word of a document and automatically appending a generated timestamp or signature.
New(uCalc::Transformer, t)// Match the last word and append a footert.FromTo("{@Alpha:last} {@End}", "{last}\n--- End of Report ---")var(string, doc) = "Final summary text"wl(t.Transform(doc))[Expected Output]
Final summary text--- End of Report ---3. Internal Test (Boundary Integrity)
Verifying that {@End} handles various token types at the boundary correctly.
New(uCalc::Transformer, t)t.FromTo("{@End}", " [EOF]")wl(t.Transform("12345"))[Expected Output]12345 [EOF]
Strategy & Critique
- Logical Symmetry:
{@End}provides the necessary symmetry to{@Beginning}, allowing developers to define rules for both boundaries of a document. - Performance: Just like its counterpart,
{@End}allows for fast-fail logic. If a pattern contains{@End}but the current token is not the last one, the engine can move on immediately. - Naming: Consistent with
{@Beginning}. - Critique: In many programming languages, a "newline" often follows the last meaningful character. Depending on engine settings, you may need to decide if your pattern matches before or after a final
{@Newline}. - See Also: Refer to Topic 777 (
{@Beginning}) for anchoring to the start of the source string.