Class FanucProgramNumberSyntax
- Namespace
- Hi.NcParsers.ParsingSyntaxs.Fanuc
- Assembly
- HiMech.dll
Detects a Fanuc-family program identifier header — O1234 or
<O1234> — that follows a TapeBoundary
line, and records it under FanucProgramNumber on the
block JSON. The wrapping form (bare vs angle-bracketed) is preserved
in Wrapper so the block can be emitted
back to its original notation.
public class FanucProgramNumberSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
FanucProgramNumberSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
Bare O1234 on the first block of the stream (no
#Previous:) — start-of-stream is itself a tape boundary
per IsPreviousNodeTapeBoundary(LazyLinkedListNode<SyntaxPiece>), so
the syntax fires; the consumed text leaves nothing behind:
#BeforeBuild.UnparsedText: O1234
#AfterBuild:
{ "FanucProgramNumber": { "Number": "1234", "Wrapper": "None" } }
Angle-bracketed <O5678> after an explicit
TapeBoundary block (% on the prior line) —
Wrapper records the surface form:
#Previous:
{ "TapeBoundary": { "Text": "" } }
#BeforeBuild.UnparsedText: <O5678>
#AfterBuild:
{ "FanucProgramNumber": { "Number": "5678", "Wrapper": "Angle" } }
O1234 followed by trailing text (e.g. an inline comment) —
only the program-number header is consumed; the rest stays on
UnparsedText for downstream syntaxes to handle:
#Previous:
{ "TapeBoundary": { "Text": "" } }
#BeforeBuild.UnparsedText: O1234 (PART-A)
#AfterBuild:
{
"UnparsedText": "(PART-A)",
"FanucProgramNumber": { "Number": "1234", "Wrapper": "None" }
}
Previous block is not a tape boundary (e.g. ordinary
FanucProgramNumber already in the stream) — the
guard rejects the block, leaving UnparsedText intact:
#Previous:
{ "FanucProgramNumber": { "Number": "1000", "Wrapper": "None" } }
#BeforeBuild.UnparsedText: O9999
#AfterBuild:
{ "UnparsedText": "O9999" }
Constructors
FanucProgramNumberSyntax()
Parameterless instance for bundle composition (no XML state).
public FanucProgramNumberSyntax()
FanucProgramNumberSyntax(XElement)
XML ctor (no child elements; reserved for forward compatibility).
public FanucProgramNumberSyntax(XElement src)
Parameters
Properties
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name for Generators registration.
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