Closed XenoS-ITA closed 3 weeks ago
When an empty or null array is passed peggy should take the default value, which is the first rule. Right now if you define allowedStartRules there is no method to use the first rule.
empty
null array
In the following code, if the file is a library, all rules should be added as start instead if it is not the first rule should be taken
const output = peggy.generate(fileContent, { format: "commonjs", output: "source", allowedStartRules: isLibrary ? ["*"] : [] })
Even some kind of ENUM might be fine
I'm making it so that null, undefined, and [] all get the default start rule.
null
undefined
[]
How the feature should work
When an
empty
ornull array
is passed peggy should take the default value, which is the first rule. Right now if you define allowedStartRules there is no method to use the first rule.Use case behind it
In the following code, if the file is a library, all rules should be added as start instead if it is not the first rule should be taken