Skip to main content

globdots

Static globdots 

Source
pub static globdots: AtomicI32
Expand description

Port of file-static int globdots from the pattrystate struct at Src/pattern.c:1890 (“Glob initial dots?”), reached through #define globdots (pattrystate.globdots) at Src/pattern.c:1903. Set once per top-level match from the program’s flags — Src/pattern.c:2494 globdots = !(patflags & PAT_NOGLD); — and forced on for the duration of an exclusion operand (Src/pattern.c:3116 globdots = 1; /* OK to match . first */, restored at Src/pattern.c:3192).

The matcher reads it in exactly two places, both guarded by P_NOTDOT — the “opcode has bit 0x40” test (Src/pattern.c:202) that marks the wildcard opcodes P_ANY/P_ANYOF/P_ANYBUT/ P_STAR/P_NUM* (Src/pattern.c:116-124): Src/pattern.c:2731 (top of the node walk) and Src/pattern.c:3322 (the closure operand). That is the whole of zsh’s “a wildcard does not match a leading dot” rule; a LITERAL dot in the pattern is unaffected because P_EXACTLY does not carry bit 0x40.