Fix handling of precedence and associativity with inlining
This commit is contained in:
parent
d8f8bd288e
commit
b8dd5d2640
1 changed files with 6 additions and 3 deletions
|
|
@ -90,7 +90,6 @@ impl InlinedProductionMapBuilder {
|
|||
while i < productions_to_add.len() {
|
||||
if let Some(step) = productions_to_add[i].steps.get(step_index) {
|
||||
let symbol = step.symbol.clone();
|
||||
|
||||
if grammar.variables_to_inline.contains(&symbol) {
|
||||
// Remove the production from the vector, replacing it with a placeholder.
|
||||
let production = productions_to_add
|
||||
|
|
@ -116,8 +115,12 @@ impl InlinedProductionMapBuilder {
|
|||
}
|
||||
}
|
||||
if let Some(last_inserted_step) = inserted_steps.last_mut() {
|
||||
last_inserted_step.precedence = removed_step.precedence;
|
||||
last_inserted_step.associativity = removed_step.associativity;
|
||||
if last_inserted_step.precedence == 0 {
|
||||
last_inserted_step.precedence = removed_step.precedence;
|
||||
}
|
||||
if last_inserted_step.associativity == None {
|
||||
last_inserted_step.associativity = removed_step.associativity;
|
||||
}
|
||||
}
|
||||
production
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue