pub fn valid_refname(val: &str, flags: i32) -> boolExpand description
Port of valid_refname(char *val, int flags) from Src/params.c:6466. C body
validates a nameref target name. Two paths:
- PM_UPPER (
typeset -nu): reject digit-leader (positional refs would loop) and the literalargv/ARGCnames. - non-PM_UPPER: positional digit-leader is permitted (must be
all-digits before any
[); otherwise scan viaitype_end(INAMESPC). Either path then accepts the trailing one-char specials! ? $ - _and an optional[subscript]tail. Returns 1 on valid, 0 otherwise. The Rust port follows the same control flow withis_ascii_digit/is_alphabeticstanding in foridigit/itype_end.