diff --git a/wotw_seedgen/src/languages/logic/parser.rs b/wotw_seedgen/src/languages/logic/parser.rs index 64170a6d..6ebcc01a 100644 --- a/wotw_seedgen/src/languages/logic/parser.rs +++ b/wotw_seedgen/src/languages/logic/parser.rs @@ -636,15 +636,19 @@ fn fill_macros_and_states(contents: &mut Vec, parser: &Parser) -> R } for content in contents { - if let AreaContent::Anchor(anchor) = content { - for refill in &mut anchor.refills { - for requirement in &mut refill.requirements { - fill_group(requirement, ¯os, &states, parser)?; + match content { + AreaContent::Requirement(named_group) | AreaContent::Region(named_group) => + fill_group(&mut named_group.group, ¯os, &states, parser)?, + AreaContent::Anchor(anchor) => { + for refill in &mut anchor.refills { + for requirement in &mut refill.requirements { + fill_group(requirement, ¯os, &states, parser)?; + } } - } - for connection in &mut anchor.connections { - fill_group(&mut connection.requirements, ¯os, &states, parser)?; - } + for connection in &mut anchor.connections { + fill_group(&mut connection.requirements, ¯os, &states, parser)?; + } + }, } } @@ -666,11 +670,9 @@ fn fill_group(group: &mut Group, macros: &[&str], states: &[&str], parser: &Pars } fn fill_requirement(requirement: &mut Requirement, macros: &[&str], states: &[&str], parser: &Parser) -> Result<(), ParseError> { if let RequirementValue::State(identifier) = requirement.value { - requirement.value = if macros.contains(&identifier) { - RequirementValue::Macro(identifier) - } else if states.contains(&identifier) { - RequirementValue::State(identifier) - } else { + if macros.contains(&identifier) { + requirement.value = RequirementValue::Macro(identifier); + } else if !states.contains(&identifier) { return Err(parser.error("unknown requirement", requirement.range.clone())); }; }