Class SubProgramReturnSyntax
- Namespace
- Hi.NcParsers.EvaluationSyntaxs
- Assembly
- HiMech.dll
Consumes Fanuc-style M99 subprogram-return blocks and pops
one CallStack frame. Plain M99 relies on the
natural pipeline tail — the inlined body's last block is followed
in layers[0] by the caller's next block, so the “return”
happens implicitly; this syntax only consumes the M99 trigger (so
UnconsumedCheckSyntax doesn't warn),
stamps a SubProgramReturn diagnostic section, and
writes the popped CallStack for downstream blocks to
carry.
M99 P{seq} additionally redirects control flow to the
caller's N{seq} block via
ReplaceSource(IEnumerable<T>). The caller's file is
resolved from the popped frame's
CallerFilePath; the scan uses the same
LabelScanUtil.SegmentAndSkipUntilLabel helper as
FanucGotoSyntax, with hardcoded Fanuc-default
probes (QuoteCommentSyntax + HeadIndexSyntax
with symbol "N") because the M99 P semantic itself is
Fanuc-family-only and Mazak / Syntec follow the same conventions.
The iteration is counted against
FanucGotoIterationDependency, sharing the same
runaway-loop guard as GOTO — keyed on the same
(FileName, TargetN) bucket so a tight
M98 → M99 P → M98 … loop trips the same threshold.
Pipeline placement: same Evaluation bundle slot it always occupied,
right after SubProgramCallSyntax at the head. Needs
FanucGotoIterationDependency,
ProjectFolderDependency,
SegmenterDependency,
SyntaxPieceLayerDependency,
FileIndexCounterDependency on the dep list when
M99 P{seq} is to fire; without them the plain-M99 path still
works and the P-jump emits a configuration warning.
Detection is on the Parsing.M99 sub-object written by
M99Syntax
(a ParameterizedFlagSyntax) — the keyword
"M99" never reaches Parsing.Flags because the
parameterized match has already consumed the text by the time
NumberedFlagSyntax runs.
public class SubProgramReturnSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SubProgramReturnSyntax
- Implements
- Inherited Members
- Extension Methods
Constructors
SubProgramReturnSyntax()
Parameterless instance with default probe list.
public SubProgramReturnSyntax()
SubProgramReturnSyntax(XElement, string, IProgress<object>)
Loads LabelProbeSyntaxes from XML produced by MakeXmlSource(string, string, bool). An absent wrapper falls back to the default probe list.
public SubProgramReturnSyntax(XElement src, string baseDirectory, IProgress<object> progress)
Parameters
srcXElementRoot element named XName.
baseDirectorystringProject base directory propagated to child XFactory calls.
progressIProgress<object>Diagnostic sink propagated to child factories.
Properties
LabelProbeSyntaxes
Ordered list of probe syntaxes run on each candidate block during
the M99 P{seq} caller-side scan, before the integer label predicate
fires. Defaults match Fanuc / Mazak / Syntec (parenthesised comment
stripper + N head-index parser); API customers can swap or
extend (e.g. add a TailCommentSyntax for ;
end-of-block comments, or insert a BlockSkipSyntax
to exclude /-prefixed candidates) without subclassing.
Mirrors the same hosted-list pattern as
LabelProbeSyntaxes.
public List<ISituNcSyntax> LabelProbeSyntaxes { get; set; }
Property Value
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