ParameterTypes Module
Types
Functions and values
Function or value | Description |
|
|
|
|
|
|
Full Usage:
evaluateParamExpression paramBindings paramExpr
Parameters:
ParamBindings
-
Map from parameter names to their bound expressions
paramExpr : ParamExpression
-
The parameter expression to evaluate
Returns: Result<ParamInt, ParamError>
Success: The evaluated integer value if all parameters can be resolved to constants
Error: A human-readable error message listing any unresolved parameters
|
This function recursively evaluates the expression tree, substituting parameter values from the bindings and performing arithmetic operations. Parameters are resolved to their bound expressions, which are then recursively evaluated. If any parameters remain unresolved after full evaluation, an error is returned listing them.
|
Full Usage:
exprContainsParams expression
Parameters:
ParamExpression
-
The expression to check
Returns: bool
True if the expression contains at least one PParameter, false if it only contains constants
|
This function recursively traverses the expression tree to find any PParameter nodes. Useful for determining if an expression can be fully evaluated without parameter bindings.
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
parseExpression text
Parameters:
string
-
The input string to parse
Returns: Result<ParamExpression, ParamError>
Success: The parsed parameter expression
Error: A human-readable error message describing the parsing failure
|
Supports arithmetic expressions with: - Integer constants - Parameter names (alphanumeric identifiers) - Binary operators: +, -, *, /, % - Parentheses for grouping Operator precedence (higher binds tighter): - *, /, %: Higher precedence - +, -: Lower precedence The parser uses recursive descent with separate functions for each precedence level.
|
Full Usage:
renderParamExpression expr precedence
Parameters:
ParamExpression
-
The parameter expression to render
precedence : int
-
The precedence context (higher values require more parentheses)
Returns: string
A string representation of the expression with minimal parentheses
|
Precedence levels: - Addition/Subtraction: 1 - Multiplication/Division: 2 - Remainder: 3 (always parenthesized) Parentheses are added when the current operator has lower precedence than the context.
|