Closed anton-trunov closed 3 months ago
Especially the Module = Import ModuleItem, which makes imports allowed only at the top-level right in the grammar.
The change just made this restriction explicit, because before this refactoring it was later done in the parseImports
function, which can now be simplified. In a subsequent refactoring we'll most likely make imports a separate field in the module AST (this is out-of-scope for this PR)
And while we're at it, you may consider adding rule descriptions (in .ohm) to some of the rules, because they directly affect the syntax error messages produced by Ohm. Although adding them may complicate things a little, see: https://github.com/ohmjs/ohm/issues/302
Let's try to avoid "while-at-it" changes in the development process and create an issue that explains why this needs to be done and resolve it via a follow-up PR. This is especially important for refactoring PRs that need to be merged asap to not mess with other PRs that add new Tact features
and introduce some renamings to make it sound more standard
Closes #341
Incidentally, it should fix #332, because we forbid constant and function declarations everywhere except for traits.