Class TagAssignmentSyntax
- Namespace
- Hi.NcParsers.ParsingSyntaxs
- Assembly
- HiMech.dll
Assignment syntax with = sign. Unlike TagValueSyntax which handles concatenated tag-value pairs (no = sign), this class handles explicit assignment statements.
public class TagAssignmentSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
TagAssignmentSyntax
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
- Fanuc: #1 = 100, #100 = [#1 + #2]
- Siemens: R1 = 100, R1 = R2 + R3
- Heidenhain: via derived HeidenhainFnAssignmentSyntax which adds FN prefix handling
Constructors
TagAssignmentSyntax(IEnumerable<string>, IEnumerable<string>, string, IEnumerable<string>)
Creates an assignment syntax. Pass null for categoryPath
to use DefaultCategoryPath (Parsing.Assignments). Pass an empty
collection only if assignments should land at the Parsing root.
public TagAssignmentSyntax(IEnumerable<string> categoryPath, IEnumerable<string> tags, string varPrefix, IEnumerable<string> terminateWords = null)
Parameters
categoryPathIEnumerable<string>tagsIEnumerable<string>varPrefixstringterminateWordsIEnumerable<string>
TagAssignmentSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public TagAssignmentSyntax(XElement src)
Parameters
srcXElementSource XML element.
Properties
CategoryPath
JSON path under Parsing where matched assignments are written.
public List<string> CategoryPath { get; set; }
Property Value
DefaultCategoryPath
Default CategoryPath assigned when the caller passes null
(or omits the <CategoryPath> element in saved XML).
Routes assignment outputs into Parsing.Assignments so that
variable-reading syntaxes can target a single well-defined subtree.
public static IReadOnlyList<string> DefaultCategoryPath { get; }
Property Value
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
TagList
Numeric tag suffixes accepted (e.g. 1, 100) when paired with VarPrefix.
public List<string> TagList { get; set; }
Property Value
TerminateWords
Optional keywords that terminate the right-hand expression so the
remainder is left in UnparsedText.
public List<string> TerminateWords { get; set; }
Property Value
VarPrefix
Variable prefix (e.g. #, R, Q) preceding the numeric tag.
public string VarPrefix { get; set; }
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 virtual 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
ToAssignmentJsonNode(string)
Converts an assignment expression string to a JsonNode. Override in derived classes for typed parsing.
protected virtual JsonNode ToAssignmentJsonNode(string setup)
Parameters
setupstring
Returns
TryStripPrefix(ref string)
Strips a brand-specific prefix from unparsedText
before assignment parsing.
Returns false to signal no match (skip this syntax).
Base implementation does nothing (no prefix required).
protected virtual bool TryStripPrefix(ref string unparsedText)
Parameters
unparsedTextstring