[libc][regex] Add POSIX character classes and shorthands (#234991)
POSIX ERE character class expressions like [:alpha:] and [:digit:] allow
portable character classifications inside bracket expressions, while
common escape shorthands (\d, \D, \s, \S, \w, \W) provide concise
alternatives for character classes. In POSIX regular expressions,
character classes inside brackets must correctly reject unknown class
names with REG_ECTYPE, reject range endpoints involving classes with
REG_ERANGE, and integrate with negated bracket sets and REG_NEWLINE.
Add regex_charclass.h containing lookup_posix_class to map all 12 POSIX
classes (alnum, alpha, blank, cntrl, digit, graph, lower, print, punct,
space, upper, xdigit) to constexpr 256-bit bitsets in the POSIX/C
locale. Support operator|= in bitset.h for bitset composition. In
parse_bracket_expr, recognize [:name:] sequences, enforce REG_ECTYPE on
invalid names, reject class endpoints with REG_ERANGE, and reserve word
boundary anchors [[:<:]] and [[:>:]] with REG_BADPAT until word anchor
support lands. Support shorthands \d, \D, \s, \S, \w, and \W in
parse_quantified_atom, clearing newlines on negated shorthands when
REG_NEWLINE is set.
External compliance suites: Henry Spencer suite passes 126/456 (+10)
boolean/error cases and 55/456 (+9) full-position cases; AT&T testregex
passes 74/400 (+3) ERE boolean/error cases and 76/473 (+5) overall
boolean/error cases with 0 regressions.
Assisted-by: Automated tooling, human reviewed.