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)
| 493 | /// INIT/ARRAY skeletons need. No two alternatives share a prefix, so at most |
| 494 | /// one literal can match at a position; an alternative that matches without |
| 495 | /// trailing `\s+` ends the loop (JS: iteration fails, no other alt can fire). |
| 496 | fn modifier_positions(s: &[u8], start: usize) -> Vec<usize> { |
| 497 | let mut stack = vec![start]; |
| 498 | loop { |
| 499 | let cur = *stack.last().unwrap(); |
| 500 | let mut advanced = None; |
| 501 | for m in MODIFIERS { |
| 502 | if s.len() >= cur + m.len() && &s[cur..cur + m.len()] == m { |
| 503 | let e = cur + m.len(); |
| 504 | let w = skip_jsws(s, e); |
| 505 | if w > e { |
| 506 | advanced = Some(w); |
| 507 | } |
| 508 | break; // exactly one alternative can literal-match here |
| 509 | } |
| 510 | } |
| 511 | match advanced { |
| 512 | Some(w) => stack.push(w), |
| 513 | None => return stack, |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | /// `\[[^\]]*\]` at `i` (the INIT/ARRAY declarator form — the class admits |
no test coverage detected