Skip to content

Commit

Permalink
fix inside_alt that is set incorrectly for seq inside alt
Browse files Browse the repository at this point in the history
  • Loading branch information
chanheec committed Jan 7, 2025
1 parent 80ab349 commit 062bdee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xtask/src/codegen/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,16 @@ fn lower_rule(
}
lower_rule(acc, grammar, Some(l), rule, is_vst, inside_opt, inside_alt);
}
Rule::Seq(rules) | Rule::Alt(rules) => {
let inside_alt = matches!(rule, Rule::Alt(_));
Rule::Seq(rules) => {
for rule in rules {
lower_rule(acc, grammar, label, rule, is_vst, inside_opt, inside_alt);
}
}
Rule::Alt(rules) => {
for rule in rules {
lower_rule(acc, grammar, label, rule, is_vst, inside_opt, true);
}
}
Rule::Opt(rule) => lower_rule(acc, grammar, label, rule, is_vst, true, inside_alt),
}
}
Expand Down

0 comments on commit 062bdee

Please sign in to comment.