HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/api/Hi.NcParsers.ParsingSyntaxs.Fanuc.html

211 lines
11 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Namespace Hi.NcParsers.ParsingSyntaxs.Fanuc | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Namespace Hi.NcParsers.ParsingSyntaxs.Fanuc | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Hi.NcParsers.ParsingSyntaxs.Fanuc">
<h1 id="Hi_NcParsers_ParsingSyntaxs_Fanuc" data-uid="Hi.NcParsers.ParsingSyntaxs.Fanuc" class="text-break">Namespace Hi.NcParsers.ParsingSyntaxs.Fanuc</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>
<div class="markdown level0 remarks"></div>
<h3 id="classes">
Classes
</h3>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.ParsingSyntaxs.Fanuc.FanucGotoParsingSyntax.html">FanucGotoParsingSyntax</a></dt>
<dd><p>Parses Fanuc Custom Macro B GOTO phrases out of the remaining
<a class="xref" href="Hi.NcParsers.Keywords.IUnparsedTextDef.html#Hi_NcParsers_Keywords_IUnparsedTextDef_UnparsedText">UnparsedText</a> into a <code>Parsing.FanucGoto</code>
sub-object. Two forms are recognised:</p>
<ul><li><code>GOTO &lt;n&gt;</code> — unconditional jump.</li><li><code>IF [&lt;bool-expr&gt;] GOTO &lt;n&gt;</code> — conditional jump.</li></ul>
<p>
<code>IF [...] GOTO</code> is matched as a single phrase, not as an <code>IF</code>
syntax composed with a <code>GOTO</code> syntax — Fanuc only permits the two
fixed forms (the other being <code>IF [...] THEN &lt;assignment&gt;</code>,
out of scope here), so a phrase-level parser is more faithful and
avoids parsing-ambiguity rabbit holes.
</p>
<p>
<code>&lt;n&gt;</code> is captured as a raw token (literal like <code>"100"</code>,
variable like <code>"#1"</code>, or bracketed expression like
<code>"#[#2+5]"</code>). <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>
substitutes the resolved literal back into the same field downstream;
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucGotoSyntax.html">FanucGotoSyntax</a> then parses the final
string as an int. Storing as a string at parsing time mirrors how axis
tags and canned-cycle params accept <code>#N</code> references and the
evaluator rewrites them in place.
</p>
<p>
Pipeline placement: after <a class="xref" href="Hi.NcParsers.ParsingSyntaxs.HeadIndexSyntax.html">HeadIndexSyntax</a> (so the leading
<code>N{seq}</code> on a block like <code>N50 GOTO 100</code> has already been
consumed) and after <a class="xref" href="Hi.NcParsers.ParsingSyntaxs.CommentSyntaxs.QuoteCommentSyntax.html">QuoteCommentSyntax</a>
(so a parenthesised <code>(GOTO 100)</code> 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.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.ParsingSyntaxs.Fanuc.FanucIfThenParsingSyntax.html">FanucIfThenParsingSyntax</a></dt>
<dd><p>Parses the Fanuc Custom Macro B
<code>IF [&lt;bool-expr&gt;] THEN &lt;body&gt;</code> single-block conditional
phrase out of <a class="xref" href="Hi.NcParsers.Keywords.IUnparsedTextDef.html#Hi_NcParsers_Keywords_IUnparsedTextDef_UnparsedText">UnparsedText</a> into a
<code>Parsing.FanucIfThen</code> sub-object. Sibling to
<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.Fanuc.FanucGotoParsingSyntax.html">FanucGotoParsingSyntax</a> — Fanuc spec only permits two
IF-led control phrases (<code>IF [...] GOTO &lt;n&gt;</code> handled there,
<code>IF [...] THEN &lt;stmt&gt;</code> handled here) so each form is matched
phrase-level rather than composed from a generic IF combinator.</p>
<p>
<b>Body shape.</b> The body after <code>THEN</code> is conceptually a single
statement that affects the current block only — no jump, no label scan.
Almost always a Custom Macro B assignment (<code>#nnn = &lt;expr&gt;</code>);
multiple assignments in the same body
(<code>#100 = 5. #101 = #100 + 1</code>) are also accepted. The parsing
syntax pre-extracts these via
<a class="xref" href="Hi.NcParsers.Syntaxs.NcSyntaxUtil.html#Hi_NcParsers_Syntaxs_NcSyntaxUtil_GrabTagAssignment_System_String__System_Collections_Generic_IEnumerable_System_String__System_String_System_Collections_Generic_IEnumerable_System_String__">GrabTagAssignment(ref string, IEnumerable&lt;string&gt;, string, IEnumerable&lt;string&gt;)</a> into
<code>Parsing.FanucIfThen.PendingAssignments</code> as <code>{tag: rhs-string}</code>
entries — that shape lets <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>'s
pass-2 tree walk substitute each RHS to a numeric in place, and lets
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucIfThenSyntax.html">FanucIfThenSyntax</a> lift the
resolved entries into <code>Parsing.Assignments</code> only when the gate
condition fires (so unfired bodies leave no trace in the readers).
</p>
<p>
<b>Pipeline placement.</b> This syntax must run before
<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.Fanuc.FanucGotoParsingSyntax.html">FanucGotoParsingSyntax</a> — the bare IF-GOTO regex over there
(<code>^IF[..]GOTO n$</code>) is anchored, but consuming IF-THEN here first
keeps the two phrases textually disjoint and avoids any future
regression if either regex is loosened. Also placed before
<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.TagAssignmentSyntax.html">TagAssignmentSyntax</a> so a bare
<code>IF [...] THEN #100 = 5.</code> is not first half-eaten as a plain
assignment.
</p>
<p>
Raw <a class="xref" href="Hi.NcParsers.Keywords.FanucIfThen.html#Hi_NcParsers_Keywords_FanucIfThen_BodyText">BodyText</a> is retained verbatim on the
parsing section regardless of whether the body parsed as assignments —
it carries the round-trip view and lets the evaluation syntax warn
(<code>FanucIfThen--UnsupportedBody</code>) if no PendingAssignments were
produced on a truthy condition.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.ParsingSyntaxs.Fanuc.FanucProgramNumberSyntax.html">FanucProgramNumberSyntax</a></dt>
<dd><p>Detects a Fanuc-family program identifier header — <code>O1234</code> or
<code>&lt;O1234&gt;</code> — that follows a <a class="xref" href="Hi.NcParsers.Keywords.TapeBoundary.html">TapeBoundary</a>
line, and records it under <a class="xref" href="Hi.NcParsers.Keywords.FanucProgramNumber.html">FanucProgramNumber</a> on the
block JSON. The wrapping form (bare vs angle-bracketed) is preserved
in <a class="xref" href="Hi.NcParsers.Keywords.FanucProgramNumber.html#Hi_NcParsers_Keywords_FanucProgramNumber_Wrapper">Wrapper</a> so the block can be emitted
back to its original notation.</p>
</dd>
</dl>
</article>
<div class="contribution d-print-none">
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>