Skip to content

Commit 7ff26da

Browse files
maxbrunsfeldsmitbarmaseamaanq
committed
feat: simplify try statement by accepting missing else/except/finally blocks
Co-authored-by: Smit Barmase <[email protected]> Co-authored-by: Amaan Qureshi <[email protected]>
1 parent afdba00 commit 7ff26da

File tree

4 files changed

+56422
-56849
lines changed

4 files changed

+56422
-56849
lines changed

grammar.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,9 @@ module.exports = grammar({
354354
'try',
355355
':',
356356
field('body', $._suite),
357-
choice(
358-
seq(
359-
repeat1($.except_clause),
360-
optional($.else_clause),
361-
optional($.finally_clause),
362-
),
363-
seq(
364-
repeat1($.except_group_clause),
365-
optional($.else_clause),
366-
optional($.finally_clause),
367-
),
368-
$.finally_clause,
369-
),
357+
repeat(choice($.except_clause, $.except_group_clause)),
358+
optional($.else_clause),
359+
optional($.finally_clause),
370360
),
371361

372362
except_clause: $ => seq(

src/grammar.json

Lines changed: 28 additions & 69 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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)