Skip to content

Commit

Permalink
fix: newline before module elements (#73)
Browse files Browse the repository at this point in the history
* fix: newline before module elements

* fix: Failing tests for newline before module elems
  • Loading branch information
KaranAhlawat authored Jul 24, 2024
1 parent d056cfd commit 331d5c9
Show file tree
Hide file tree
Showing 6 changed files with 394,478 additions and 438,278 deletions.
15 changes: 14 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,23 @@ module.exports = grammar({
optional($.access_modifier),
$.identifier,
"=",
scoped(repeat1($._module_elem), $._indent, $._dedent),
scoped($._module_body, $._indent, $._dedent),
),
),

_module_body: ($) =>
seq(
$._module_elem,
repeat(
prec(
// Make sure to parse a module node before a sequential expression
// NOTE: This removes all sequential expressions from module bodies
PREC.SEQ_EXPR + 1,
seq(alias($._newline, ";"), $._module_elem)
)
)
),

import_decl: ($) => seq("open", $.long_identifier),

//
Expand Down
41 changes: 36 additions & 5 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 331d5c9

Please sign in to comment.