Table of Contents

Class FanucGotoSyntax

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

Resolves Fanuc Custom Macro B GOTO control flow. Triggered by Parsing.FanucGoto (written by FanucGotoParsingSyntax); decides whether to fire, and on fire calls ReplaceSource(IEnumerable<T>) on layers[0] with the re-segmented file content starting at the matching N{target} label. The host block stays materialised (so cache dumps still see the GOTO call site); execution naturally continues from the new source once the pipeline pulls the next block.

Both unconditional GOTO <n> and conditional IF [<expr>] GOTO <n> are implemented. The conditional form leans on VariableEvaluatorSyntax's pass-2 tree walk to substitute Parsing.FanucGoto.Condition with a numeric JsonValue when the expression evaluates successfully — ReadCondition(JsonNode) then reads the node polymorphically. Truthy non-zero fires the redirect; zero falls through silently; a still-string (unresolved) Condition emits FanucGoto--ConditionNotEvaluated and falls through.

Pipeline placement: tail of the Fanuc / Mazak / Syntec Evaluation bundle. Must run after VariableEvaluatorSyntax so any #<var> in the target N (e.g. GOTO #1) has been substituted to a literal in Parsing.FanucGoto.N. Reader syntaxes (VolatileVariableReadingSyntax etc.) are independent — they touch Parsing.Assignments, not Parsing.FanucGoto.

Label scanning uses two hosted helper syntaxes — CommentSyntax and IndexSyntax — applied to each candidate block in turn so the predicate IndexNote.Number == target matches the same way the Parsing bundle would. Both are XML-IO-able so API customers can swap them (e.g. for a controller variant using ;-style comments or a different head symbol). Defaults match Fanuc: QuoteCommentSyntax and HeadIndexSyntax with the "N" symbol.

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

Constructors

FanucGotoSyntax()

Parameterless instance with default helper syntaxes.

public FanucGotoSyntax()

FanucGotoSyntax(XElement, string, IProgress<object>)

Loads hosted helper syntaxes from XML produced by MakeXmlSource(string, string, bool). The <LabelProbeSyntaxes> wrapper contains one child element per probe syntax in source order; an absent wrapper falls back to the default list.

public FanucGotoSyntax(XElement src, string baseDirectory, IProgress<object> progress)

Parameters

src XElement

Root element named XName.

baseDirectory string

Project base directory propagated to child XFactory calls.

progress IProgress<object>

Diagnostic sink propagated to child factories.

Properties

LabelProbeSyntaxes

Ordered list of helper syntaxes run on each candidate block during the label scan before the IndexNote.Number == target predicate is checked. The defaults match Fanuc — QuoteCommentSyntax strips parenthesised comments so a commented-out (N100) never matches, then HeadIndexSyntax with symbol “N” extracts the head index into IndexNote.Number.

Exposed as a list (rather than two fixed properties) so API customers can insert additional probe syntaxes — for example a TailCommentSyntax for ;-style end-of-block comments alongside the parenthesised form, or a BlockSkipSyntax to skip /-prefixed blocks from the label-scan results. Order matters: comment-strippers before the head-index parser, the index parser last (so its output reflects the post-strip text).

public List<ISituNcSyntax> LabelProbeSyntaxes { get; set; }

Property Value

List<ISituNcSyntax>

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