Class SiemensLoopSyntax
- Namespace
- Hi.NcParsers.EvaluationSyntaxs.Siemens
- Assembly
- HiMech.dll
Resolves the four Siemens loop constructs against one shared frame
stack — WHILE ... ENDWHILE, FOR ... ENDFOR,
REPEAT ... UNTIL (the label-less post-test loop) and
LOOP ... ENDLOOP — the
FanucWhileDoSyntax template (frames-in-JSON +
ModalCarry tracked key + forward scan to the terminator + back-jump
to the recorded entry line), adapted to constructs that carry no
LoopId: frames stack in nesting order on the block-root
SiemensLoopFrames section, and every terminator
validates that the innermost frame carries its own construct
Kind and file. A single shared stack
is what makes mixed-construct nesting (a FOR inside a WHILE inside a
LOOP) pair correctly.
- WHILE — pre-test: truthy pushes a frame (first
arrival) and falls through; falsy/unresolved pops its own frame
and forward-jumps past the matching
ENDWHILE(depth-counted).ENDWHILEback-jumps unconditionally; the WHILE line re-evaluates. - FOR — counting: first arrival resolves the bounds
once (Sinumerik semantics), assigns the loop variable by lifting
into
Parsing.Assignments(the reader syntaxes downstream persist it exactly as a written assignment), and pushes a frame carryingVar/End/Value; each re-arrival incrementsValueuntil it exceedsEnd, then pops and jumps pastENDFOR. - REPEAT/UNTIL — post-test:
REPEATpushes and always falls through;UNTILexits on truthy (pop), warns and exits on unresolved, back-jumps to theREPEATline on falsy. - LOOP/ENDLOOP — endless:
ENDLOOPback-jumps while the SiemensLoopIterationDependency watchdog allows; the watchdog is a hard requirement here (no exit condition exists), so a missing dependency suppresses the jump with a configuration error instead of hanging the pipeline.
Back-jump counting happens at the back-jump step only (a loop whose
condition is false from the outset consumes zero iterations), keyed
(FileName, BeginLineNo) on the watchdog. All scans use the
anchored LabelScanUtil overload from the host line —
never the whole-file first match, which would pair a terminator with
an earlier sibling construct of the same kind.
Pipeline placement: Evaluation bundle control-flow group, after VariableEvaluatorSyntax (conditions and bounds substituted) and before the variable readers (the FOR lift must reach them on the same block).
Known limitation — stack pairing vs lexical pairing. Real
Sinumerik pairs loop constructs lexically at block preparation; this
syntax pairs them dynamically on the carried frame stack. A
GOTOF/GOTOB that leaves a loop body strands that
loop's frame (only the FOR head detects and drops a stale frame, via
AdvancePending), so a jump from an
inner loop into an enclosing loop's body can mispair the
enclosing terminator with the stale inner frame. Sinumerik itself
forbids jumping into control structures; all such shapes stay
bounded here by the watchdog and surface loud diagnostics. Scan
probes also mirror the Fanuc convention of not replaying
BlockSkipSyntax — a /-prefixed terminator is invisible
to the exit scans.
public class SiemensLoopSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SiemensLoopSyntax
- Implements
- Inherited Members
- Extension Methods
Constructors
SiemensLoopSyntax()
Parameterless instance (no XML state).
public SiemensLoopSyntax()
SiemensLoopSyntax(XElement)
XML ctor (no child elements; reserved for forward compatibility).
public SiemensLoopSyntax(XElement src)
Parameters
Properties
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name used to register this syntax with XFactory.
public static string XName { get; }
Property Value
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
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
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
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif 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
factoryXFactory