Class FanucGotoParsingSyntax
- Namespace
- Hi.NcParsers.ParsingSyntaxs.Fanuc
- Assembly
- HiMech.dll
Parses Fanuc Custom Macro B GOTO phrases out of the remaining
UnparsedText into a Parsing.FanucGoto
sub-object. Two forms are recognised:
GOTO <n>— unconditional jump.IF [<bool-expr>] GOTO <n>— conditional jump.
IF [...] GOTO is matched as a single phrase, not as an IF
syntax composed with a GOTO syntax — Fanuc only permits the two
fixed forms (the other being IF [...] THEN <assignment>,
out of scope here), so a phrase-level parser is more faithful and
avoids parsing-ambiguity rabbit holes.
<n> is captured as a raw token (literal like "100",
variable like "#1", or bracketed expression like
"#[#2+5]"). VariableEvaluatorSyntax
substitutes the resolved literal back into the same field downstream;
FanucGotoSyntax then parses the final
string as an int. Storing as a string at parsing time mirrors how axis
tags and canned-cycle params accept #N references and the
evaluator rewrites them in place.
Pipeline placement: after HeadIndexSyntax (so the leading
N{seq} on a block like N50 GOTO 100 has already been
consumed) and after QuoteCommentSyntax
(so a parenthesised (GOTO 100) inside a comment never matches).
The phrase consumes the entire remaining text on the block — Fanuc
allows only the GOTO / IF-GOTO phrase after any preceding head index,
no other instructions on the same block.
public class FanucGotoParsingSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
FanucGotoParsingSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
#BeforeBuild.UnparsedText: GOTO 100
#AfterBuild:
{
"Parsing": {
"FanucGoto": {
"Term": "GOTO",
"N": "100"
}
}
}
#BeforeBuild.UnparsedText: GOTO #1
#AfterBuild:
{
"Parsing": {
"FanucGoto": {
"Term": "GOTO",
"N": "#1"
}
}
}
#BeforeBuild.UnparsedText: IF [#1 GT 0] GOTO 100
#AfterBuild:
{
"Parsing": {
"FanucGoto": {
"Term": "IF...GOTO",
"N": "100",
"Condition": "#1 GT 0"
}
}
}
Constructors
FanucGotoParsingSyntax()
Parameterless instance for bundle composition (no XML state).
public FanucGotoParsingSyntax()
FanucGotoParsingSyntax(XElement)
XML ctor (no child elements; reserved for forward compatibility).
public FanucGotoParsingSyntax(XElement src)
Parameters
Properties
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