Require that grammars' start rules be visible
This commit is contained in:
parent
1dca3a0b58
commit
94dc703bfc
12 changed files with 64 additions and 56 deletions
|
|
@ -109,6 +109,9 @@ pair<InternedGrammar, CompileError> intern_symbols(const InputGrammar &grammar)
|
|||
});
|
||||
}
|
||||
|
||||
if (grammar.variables[0].name[0] == '_') {
|
||||
return {result, CompileError(TSCompileErrorTypeInvalidRuleName, "A grammar's start rule must be visible.")};
|
||||
}
|
||||
|
||||
for (auto &variable : grammar.variables) {
|
||||
auto new_rule = interner.apply(variable.rule);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue