Table of Contents

Class SiemensLoopParsingSyntax

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

Captures the Siemens loop-construct phrases whole, one Parsing section per construct family:

  • WHILE <cond> / ENDWHILEParsing.SiemensWhile.
  • FOR <var> = <start> TO <end> / ENDFORParsing.SiemensFor. The start expression is stored as a single-entry Init map keyed by the variable name — the evaluator's pass-2 tree walk rewrites values only, never keys, so the loop variable's name survives even when it collides with a set named variable. Literal start/end bounds are written as numeric JSON values directly (writer decides the node type); expressions stay strings for the evaluator.
  • bare REPEAT / UNTIL <cond>Parsing.SiemensRepeatUntil. Only the label-less form is taken — REPEAT LBL1 ... is the P4 section repeat owned by SiemensRepeatParsingSyntax, which runs earlier in the statement group.
  • LOOP / ENDLOOPParsing.SiemensLoop.

Placement: whole-statement owner group, after SiemensGotoParsingSyntax / SiemensIfParsingSyntax and before the assignment syntaxes — FOR R1=0 TO 10 would otherwise be shredded by the assignment capture (R1=0 is a legal assignment shape and the TO 10 tail strands). SiemensLoopSyntax consumes all four sections against its shared loop-frame stack.

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

Examples

Pre-test loop entry — the condition keeps its Sinumerik spelling: #BeforeBuild.UnparsedText: WHILE R1<=5 #AfterBuild:

{
  "Parsing": { "SiemensWhile": { "Term": "WHILE", "Condition": "R1<=5" } }
}

Pre-test loop terminator: #BeforeBuild.UnparsedText: ENDWHILE #AfterBuild:

{
  "Parsing": { "SiemensWhile": { "Term": "ENDWHILE" } }
}

Counting loop with literal bounds — literals are written numeric: #BeforeBuild.UnparsedText: FOR R1 = 0 TO 10 #AfterBuild:

{
  "Parsing": {
    "SiemensFor": {
      "Term": "FOR",
      "Init": { "R1": 0 },
      "End": 10
    }
  }
}

Counting loop with expression bounds — expressions stay strings for the evaluator: #BeforeBuild.UnparsedText: FOR R2=R5 TO R6+1 #AfterBuild:

{
  "Parsing": {
    "SiemensFor": {
      "Term": "FOR",
      "Init": { "R2": "R5" },
      "End": "R6+1"
    }
  }
}

Post-test loop entry (bare form only — the labelled REPEAT is the P4 section repeat): #BeforeBuild.UnparsedText: REPEAT #AfterBuild:

{
  "Parsing": { "SiemensRepeatUntil": { "Term": "REPEAT" } }
}

Post-test loop exit condition: #BeforeBuild.UnparsedText: UNTIL R3>100 #AfterBuild:

{
  "Parsing": { "SiemensRepeatUntil": { "Term": "UNTIL", "Condition": "R3>100" } }
}

Endless loop entry: #BeforeBuild.UnparsedText: LOOP #AfterBuild:

{
  "Parsing": { "SiemensLoop": { "Term": "LOOP" } }
}

Endless loop terminator: #BeforeBuild.UnparsedText: ENDLOOP #AfterBuild:

{
  "Parsing": { "SiemensLoop": { "Term": "ENDLOOP" } }
}

Constructors

SiemensLoopParsingSyntax()

Parameterless instance (no XML state).

public SiemensLoopParsingSyntax()

SiemensLoopParsingSyntax(XElement)

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

public SiemensLoopParsingSyntax(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