Skip to content

Commit ebc8a7b

Browse files
authored
Simplify try statement, accept missing else/except/finally
2 parents 710796b + afab593 commit ebc8a7b

File tree

5 files changed

+55999
-57664
lines changed

5 files changed

+55999
-57664
lines changed

grammar.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,9 @@ module.exports = grammar({
341341
'try',
342342
':',
343343
field('body', $._suite),
344-
choice(
345-
seq(
346-
repeat1($.except_clause),
347-
optional($.else_clause),
348-
optional($.finally_clause),
349-
),
350-
seq(
351-
repeat1($.except_group_clause),
352-
optional($.else_clause),
353-
optional($.finally_clause),
354-
),
355-
$.finally_clause,
356-
),
344+
repeat(choice($.except_clause, $.except_group_clause)),
345+
optional($.else_clause),
346+
optional($.finally_clause),
357347
),
358348

359349
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)