The `(?:(?:static|const|extern|register|volatile)\s+)*` modifier loop: greedy positions after 0..=k iterations, for the k-descending backtrack the INIT/ARRAY skeletons need. No two alternatives share a prefix, so at most one literal can match at a position; an alternative that matches without trailing `\s+` ends the loop (JS: iteration fails, no other alt can fire).
(s: &[u8], start: usize)
| 504 | /// INIT/ARRAY skeletons need. No two alternatives share a prefix, so at most |
| 505 | /// one literal can match at a position; an alternative that matches without |
| 506 | /// trailing `\s+` ends the loop (JS: iteration fails, no other alt can fire). |
| 507 | fn modifier_positions(s: &[u8], start: usize) -> Vec<usize> { |
| 508 | let mut stack = vec![start]; |
| 509 | loop { |
| 510 | let cur = *stack.last().unwrap(); |
| 511 | let mut advanced = None; |
| 512 | for m in MODIFIERS { |
| 513 | if s.len() >= cur + m.len() && &s[cur..cur + m.len()] == m { |
| 514 | let e = cur + m.len(); |
| 515 | let w = skip_jsws(s, e); |
| 516 | if w > e { |
| 517 | advanced = Some(w); |
| 518 | } |
| 519 | break; // exactly one alternative can literal-match here |
| 520 | } |
| 521 | } |
| 522 | match advanced { |
| 523 | Some(w) => stack.push(w), |
| 524 | None => return stack, |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | /// `\[[^\]]*\]` at `i` (the INIT/ARRAY declarator form — the class admits |
no test coverage detected