Skip to content

Commit

Permalink
Add Microsoft SEH extension for exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
DennySun2020 authored and amaanq committed Oct 16, 2023
1 parent 978daf4 commit 4e48003
Show file tree
Hide file tree
Showing 5 changed files with 70,250 additions and 65,283 deletions.
24 changes: 24 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ module.exports = grammar({
$.break_statement,
$.continue_statement,
$.goto_statement,
$.seh_try_statement,
$.seh_leave_statement,
),

_top_level_statement: $ => choice(
Expand Down Expand Up @@ -823,6 +825,27 @@ module.exports = grammar({
';',
),

seh_try_statement: $ => seq(
'__try',
field('body', $.compound_statement),
choice($.seh_except_clause, $.seh_finally_clause),
),

seh_except_clause: $ => seq(
'__except',
field('filter', $.parenthesized_expression),
field('body', $.compound_statement),
),

seh_finally_clause: $ => seq(
'__finally',
field('body', $.compound_statement),
),

seh_leave_statement: _ => seq(
'__leave', ';',
),

// Expressions

_expression: $ => choice(
Expand Down Expand Up @@ -1335,3 +1358,4 @@ function commaSep(rule) {
function commaSep1(rule) {
return seq(rule, repeat(seq(',', rule)));
}

93 changes: 93 additions & 0 deletions src/grammar.json

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

109 changes: 109 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 4e48003

Please sign in to comment.