Table of Contents

Class SiemensDefStatementSyntax

Namespace
Hi.NcParsers.ParsingSyntaxs.Siemens
Assembly
HiMech.dll

Consumes Sinumerik variable declarations (DEF REAL _X_HOME=155.5, _SAFE_Z / DEF INT N_ST=3) and lowers each declared name into Parsing.Assignments: initialised names carry their initialiser expression text (the Evaluation bundle resolves and routes it into Vars.Named like any named assignment), bare names carry “0” — Sinumerik default-initialises numeric types to zero, so a later G0 Z=_SAFE_Z reads 0 instead of failing vacant.

Must run before NamedVarAssignmentSyntax in the Parsing bundle: on a DEF line that syntax would capture _X_HOME=155.5 but strand DEF REAL (and the comma list) as unparsed residue. Initialiser expressions are delimited by the SiemensExpressionParser longest-valid-prefix rule, so parenthesised arithmetic and whitespace survive; a non-numeric type or unparsable initialiser leaves the whole statement untouched (visible as residue) rather than half-consuming it.

BOOL/CHAR initialise to 0 like INT; STRING declarations are not lowered (string values have no numeric store) — the statement is consumed whole so it cannot shed ghost tokens. The declaration itself leaves no Parsing record: the lowered Assignments entries carry the entire semantic payload, and an inert record would only re-surface as an Unconsumed residue.

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

Examples

#BeforeBuild.UnparsedText: DEF REAL _X_HOME=155.5, _SAFE_Z #AfterBuild:

{
  "Parsing": {
    "Assignments": { "_X_HOME": "155.5", "_SAFE_Z": "0" }
  }
}

Constructors

SiemensDefStatementSyntax()

Default constructor.

public SiemensDefStatementSyntax()

SiemensDefStatementSyntax(XElement)

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

public SiemensDefStatementSyntax(XElement src)

Parameters

src XElement

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name for Generators 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.

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