(pair: Pair<'_, Rule>, is_group: &mut Option<bool>)
| 86 | } |
| 87 | |
| 88 | fn parse_reg_group_list(pair: Pair<'_, Rule>, is_group: &mut Option<bool>) -> Result<RegList> { |
| 89 | let Some(list) = pair.into_inner().next() else { |
| 90 | return Ok(RegList::Empty); |
| 91 | }; |
| 92 | Ok(match list.as_rule() { |
| 93 | Rule::reg_list => { |
| 94 | if *is_group == Some(true) { |
| 95 | Err(custom_error( |
| 96 | list.as_span(), |
| 97 | "cannot mix registers and register groups in the same class", |
| 98 | ))?; |
| 99 | } |
| 100 | *is_group = Some(false); |
| 101 | RegList::Regs(parse_entity_list(list)?.into_iter().collect()) |
| 102 | } |
| 103 | Rule::reg_group_list => { |
| 104 | if *is_group == Some(false) { |
| 105 | Err(custom_error( |
| 106 | list.as_span(), |
| 107 | "cannot mix registers and register groups in the same class", |
| 108 | ))?; |
| 109 | } |
| 110 | *is_group = Some(true); |
| 111 | RegList::Groups(parse_entity_list(list)?.into_iter().collect()) |
| 112 | } |
| 113 | _ => unreachable!(), |
| 114 | }) |
| 115 | } |
| 116 | |
| 117 | fn parse_reg_def(pair: Pair<'_, Rule>, regs: &mut PrimaryMap<PhysReg, PhysRegData>) -> Result<()> { |
| 118 | let [reg, location, kind] = extract(pair, [Rule::reg, Rule::reg_location, Rule::reg_kind]); |
no test coverage detected