nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
scan_core.hpp
1// src/builtin/include/nk/builtin/scan_core.hpp
2#pragma once
3
4// Shared scan parse+shape core, exposed so the engine-coupled fscanf shim
5// (relocated to the runtime layer) can reuse the same machinery as
6// the pure sscanf. scanfEmit itself is pure — no Engine.
7
8#include <nk/value/span.hpp>
9#include <nk/value/value.hpp>
10
11#include <cstddef>
12#include <memory_resource>
13#include <string>
14
15namespace nk::ops {
16struct SizeSpec;
17}
18
19namespace nk::builtin::detail {
20
21// scanfCycle's run summary — matched-item count + input bytes consumed.
23{
24 std::size_t count;
25 std::size_t bytesConsumed;
26};
27
40void scanfEmit(const std::string &input, const std::string &fmt,
41 const ::nk::ops::SizeSpec &sz, std::size_t nargout,
42 Span<Value> outs, std::pmr::memory_resource *mr, ScanfOut &r);
43
44} // namespace nk::builtin::detail