Class NumberedFlagSyntax
- Namespace
- Hi.NcParsers.ParsingSyntaxs
- Assembly
- HiMech.dll
Syntax for numbered flags (prefix + number) with optional decimal support. NumberedFlagSyntax often should place after something like ParameterizedFlagSyntax. Since NumberedFlagSyntax is easy to eat those kind of flags.
Single-digit integer codes are zero-padded to canonical 2-digit form
(e.g. M6 → M06, G0 → G00, M3 → M03)
so that downstream logic syntaxes comparing against
IsoKeywords constants (which are always
2-digit form like M06) can
match Fanuc-style omitted-leading-zero codes. Two-digit and decimal
codes are kept as-is.
public class NumberedFlagSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
NumberedFlagSyntax
- Implements
- Inherited Members
- Extension Methods
Remarks
Examples of stored canonical flags:
- Single-digit integer codes, padded:
G0→G00,M3→M03 - Two-digit or longer integer codes, unchanged:
G54,M30 - Decimal codes, unchanged:
G54.1(Fanuc extended work coordinates)
Constructors
NumberedFlagSyntax(IEnumerable<string>, IEnumerable<string>, bool)
Creates a new NumberedFlagSyntax instance.
public NumberedFlagSyntax(IEnumerable<string> categoryPath, IEnumerable<string> codePrefixes, bool allowDecimal = true)
Parameters
categoryPathIEnumerable<string>JSON path for storing matched codes.
codePrefixesIEnumerable<string>Code prefixes to match (e.g., [“G”, “M”]).
allowDecimalboolWhether to allow decimal numbers.
NumberedFlagSyntax(XElement)
Loads category path, code prefixes, and decimal policy from XML.
public NumberedFlagSyntax(XElement src)
Parameters
Properties
AllowDecimal
Whether to allow decimal numbers (e.g., G54.1).
public bool AllowDecimal { get; set; }
Property Value
CategoryPath
Category path for storing matched codes in JSON.
public List<string> CategoryPath { get; set; }
Property Value
CodePrefixes
Code prefixes to match (e.g., [“G”, “M”]).
public List<string> CodePrefixes { get; set; }
Property Value
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name for Regs 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.