| 722 | } |
| 723 | |
| 724 | fn has_distributable_group(def: &Def) -> bool { |
| 725 | match def { |
| 726 | Def::Combinator(children, DefCombinatorStyle::Ordered | DefCombinatorStyle::AllMustOccur) => { |
| 727 | let extractable: Vec<_> = children.iter().filter_map(Self::extract_alternatives).collect(); |
| 728 | if extractable.is_empty() { |
| 729 | return false; |
| 730 | } |
| 731 | if extractable.len() == children.len() { |
| 732 | let first_alts = extractable[0].0; |
| 733 | if extractable.iter().all(|(alts, _)| *alts == first_alts) { |
| 734 | return false; |
| 735 | } |
| 736 | } |
| 737 | true |
| 738 | } |
| 739 | _ => false, |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | /// Returns the keyword name if `self` is a keyword-optional-prefixed ordered sequence: |
| 744 | /// either `Group(Ordered([Optional(Ident(kw)), ...]))` or a bare |