Skip to main content

patcompstart

Function patcompstart 

Source
pub fn patcompstart()
Expand description

Port of patcompstart() from Src/pattern.c:517.

Resets per-compile globals. Called at the start of patcompile.

C body (c:517-526) — strict order matters:

  1. patcompcharsset() — must run FIRST so the zpc_special table reflects the current option state before parsing.
  2. patglobflags = isset(CASEGLOB) || isset(CASEPATHS) ? 0 : GF_IGNCASE; — case-insensitivity is the default UNLESS one of the case-sensitive options is set.
  3. if (isset(MULTIBYTE)) patglobflags |= GF_MULTIBYTE; — multibyte handling is option-gated, NOT unconditional.

The previous Rust port had three divergences: (a) called patcompcharsset LAST instead of FIRST, (b) unconditionally set GF_MULTIBYTE even when setopt nomultibyte, (c) NEVER set GF_IGNCASE — setopt nocaseglob had zero effect on pattern case-folding.