// SPDX-License-Identifier: MIT // Part of pi-steering. /** * Inline override-comment detection for the v2 evaluator. * * Ported verbatim from the v1 evaluator's `extractOverride` (see * `../../evaluator.ts`). Syntax and behaviour match exactly so the * extension runtime can swap from v1 to v2 without users rewriting * their override comments. See the v1 evaluator's JSDoc for the full * syntax grammar. * * Exposed as a standalone module so the evaluator and its tests can * assert override detection independently of the rest of the pipeline. */ /** * Global-flag regex matching every override comment in a text blob. * * leader: `#`, `//`, `/*`, ``, or end of line */ const OVERRIDE_RE = /(?:#|\/\/|\/\*||$)/gm; /** * Shorter marker-only regex used to detect when the lazy reason capture * in {@link OVERRIDE_RE} swallowed a subsequent override marker. When the * scanner finds one, it trims the reason at the marker and rewinds so * the next iteration parses the subsequent override cleanly. */ const OVERRIDE_MARKER_RE = /(?:#|\/\/|\/\*|