Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::DocumentHighlighter Class Reference

#include <document_highlight.hpp>

Public Member Functions

 DocumentHighlighter (DocumentHighlighterOptions options={}, std::uint64_t initialByteOffset=0) noexcept
 DocumentHighlighter (const DocumentHighlightCheckpoint &checkpoint) noexcept
DocumentHighlightResult feed (std::span< const DecodedScalar > input, std::span< TokenRun > output, bool endOfInput=false) noexcept
DocumentHighlightCheckpoint checkpoint () const noexcept
std::uint64_t nextByteOffset () const noexcept

Detailed Description

Worker-side, allocation-free streaming lexical projection. Single-owner mutation only; copied checkpoints can be transferred between workers. No views, controls, source owners or callbacks are retained. Cancellation belongs between bounded feed calls. Checkpoints must be source-qualified by the caller.

Constructor & Destructor Documentation

◆ DocumentHighlighter() [1/2]

portals::DocumentHighlighter::DocumentHighlighter ( DocumentHighlighterOptions options = {},
std::uint64_t initialByteOffset = 0 )
explicitnoexcept

Establish a proven initial lexical boundary.

Parameters
optionsExplicit profile and bounded processing policy.
initialByteOffsetOriginal-byte position at a known initial lexical context; nonzero is an assertion by the caller, never inferred cold-seek recovery.

◆ DocumentHighlighter() [2/2]

portals::DocumentHighlighter::DocumentHighlighter ( const DocumentHighlightCheckpoint & checkpoint)
explicitnoexcept

Restore all owned scanner state without inspecting or retaining source bytes.

Parameters
checkpointState previously qualified against the caller's current source, revision, decoding policy and language profile.

Member Function Documentation

◆ checkpoint()

DocumentHighlightCheckpoint portals::DocumentHighlighter::checkpoint ( ) const
noexcept

Capture delayed prefixes and staged output as an owning fixed-size value.

Returns
Copyable state; caller must attach source/revision/decoding/profile guards.

◆ feed()

DocumentHighlightResult portals::DocumentHighlighter::feed ( std::span< const DecodedScalar > input,
std::span< TokenRun > output,
bool endOfInput = false )
noexcept

Process a bounded step; retry with unconsumed input and persistent EOF assertion.

Parameters
inputConsecutive decoded scalars borrowed only for this call.
outputCaller-owned storage borrowed only for this call; zero capacity can yield OUTPUT_FULL without progress and must be enlarged before retrying.
endOfInputTrue only when the supplied suffix ends at confirmed source EOF.
Returns
Committed input/output counts and stop reason. Errors do not consume their triggering scalar; earlier committed progress remains valid. Pending keyword or delimiter bytes may be emitted by a later call. Adjacent equal runs may coalesce.

◆ nextByteOffset()

std::uint64_t portals::DocumentHighlighter::nextByteOffset ( ) const
noexcept

Inspect the exact scalar admission boundary.

Returns
Required byte offset of the next input scalar, not a fully colored frontier.

The documentation for this class was generated from the following file: