Merge pull request #2401 from amaanq/fix-inline-bug

fix: disallow inlining the first rule
This commit is contained in:
Amaan Qureshi 2023-07-19 17:04:17 -04:00 committed by GitHub
commit fc1514d0cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,6 +203,12 @@ pub(super) fn process_inlines(
lexical_grammar.variables[symbol.index].name,
))
}
SymbolType::NonTerminal if symbol.index == 0 => {
return Err(anyhow!(
"Rule `{}` cannot be inlined because it is the first rule",
grammar.variables[symbol.index].name,
))
}
_ => {}
}
}