Class NcExpressionDialectUtil
- Namespace
- Hi.NcParsers.EvaluationSyntaxs.Evaluation
- Assembly
- HiMech.dll
Dispatch helpers over NcExpressionDialect so shared syntaxes (VariableEvaluatorSyntax, the assignment/tag capture syntaxes) stay brand-agnostic: they hold a dialect value and route through here instead of hard-coding a parser type.
public static class NcExpressionDialectUtil
- Inheritance
-
NcExpressionDialectUtil
- Inherited Members
Methods
IsVariableKey(NcExpressionDialect, string)
Cheap validity gate for variable keys entering the evaluator's lookup chain — rejects obviously-non-variable keys before the chain walk. Keys are produced by the dialect's own parser, so this is defensive.
public static bool IsVariableKey(NcExpressionDialect dialect, string key)
Parameters
dialectNcExpressionDialectkeystring
Returns
MakePrefixParser(NcExpressionDialect)
Materializes a dialect into the optional longest-valid-prefix hook
the capture helpers take
(GrabTagEqualsValue(ref string, IEnumerable<string>, ExpressionPrefixParser) /
GrabTagAssignment(ref string, IEnumerable<string>, string, IEnumerable<string>, ExpressionPrefixParser)); null
for None and for dialects without
prefix support (legacy lexical capture).
public static ExpressionPrefixParser MakePrefixParser(NcExpressionDialect dialect)
Parameters
dialectNcExpressionDialect
Returns
TryParse(NcExpressionDialect, string, out NcExpr, out string)
Full-string parse in the given dialect (the whole source must be one expression). None always fails — callers on the None path never parse.
public static bool TryParse(NcExpressionDialect dialect, string source, out NcExpr expr, out string error)
Parameters
dialectNcExpressionDialectsourcestringexprNcExprerrorstring
Returns
TryParsePrefix(NcExpressionDialect, string, out int)
Longest-valid-prefix parse for parser-delimited RHS capture. Only
dialects that support prefix parsing return true; the Fanuc
dialect keeps its lexical capture (no known ambiguity to fix) and
reports false so callers use their legacy boundary.
public static bool TryParsePrefix(NcExpressionDialect dialect, string source, out int consumedLength)
Parameters
dialectNcExpressionDialectsourcestringconsumedLengthint
Returns
VariableRefRegex(NcExpressionDialect)
Regex matching this dialect's variable-reference tokens inside a raw
RHS string. Used only for best-effort same-block forward-reference
detection (VariableEvaluator–SameBlockForwardReference);
expression evaluation itself goes through the dialect parser. The
Siemens pattern covers R-parameters only — named/$ same-block
forward references are vanishingly rare in CAM output and go
unwarned.
public static Regex VariableRefRegex(NcExpressionDialect dialect)
Parameters
dialectNcExpressionDialect