Table of Contents

Class NamedVarAssignmentSyntax

Namespace
Hi.NcParsers.ParsingSyntaxs
Assembly
HiMech.dll

Assignment syntax for named (identifier-style) variables with = sign. Handles variables that are multi-character identifiers rather than {prefix}{digits}.

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

Remarks

  • Siemens GUD: _X_HOME = 100, _MY_VAR = R1 + R2
  • Siemens LUD: DEF REAL MY_LOCAL; MY_LOCAL = 50
Unlike TagAssignmentSyntax which handles {prefix}{digits} variables (e.g., #1, R1, Q5), this class handles multi-character identifier variables. Identifiers must be at least 2 characters to avoid overlap with single-letter axis tags (X, Y, Z, etc.).

Ordering: Must be placed before TagAssignmentSyntax in syntax lists so that multi-char identifiers (e.g., _X_HOME) are consumed before {prefix}{digits} patterns (e.g., R1) attempt to match.

Constructors

NamedVarAssignmentSyntax(IEnumerable<string>, IEnumerable<string>, string)

public NamedVarAssignmentSyntax(IEnumerable<string> categoryPath, IEnumerable<string> terminateWords = null, string identPattern = "[A-Za-z_]\\w+")

Parameters

categoryPath IEnumerable<string>
terminateWords IEnumerable<string>
identPattern string

NamedVarAssignmentSyntax(XElement)

public NamedVarAssignmentSyntax(XElement src)

Parameters

src XElement

Fields

DefaultIdentPattern

public const string DefaultIdentPattern = "[A-Za-z_]\\w+"

Field Value

string

Properties

CategoryPath

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

Property Value

List<string>

IdentPattern

Regex pattern for matching variable identifiers. Default: [A-Za-z_]\w+ (at least 2 characters).

public string IdentPattern { get; set; }

Property Value

string

Name

public string Name { get; }

Property Value

string

TerminateWords

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

Property Value

List<string>

XName

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.

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