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

Precedence = [int]

Property

Product: 

Transformer Library

Class: 

Rule

Returns the precedence level for a rule

Remarks

Returns the precedence level for a rule.

setter[Revisit]Patterns that start (and/or end) with a pattern variable instead of a token or identifier can (and probably should) be assigned a precedence level. You can choose any arbitrary numerical value. The meaning of the precedence level depends on whether the value is greater, equal, or less than adjacent patterns with a precedence level. It works similarly to precedence levels for operators. For instance, if you define:

                             FromTo("{a} + {b}", "({a} + {b})").Precedence(10); FromTo("{a} * {b}", "({a} * {b})").Precedence(20);                             Then                             "1 + 2 * 3 + 4" transforms into "(1 + (2 * 3) + 4)" "1 * 2 + 3 * 4" transforms into "(1 * 2) + (3 * 4)"                          

Examples