HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/api/Hi.NcParsers.EvaluationSyntaxs.html
2026-05-24 14:06:51 +08:00

440 lines
29 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Namespace Hi.NcParsers.EvaluationSyntaxs | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Namespace Hi.NcParsers.EvaluationSyntaxs | 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.EvaluationSyntaxs">
<h1 id="Hi_NcParsers_EvaluationSyntaxs" data-uid="Hi.NcParsers.EvaluationSyntaxs" class="text-break">Namespace Hi.NcParsers.EvaluationSyntaxs</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.EvaluationSyntaxs.CallStackUtil.html">CallStackUtil</a></dt>
<dd><p>Push / pop helpers for the per-block <a class="xref" href="Hi.NcParsers.Keywords.CallStack.html">CallStack</a> section.
Both produce a fresh deep-cloned <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a> ready to
stamp onto an inlined piece (push site) or onto an M99 return block
(pop site); the caller is responsible for deep-cloning again if it
distributes the same stamp across multiple pieces of an L-repetition.</p>
<p>
Pairs with <a class="xref" href="Hi.NcParsers.PostLogicSyntaxs.ModalCarrySyntax.html">ModalCarrySyntax</a> at the
Logic stage: explicit push / pop writes seed the section at frame
boundaries, ModalCarry copies it forward to every block in between
so each block is self-contained for cache-dump readers and downstream
consumers (notably M99 <code>P{seq}</code> reading the top frame's
<a class="xref" href="Hi.NcParsers.Keywords.CallFrame.html#Hi_NcParsers_Keywords_CallFrame_CallerFilePath">CallerFilePath</a>).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.LabelScanUtil.html">LabelScanUtil</a></dt>
<dd><p>Shared &ldquo;re-segment a file and skip pieces until a label matches&rdquo;
scan, used by both
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucGotoSyntax.html">FanucGotoSyntax</a> (unconditional GOTO redirect)
and <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.SubProgramReturnSyntax.html">SubProgramReturnSyntax</a> (<code>M99 P{seq}</code> jump
into the caller file). Reads the file via
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ReadLines_System_Int32_System_String_System_String_">ReadLines(int, string, string)</a>, segments through the
provided <a class="xref" href="Hi.NcParsers.Segmenters.ISegmenter.html">ISegmenter</a>, runs the
caller-supplied probe syntaxes on each candidate block to
extract <code>IndexNote.Number</code>, and returns the slice from the
first matching block to EOF.</p>
<p>
Returns <code>null</code> when no block matches — the caller's
responsibility to surface the appropriate diagnostic. The probes
are idempotent because the downstream Parsing bundle re-runs the
same syntaxes on the yielded pieces with no-op effect (the regex
patterns no longer match once the N-prefix is consumed and the
parenthesised comment stripped).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.html">MacroFileResolver</a></dt>
<dd><p>Shared subprogram-/macro-file resolver for Fanuc-style <code>O&lt;n&gt;</code>
lookups consumed by <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.SubProgramCallSyntax.html">SubProgramCallSyntax</a> (M98 / M198)
and <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucMacroCallSyntax.html">FanucMacroCallSyntax</a> (G65). Single helper so the three
path forms — file name, project-relative path, absolute path — are
produced together at one site and each caller gets exactly the form
it should consume:</p>
<ul><li><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_FileName">FileName</a> — bare <code>O####.NC</code> form
the resolver matched. Stored in JSON sections (<code>FanucMacroCall</code>,
<code>SubProgramCall</code>) as the structural NC-language identifier;
independent of which folder the dependency happened to be pointing
at, so the JSON stays portable across environments.</li><li><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_RelPath">RelPath</a> — relative path against the
project base directory (e.g. <code>"NC/O1234.NC"</code>). Used as the
<a class="xref" href="Hi.Common.FileLines.IndexedFileLine.html">IndexedFileLine</a> label so diagnostics on inlined blocks
align with the relative form already used for the main file label.</li><li><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_AbsPath">AbsPath</a> — absolute path. Used only
at the <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ReadLines_System_Int32_System_String_System_String_">ReadLines(int, string, string)</a> call site for actual disk I/O; never
persisted, never returned to JSON. Lives inside the resolver's stack
frame and the segmenter's enumeration.</li></ul>
<p>
Filename lookup order (first match wins) mirrors real Fanuc fallback:
<code>O{P:D4}.NC</code>, <code>O{P}.NC</code>, <code>O{P:D4}</code>, <code>O{P}</code>,
<code>{P:D4}.NC</code>, <code>{P}.NC</code>. Case-insensitive match is delegated
to the host filesystem (Windows is, Linux is not).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.html">MacroInlineUtil</a></dt>
<dd><p>Shared inline mechanism for Fanuc Custom Macro B body expansion —
used by both <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucMacroCallSyntax.html">FanucMacroCallSyntax</a> (one-shot) and
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucModalMacroSyntax.html">FanucModalMacroSyntax</a>'s expansion phase (modal trigger). Both
callers do the same three things on every produced
<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a>: stamp a <a class="xref" href="Hi.NcParsers.Keywords.FanucMacroCall.html">FanucMacroCall</a>
clone, stamp a fresh <a class="xref" href="Hi.NcParsers.Keywords.MacroFrame.html">MacroFrame</a> id, and stamp
argument bindings into <code>Vars.Local</code>. Centralising lets the two
call sites stay in lock-step — frame allocation, file-index
allocation, and the inline-piece JSON shape are guaranteed
identical.</p>
<p>
Frame ids share the same <a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.FileIndexCounterDependency.html">FileIndexCounterDependency</a>
counter as file indices — both just need within-session uniqueness
and the counter is rewound on session start in lock-step with the
pipeline. The main NC file is allocated index 0 first, so all
inline frame ids land at &gt; 0 and never collide with main.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.RetainedCommonVariableReadingSyntax.html">RetainedCommonVariableReadingSyntax</a></dt>
<dd><p>Obtains values for Fanuc-style retained common variables (<code>#500-#999</code>)
by consuming literal numeric assignments from <code>Parsing.Assignments.#nnn</code>
and writing them straight to a registered
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a>.</p>
<p>
No SyntaxPiece JSON mirror is created — the table is the single source of
truth for retained values, and <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a> reads
from the table directly. The hincproj round-trip preserves writes across
project sessions.
</p>
<p>
Only literal numeric RHS values are consumed by this syntax
(<code>#500 = 1.234</code> ✓; <code>#600 = #500 + 1</code> ✗). Non-literal RHS entries
are left untouched in <code>Parsing.Assignments</code>; <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>
resolves them and writes the result through the same table. The two
syntaxes are decoupled.
</p>
<p>
If no <a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a> is registered on the
runner's <code>NcDependencyList</code>, this syntax is a no-op.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.SubProgramCallSyntax.html">SubProgramCallSyntax</a></dt>
<dd><p>Inlines a Fanuc-style subprogram into the source layer when an M98 or
M198 host block is reached. <code>M98 P_ L_</code> reads the matching
<code>O&lt;P&gt;</code> file from <a class="xref" href="Hi.NcParsers.Dependencys.Generic.SubProgramFolderConfig.html#Hi_NcParsers_Dependencys_Generic_SubProgramFolderConfig_InternalFolder">InternalFolder</a>;
<code>M198 P_</code> reads from <a class="xref" href="Hi.NcParsers.Dependencys.Generic.SubProgramFolderConfig.html#Hi_NcParsers_Dependencys_Generic_SubProgramFolderConfig_ExternalFolder">ExternalFolder</a>
(Fanuc external-storage call — same mechanism as M98, different lookup
root). The file is segmented through the host runner's segmenter
(<a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.SegmenterDependency.html">SegmenterDependency</a>) and the resulting
<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a>s are prepended into <code>layers[0]</code> via
<a class="xref" href="Hi.Common.Collections.LazyLinkedList-1.html#Hi_Common_Collections_LazyLinkedList_1_PrependSource_System_Collections_Generic_IEnumerable__0__">PrependSource(IEnumerable&lt;T&gt;)</a>; the rest of the
pipeline picks them up through ordinary <code>walkNode.Next</code>
traversal as if they had always been part of the host file.</p>
<p>
Pipeline placement: first child of the Fanuc <code>Evaluation</code>
<a class="xref" href="Hi.NcParsers.Syntaxs.BundleSyntax.html">BundleSyntax</a>. By the time this runs,
<a class="xref" href="Hi.NcParsers.Syntaxs.FanucSyntaxUtil.html#Hi_NcParsers_Syntaxs_FanucSyntaxUtil_M98Syntax">M98Syntax</a> /
<a class="xref" href="Hi.NcParsers.Syntaxs.FanucSyntaxUtil.html#Hi_NcParsers_Syntaxs_FanucSyntaxUtil_M198Syntax">M198Syntax</a>
(each a <a class="xref" href="Hi.NcParsers.ParsingSyntaxs.ParameterizedFlagSyntax.html">ParameterizedFlagSyntax</a>) have written a
<code>Parsing.M98</code> / <code>Parsing.M198</code> sub-object carrying the
captured <code>P</code> / <code>L</code> parameters. Note: those sub-objects
are this syntax's only trigger — <code>"M98"</code> / <code>"M198"</code>
never reach <code>Parsing.Flags</code>, because the parameterized
match has already consumed the text by the time
<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.NumberedFlagSyntax.html">NumberedFlagSyntax</a> runs.
</p>
<p>
Filename lookup uses a fallback chain:
<code>O{P:D4}.NC</code>, <code>O{P}.NC</code>, <code>O{P:D4}</code>, <code>O{P}</code>,
<code>{P:D4}.NC</code>, <code>{P}.NC</code> — first match wins. Case-insensitive
match is delegated to the host filesystem (Windows is, Linux is not).
</p>
<p>
L &gt; 1 inlines the same subprogram <code>L</code> times in series. Each
repetition is a fresh segmentation pass so each block gets its own
<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a> with an independent JSON object — the
downstream pipeline mutates JSON in place and would clobber sibling
repetitions if instances were shared.
</p>
<p>
Not yet supported: <code>M99 P{seq}</code> early return inside a
subprogram and partial-program calls (<code>M98 P{seq}{prog}</code> split
encoding). Custom Macro B argument-binding calls (<code>G65</code> /
<code>G66</code> / <code>G67</code>) live in <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucMacroCallSyntax.html">FanucMacroCallSyntax</a> and
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucModalMacroSyntax.html">FanucModalMacroSyntax</a> — those handle the
argument-letter-to-<code>#1..#26</code> binding and the macro-call frame
isolation that M98 deliberately does not provide.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.SubProgramReturnSyntax.html">SubProgramReturnSyntax</a></dt>
<dd><p>Consumes Fanuc-style <code>M99</code> subprogram-return blocks and pops
one <a class="xref" href="Hi.NcParsers.Keywords.CallStack.html">CallStack</a> frame. Plain <code>M99</code> relies on the
natural pipeline tail — the inlined body's last block is followed
in <code>layers[0]</code> by the caller's next block, so the &ldquo;return&rdquo;
happens implicitly; this syntax only consumes the M99 trigger (so
<a class="xref" href="Hi.NcParsers.InspectionSyntaxs.UnconsumedCheckSyntax.html">UnconsumedCheckSyntax</a> doesn't warn),
stamps a <a class="xref" href="Hi.NcParsers.Keywords.SubProgramReturn.html">SubProgramReturn</a> diagnostic section, and
writes the popped <a class="xref" href="Hi.NcParsers.Keywords.CallStack.html">CallStack</a> for downstream blocks to
carry.</p>
<p>
<code>M99 P{seq}</code> additionally redirects control flow to the
caller's <code>N{seq}</code> block via
<a class="xref" href="Hi.Common.Collections.LazyLinkedList-1.html#Hi_Common_Collections_LazyLinkedList_1_ReplaceSource_System_Collections_Generic_IEnumerable__0__">ReplaceSource(IEnumerable&lt;T&gt;)</a>. The caller's file is
resolved from the popped frame's
<a class="xref" href="Hi.NcParsers.Keywords.CallFrame.html#Hi_NcParsers_Keywords_CallFrame_CallerFilePath">CallerFilePath</a>; the scan uses the same
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.LabelScanUtil.html#Hi_NcParsers_EvaluationSyntaxs_LabelScanUtil_SegmentAndSkipUntilLabel_Hi_NcParsers_Segmenters_ISegmenter_System_String_System_String_System_Int32_System_Int32_System_Int32_System_Collections_Generic_List_Hi_NcParsers_Syntaxs_ISituNcSyntax__Hi_NcParsers_NcDiagnosticProgress_">SegmentAndSkipUntilLabel(ISegmenter, string, string, int, int, int, List&lt;ISituNcSyntax&gt;, NcDiagnosticProgress)</a> helper as
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucGotoSyntax.html">FanucGotoSyntax</a>, with hardcoded Fanuc-default
probes (<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.CommentSyntaxs.QuoteCommentSyntax.html">QuoteCommentSyntax</a> + <a class="xref" href="Hi.NcParsers.ParsingSyntaxs.HeadIndexSyntax.html">HeadIndexSyntax</a>
with symbol <code>"N"</code>) because the M99 P semantic itself is
Fanuc-family-only and Mazak / Syntec follow the same conventions.
The iteration is counted against
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.FanucGotoIterationDependency.html">FanucGotoIterationDependency</a>, sharing the same
runaway-loop guard as GOTO — keyed on the same
<code>(FileName, TargetN)</code> bucket so a tight
<code>M98 → M99 P → M98 …</code> loop trips the same threshold.
</p>
<p>
Pipeline placement: same Evaluation bundle slot it always occupied,
right after <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.SubProgramCallSyntax.html">SubProgramCallSyntax</a> at the head. Needs
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.FanucGotoIterationDependency.html">FanucGotoIterationDependency</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.ProjectFolderDependency.html">ProjectFolderDependency</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.SegmenterDependency.html">SegmenterDependency</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.SyntaxPieceLayerDependency.html">SyntaxPieceLayerDependency</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.FileIndexCounterDependency.html">FileIndexCounterDependency</a> on the dep list when
<code>M99 P{seq}</code> is to fire; without them the plain-M99 path still
works and the P-jump emits a configuration warning.
</p>
<p>
Detection is on the <code>Parsing.M99</code> sub-object written by
<a class="xref" href="Hi.NcParsers.Syntaxs.FanucSyntaxUtil.html#Hi_NcParsers_Syntaxs_FanucSyntaxUtil_M99Syntax">M99Syntax</a>
(a <a class="xref" href="Hi.NcParsers.ParsingSyntaxs.ParameterizedFlagSyntax.html">ParameterizedFlagSyntax</a>) — the keyword
<code>"M99"</code> never reaches <code>Parsing.Flags</code> because the
parameterized match has already consumed the text by the time
<a class="xref" href="Hi.NcParsers.ParsingSyntaxs.NumberedFlagSyntax.html">NumberedFlagSyntax</a> runs.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a></dt>
<dd><p>Pure expression normalizer for Custom Macro B syntax. Walks the
parser-stage residue on a single block and inlines numeric values
wherever a Fanuc-style variable reference or bracket expression
appears — but does <b>not</b> write to any specific store. Routing
&ldquo;where the resolved literal lands&rdquo; stays in the brand-specific
reader syntaxes (<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VolatileVariableReadingSyntax.html">VolatileVariableReadingSyntax</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a>'s reader,
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucSystemControlVariableSyntax.html">FanucSystemControlVariableSyntax</a>, …) which run
<i>after</i> this syntax on the same block.</p>
<p>
Two passes per block:
</p>
<ol><li>
<b>Assignments normalize</b><code>Parsing.Assignments.#nnn</code> entries
whose RHS is non-literal (e.g. <code>"#500+1"</code>, <code>"SQRT[#100]"</code>)
are evaluated via the <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax.ChainLookup</a> and the RHS string is
replaced with the resolved literal (round-trip-safe
<code>"R"</code>-format). The entry stays in <code>Parsing.Assignments</code> so
downstream reader syntaxes consume it as a pure-literal assignment.
Iteration follows source order (Parsing.Assignments insertion order).
</li><li>
<b>Parsing tree substitution</b> — every string-typed value reachable
from <code>Parsing.&lt;tag&gt;</code> (axis tags, canned-cycle sub-objects)
is parsed; on a successful evaluation the string is replaced with a
numeric <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonvalue">JsonValue</a>. Failures silently leave the original
string and rely on downstream
<a class="xref" href="Hi.NcParsers.SoftNcUtil.html#Hi_NcParsers_SoftNcUtil_GetParsedDouble_System_Text_Json_Nodes_JsonObject_System_String_Hi_NcParsers_ISentenceCarrier_Hi_NcParsers_NcDiagnosticProgress_">GetParsedDouble(JsonObject, string, ISentenceCarrier, NcDiagnosticProgress)</a> at consumer sites to surface
<code>VariableExpression--Unevaluated</code> only if the tag is actually read.
</li></ol>
<p>
Lookup chain (first non-null wins, configured per brand preset via
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html#Hi_NcParsers_EvaluationSyntaxs_VariableEvaluatorSyntax_RuntimeVariableLookups">RuntimeVariableLookups</a> + <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.IVariableLookup.html">IVariableLookup</a>
instances on <code>NcDependencyList</code>):
</p>
<ol><li><b>Current block's own resolved assignments</b> — built-in to
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax.ChainLookup</a>; covers same-block forward references in
source order (an earlier <code>#nnn=literal</code> is visible to a later
RHS that mentions <code>#nnn</code>).</li><li>Each <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.IRuntimeVariableLookup.html">IRuntimeVariableLookup</a> in
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html#Hi_NcParsers_EvaluationSyntaxs_VariableEvaluatorSyntax_RuntimeVariableLookups">RuntimeVariableLookups</a>, in list order. Typical contents
for a Fanuc-family preset:
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.LocalVariableLookup.html">LocalVariableLookup</a> (<code>#1-#33</code>),
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.VolatileVariableLookup.html">VolatileVariableLookup</a> (<code>#100-#499</code>),
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.FanucPositionVariableLookup.html">FanucPositionVariableLookup</a>
(<code>#5001-#5043</code>).</li><li>Each <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.IVariableLookup.html">IVariableLookup</a> on the runner's
<code>NcDependencyList</code>, in registration order
(<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.FanucParameterTable.html">FanucParameterTable</a>,
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.FanucToolOffsetVariableLookup.html">FanucToolOffsetVariableLookup</a>).</li></ol>
<p>
Each lookup self-gates its id range; the evaluator stays brand- and
range-agnostic. Adding a new variable surface is additive: register
an <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.IVariableLookup.html">IVariableLookup</a> on a dependency or push an
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Evaluation.IRuntimeVariableLookup.html">IRuntimeVariableLookup</a> onto the per-preset list.
</p>
<p>
<b>Same-block forward reference</b> — when an Assignment RHS
references a <code>#nnn</code> that is <i>also</i> being assigned later in
the same block (i.e. listed in <code>Parsing.Assignments</code> after the
RHS being evaluated), the <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax.ChainLookup</a> cannot pick up
the not-yet-resolved value and falls back to traceback /
dependency-table reads — effectively the pre-block value. A
<code>VariableEvaluator--SameBlockForwardReference</code> warning is
emitted per such RHS so the user is told the source-order semantics
were not honoured. Practical impact is near-zero for typical
CAM-emitted NC (one assignment per line).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VolatileVariableReadingSyntax.html">VolatileVariableReadingSyntax</a></dt>
<dd><p>Obtains values for Fanuc-style non-retained common variables
(<code>#100-#499</code>). Reads literal numeric assignments from
<code>Parsing.Assignments.#nnn</code>, dict-merges them with the previous block's
volatile state, and writes the resulting per-block dictionary into
<code>Vars.Volatile</code>.</p>
<p>
Lifetime is bounded by <code>MachiningSession</code>: within one session the
dictionary carries forward block-by-block via this syntax; session restart
abandons the SyntaxPiece JSON dataflow and starts fresh. Program-end
(M02/M30) clearing is handled by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndCleanSyntax.html">ProgramEndCleanSyntax</a>.
</p>
<p>
Only literal numeric RHS values are consumed by this syntax
(<code>#124 = 15.</code> ✓; <code>#100 = #1 + 5</code> ✗). Non-literal RHS entries
are left untouched in <code>Parsing.Assignments</code>; <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>
resolves them and writes the result into the same per-block dictionary.
The two syntaxes are decoupled — the evaluator's lookup tracebacks via
<code>SyntaxPiece</code> linkage so it does not depend on having run before
or after this syntax.
</p>
</dd>
</dl>
<h3 id="structs">
Structs
</h3>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html">MacroFileResolver.ResolvedFile</a></dt>
<dd><p>Tri-form resolution result. <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_FileName">FileName</a> is the bare
matched name; <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_RelPath">RelPath</a> is that name joined with the
folder portion of the dependency (relative when the folder is
configured relative, absolute fallback when it isn't);
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html#Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_AbsPath">AbsPath</a> is the fully-resolved I/O target.</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>