(s: &[u8])
| 430 | tags: Vec<String>, |
| 431 | } |
| 432 | |
| 433 | fn scan_inline_structs(s: &[u8]) -> InlineScan { |
| 434 | let mut out = InlineScan { ptr: false, types: Vec::new(), tags: Vec::new() }; |
| 435 | let mut last = 0; |
| 436 | while let Some(t) = find_word(s, b"struct", last) { |
| 437 | let after_kw = t + 6; |
| 438 | let ws = skip_jsws(s, after_kw); |
| 439 | if ws == after_kw || !is_word_at(s, ws) { |
| 440 | last = t + 1; |
| 441 | continue; |
| 442 | } |
| 443 | let te = word_end(s, ws); |
| 444 | let open = skip_jsws(s, te); |
| 445 | if s.get(open) != Some(&b'{') { |
| 446 | last = t + 1; |
| 447 | continue; |
| 448 | } |
| 449 | last = open + 1; // lastIndex = end of match (after `{`) |
| 450 | let Some(close) = match_brace(s, open) else { continue }; |
| 451 | // vm: /^\s*(\w+)…/ on the text after `}` — only vm[1] matters here. |
| 452 | let v = skip_jsws(s, close + 1); |
| 453 | if !is_word_at(s, v) { |
| 454 | continue; |
| 455 | } |
| 456 | push_str(&mut out.tags, &s[ws..te]); |
| 457 | for f in parse_struct_fields_raw(&s[open + 1..close]) { |
| 458 | if f.name.is_empty() { |
| 459 | continue; |
| 460 | } |
| 461 | if f.ptr { |
| 462 | out.ptr = true; |
| 463 | } else if !f.ty.is_empty() { |
| 464 | out.types.push(f.ty); |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | out |
| 469 | } |
| 470 | |
| 471 | /// matchBrace: index of the `}` matching the `{` at `open`, or None. |
no test coverage detected