Templated
|
The default token start and end delimiters are { and } but can be overridden in TemplatedExpressionParser constructor. All substitution tokens surrounded by StartTokenDelimiter and EndTokenDelimiter (e.g., {token}) will be immediately replaced with their string equivalents before further expression evaluation. As a result of the expression syntax <, >, =, and ! are reserved expressions symbols; StartTokenDelimiter, EndTokenDelimiter, StartExpressionDelimiter and EndExpressionDelimiter are reserved delimiter symbols. To embed any reserved symbol into the TemplatedExpression so that it appears in the evaluated result, escape the symbol by prefixing it with a backslash, e.g., \{.
The default expression start and end delimiters are [ and ] but can be overridden in TemplatedExpressionParser constructor. Expressions are represented in the form of [?expression[result]] and can be nested, e.g. ([?expression1[?expression2[result]]]). Expressions should not contain extraneous white space for proper evaluation. Only simple boolean comparison operations are allowed in expressions, e.g., A=B (or A==B), A!=B (or A<>B), A>B, A>=B, A<B and A<=B - nothing more. Any expression that fails to evaluate will be evaluated as FALSE. Note that if both left (A) and right (B) operands can be parsed as a numeric value then the expression will be numerically evaluated otherwise expression will be a culture-invariant string comparison. Nested expressions are evaluated as cumulative AND operators. There is no defined nesting limit.
Advanced expressions can be parsed using the eval function, e.g., eval{1 + 2}. Eval function expression is delimited by the currently defined token delimiters, { and } by default. The evaluation engine deals with numbers and strings. The typing of numeric literals follow C# standards, suffixes such as d, f and m may be used to explicitly specify the numeric type. If no numeric suffix is provided, the default type of a numeric literal is assumed to be Int32. String literals should be specified using single quotes instead of double quotes, this includes substitution parameters, e.g., eval{'{DeviceAcronym}'.Length + 1}. Advanced evaluation expressions using the eval function are always parsed after common expressions. Eval functions cannot be nested.
When evaluateExpressions is true and values in substitutions intentionally contain expressions to be evaluated, then escapeSubstitutionValues should be set to false so that the reserved symbols in the values are not automatically escaped.