fix: disallow inlining the first rule
This prevents a panic when indexing symbol_ids during the generation process
This commit is contained in:
parent
1c65ca24bc
commit
5fba369c4a
1 changed files with 6 additions and 0 deletions
|
|
@ -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,
|
||||
))
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue