Table of Contents

Class FanucIfThenSyntax

Namespace
Hi.NcParsers.EvaluationSyntaxs.Fanuc
Assembly
HiMech.dll

Resolves Fanuc Custom Macro B IF [<cond>] THEN <body> single-block conditionals. Triggered by Parsing.FanucIfThen (written by FanucIfThenParsingSyntax); reads the now-resolved Condition node, decides whether to fire, and on fire lifts the parsing-stage PendingAssignments sub-object into the canonical Parsing.Assignments bucket so the brand-specific reader syntaxes downstream route each entry to its store the same way they would handle an unconditional #nnn = <literal> on a normal block.

Unlike FanucGotoSyntax there is no source splice, no label scan, no iteration watchdog — the spec restricts the body to the current block. The host block is preserved either way (the stamped FanucIfThen section on the host's top-level JSON keeps the IF-THEN call site visible to cache dumps and diagnostics, with Applied flipped true only on a successful fire).

Pipeline placement: in the Evaluation bundle after VariableEvaluatorSyntax (so the Condition expression has been substituted in place by pass-2 tree walk, and each PendingAssignments RHS string has been evaluated to a numeric JsonValue) and before the reader syntaxes (VolatileVariableReadingSyntax, RetainedCommonVariableReadingSyntax, FanucLocalVariableReadingSyntax, FanucSystemControlVariableSyntax) — that ordering lets the lifted entries reach the readers as if they had been written by TagAssignmentSyntax on a normal block.

Three condition outcomes mirror the FanucGotoSyntax.ReadCondition shape:

  • Truthy non-zero → lift assignments, stamp Applied=true.
  • Truthy zero → fall through silently, Applied=false.
  • Truthy null (evaluator failed, condition still a string or non-finite) → warn FanucIfThen--ConditionNotEvaluated, do not lift, Applied=false.
A truthy condition with no PendingAssignments (body did not parse as one or more assignments — e.g. a G-code body, currently unsupported) warns FanucIfThen--UnsupportedBody and falls through.
public class FanucIfThenSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
FanucIfThenSyntax
Implements
Inherited Members
Extension Methods

Constructors

FanucIfThenSyntax()

Parameterless instance (no XML state).

public FanucIfThenSyntax()

FanucIfThenSyntax(XElement)

XML ctor (no child elements; reserved for forward compatibility).

public FanucIfThenSyntax(XElement src)

Parameters

src XElement

Root element named XName.

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name used to register this syntax with XFactory.

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.

Reg(XFactory)

Registers this type's deserializer with the given XFactory (or Default when factory is null). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory