Table of Contents

Class TagAssignmentSyntax

Namespace
Hi.NcParsers.ParsingSyntaxs
Assembly
HiMech.dll

Assignment syntax with = sign. Unlike TagValueSyntax which handles concatenated tag-value pairs (no = sign), this class handles explicit assignment statements.

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

Remarks

  • Fanuc: #1 = 100, #100 = [#1 + #2]
  • Siemens: R1 = 100, R1 = R2 + R3
  • Heidenhain: via derived HeidenhainFnAssignmentSyntax which adds FN prefix handling
Wraps GrabTagAssignment(ref string, IEnumerable<string>, string, IEnumerable<string>) as an INcSyntax.

Constructors

TagAssignmentSyntax(IEnumerable<string>, IEnumerable<string>, string, IEnumerable<string>)

Creates an assignment syntax. Pass null for categoryPath to use DefaultCategoryPath (Parsing.Assignments). Pass an empty collection only if assignments should land at the Parsing root.

public TagAssignmentSyntax(IEnumerable<string> categoryPath, IEnumerable<string> tags, string varPrefix, IEnumerable<string> terminateWords = null)

Parameters

categoryPath IEnumerable<string>
tags IEnumerable<string>
varPrefix string
terminateWords IEnumerable<string>

TagAssignmentSyntax(XElement)

Initializes a new instance by deserializing from the given XML element.

public TagAssignmentSyntax(XElement src)

Parameters

src XElement

Source XML element.

Properties

CategoryPath

JSON path under Parsing where matched assignments are written.

public List<string> CategoryPath { get; set; }

Property Value

List<string>

DefaultCategoryPath

Default CategoryPath assigned when the caller passes null (or omits the <CategoryPath> element in saved XML). Routes assignment outputs into Parsing.Assignments so that variable-reading syntaxes can target a single well-defined subtree.

public static IReadOnlyList<string> DefaultCategoryPath { get; }

Property Value

IReadOnlyList<string>

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

TagList

Numeric tag suffixes accepted (e.g. 1, 100) when paired with VarPrefix.

public List<string> TagList { get; set; }

Property Value

List<string>

TerminateWords

Optional keywords that terminate the right-hand expression so the remainder is left in UnparsedText.

public List<string> TerminateWords { get; set; }

Property Value

List<string>

VarPrefix

Variable prefix (e.g. #, R, Q) preceding the numeric tag.

public string VarPrefix { get; set; }

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 virtual 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

ToAssignmentJsonNode(string)

Converts an assignment expression string to a JsonNode. Override in derived classes for typed parsing.

protected virtual JsonNode ToAssignmentJsonNode(string setup)

Parameters

setup string

Returns

JsonNode

TryStripPrefix(ref string)

Strips a brand-specific prefix from unparsedText before assignment parsing. Returns false to signal no match (skip this syntax). Base implementation does nothing (no prefix required).

protected virtual bool TryStripPrefix(ref string unparsedText)

Parameters

unparsedText string

Returns

bool