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.
public class NumberedFlagSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
NumberedFlagSyntax
- Implements
- Inherited Members
- Extension Methods
Remarks
Examples:
- Integer codes: G0, G1, G54, M3, M30, T5, S1000
- Decimal codes: 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)
public NumberedFlagSyntax(XElement src)
Parameters
srcXElement
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
public string Name { get; }
Property Value
XName
public static string XName { get; }
Property Value
Methods
Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>)
Build syntax arrangement into the
syntaxPieceNode in-place.
public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList)
Parameters
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>
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.