Table of Contents

Class VariableEvaluatorSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Resolves Custom Macro B variable references and bracket expressions on a single block by walking the parser-stage residue and replacing each reference with its evaluated numeric value.

Two passes per block:

  1. Parsing.Assignments.#nnn entries with a non-literal RHS are evaluated in iteration order. Successful results are written to Vars.Volatile for #100-#499 or to the registered RetainedCommonVariableTable for #500-#999, and the entry is removed. Iteration order matters: an earlier RHS may set a variable that a later RHS reads. Failures (vacant operand, unsupported function, parse error) emit a VariableExpression--Unevaluated error and leave the entry in place; out-of-range ids are likewise left in place.
  2. Every string-typed value reachable from Parsing.<tag> (axis tags, canned-cycle sub-objects like Parsing.G81, Parsing.G54.1, etc.) is parsed; on a successful evaluation the string is replaced with a numeric JsonValue. Failures silently leave the original string and rely on downstream GetParsedDouble(JsonObject, string, Sentence, NcDiagnosticProgress) at consumer sites to surface VariableExpression--Unevaluated only if the tag is actually read.

Lookup chain (first non-null wins):

  1. Block-local Vars.Local with Previous traceback (#1-#33).
  2. Block-local Vars.Volatile with traceback (#100-#499).
  3. Each IVariableLookup in the runner's NcDependencyList, in registration order (e.g. RetainedCommonVariableTable, FanucParameterTable, FanucToolOffsetTable).
  4. Each IRuntimeVariableLookup in RuntimeVariableLookups, in list order (e.g. FanucPositionVariableLookup).

Each lookup is responsible for its own id-range gating — id ranges are not hard-coded inside this syntax. Adding a new variable surface (Heidenhain Q parameters, Siemens GUDs, modal G/F/T reads) is additive: register an IVariableLookup on a dependency or push an IRuntimeVariableLookup onto the per-preset list.

public class VariableEvaluatorSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
VariableEvaluatorSyntax
Implements
Inherited Members
Extension Methods

Constructors

VariableEvaluatorSyntax()

Default constructor.

public VariableEvaluatorSyntax()

VariableEvaluatorSyntax(XElement)

Loads from an XML element produced by MakeXmlSource(string, string, bool). No state to deserialise.

public VariableEvaluatorSyntax(XElement src)

Parameters

src XElement

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

RuntimeVariableLookups

Per-preset list of context-sensitive lookups (typically position reads that need Previous). Walked in list order after all dependency-bound IVariableLookups.

public List<IRuntimeVariableLookup> RuntimeVariableLookups { get; set; }

Property Value

List<IRuntimeVariableLookup>

XName

XML element name for Regs registration.

public static string XName { get; }

Property Value

string

Methods

Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)

Build syntax arrangement into the syntaxPieceNode in-place.

public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)

Parameters

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.