INIT_RE body after the anchor: `\s*(?:MOD\s+)*(?:struct\s+)?(\w+)\s+(\w+)\s*(\[[^\]]*\])?\s*=\s*\{` Backtracks: modifier count (desc), `struct` with/without, bracket with/without — exactly the observable dimensions of the JS engine.
(s: &[u8], p: usize)
| 566 | /// `\s*(?:MOD\s+)*(?:struct\s+)?(\w+)\s+(\w+)\s*(\[[^\]]*\])?\s*=\s*\{` |
| 567 | /// Backtracks: modifier count (desc), `struct` with/without, bracket |
| 568 | /// with/without — exactly the observable dimensions of the JS engine. |
| 569 | fn init_body(s: &[u8], p: usize) -> Option<(String, usize)> { |
| 570 | let i = skip_jsws(s, p); |
| 571 | let mods = modifier_positions(s, i); |
| 572 | for &pos in mods.iter().rev() { |
| 573 | for with_struct in [true, false] { |
| 574 | let q = if with_struct { |
| 575 | if s.len() >= pos + 6 && &s[pos..pos + 6] == b"struct" { |
| 576 | let e = pos + 6; |
| 577 | let w = skip_jsws(s, e); |
| 578 | if w == e { |
| 579 | continue; |
| 580 | } |
| 581 | w |
| 582 | } else { |
| 583 | continue; |
| 584 | } |
| 585 | } else { |
| 586 | pos |
| 587 | }; |
| 588 | if !is_word_at(s, q) { |
| 589 | continue; |
| 590 | } |
| 591 | let te = word_end(s, q); |
| 592 | let w = skip_jsws(s, te); |
| 593 | if w == te { |
| 594 | continue; // \s+ needs ≥1 |
| 595 | } |
| 596 | if !is_word_at(s, w) { |
| 597 | continue; |
| 598 | } |
| 599 | let ne = word_end(s, w); |
| 600 | let r = skip_jsws(s, ne); |
| 601 | for with_bracket in [true, false] { |
| 602 | let r2 = if with_bracket { |
| 603 | match bracket_span(s, r) { |
| 604 | Some(e) => e, |
| 605 | None => continue, |
| 606 | } |
| 607 | } else { |
| 608 | r |
| 609 | }; |
| 610 | let r3 = skip_jsws(s, r2); |
| 611 | if s.get(r3) != Some(&b'=') { |
| 612 | continue; |
| 613 | } |
| 614 | let r4 = skip_jsws(s, r3 + 1); |
| 615 | if s.get(r4) != Some(&b'{') { |
| 616 | continue; |
| 617 | } |
| 618 | return Some((bytes_to_string(&s[q..te]), r4 + 1)); |
| 619 | } |
| 620 | } |
| 621 | } |
| 622 | None |
| 623 | } |
| 624 | |
| 625 | /// ARRAY_TABLE_RE body after the anchor: |
nothing calls this directly
no test coverage detected