Skip to content

Commit 080a5cd

Browse files
committed
Allow exprs in the source_file grammar rule
1 parent 981fda0 commit 080a5cd

File tree

8 files changed

+43712
-32013
lines changed

8 files changed

+43712
-32013
lines changed

grammar.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,21 @@ module.exports = grammar({
182182
[$._macro_def_replacement, $.replacement_guard_and, $.replacement_expr_guard],
183183
// Fun type vs regular function `fun()` vs `fun() -> ...`
184184
[$.fun_type, $.expr_args],
185+
// Introduced by the exprs choice in the source_file
186+
[$.pp_if, $._prefix_op],
187+
[$.attr_name, $._prefix_op],
188+
[$._expr, $._map_expr_base, $._record_expr_base],
189+
[$._expr, $._map_expr_base],
190+
[$._expr, $._record_expr_base],
191+
[$._function_or_macro_clause, $._macro_body_expr],
185192
],
186193

187194
rules: {
188195

189-
source_file: $ => field('forms_only', repeat($._form)),
196+
source_file: $ => choice(
197+
field('forms_only', repeat($._form)),
198+
field('exprs', repeat(seq($._expr, optional("."))))
199+
),
190200

191201
// -------------------------------------------------------------
192202

src/grammar.json

Lines changed: 70 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 19 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)