Skip to content

Commit

Permalink
Further shrink parser to 7734/3889
Browse files Browse the repository at this point in the history
  • Loading branch information
damieng committed Jan 6, 2025
1 parent 57741e7 commit 4e3d0e6
Show file tree
Hide file tree
Showing 3 changed files with 448,802 additions and 449,874 deletions.
25 changes: 9 additions & 16 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,7 @@ module.exports = grammar({

class_declaration: $ => seq(
$._class_declaration_initializer,
choice(
seq(field('body', $.declaration_list), $._optional_semi),
';',
),
$._declaration_list_body,
),

_class_declaration_initializer: $ => seq(
Expand All @@ -282,10 +279,7 @@ module.exports = grammar({

struct_declaration: $ => seq(
$._struct_declaration_initializer,
choice(
seq(field('body', $.declaration_list), $._optional_semi),
';',
),
$._declaration_list_body,
),

_struct_declaration_initializer: $ => seq(
Expand Down Expand Up @@ -332,10 +326,7 @@ module.exports = grammar({

interface_declaration: $ => seq(
$._interface_declaration_initializer,
choice(
seq(field('body', $.declaration_list), $._optional_semi),
';',
),
$._declaration_list_body,
),

_interface_declaration_initializer: $ => seq(
Expand Down Expand Up @@ -366,10 +357,7 @@ module.exports = grammar({

record_declaration: $ => seq(
$._record_declaration_initializer,
choice(
seq(field('body', $.declaration_list), $._optional_semi),
';',
),
$._declaration_list_body,
),

_record_declaration_initializer: $ => seq(
Expand All @@ -388,6 +376,11 @@ module.exports = grammar({
seq(':', $.primary_constructor_base_type, optional(seq(',', commaSep1($._name)))),
),

_declaration_list_body: $ => choice(
seq(field('body', $.declaration_list), $._optional_semi),
';',
),

primary_constructor_base_type: $ => seq(
field('type', $._name),
$.argument_list,
Expand Down
Loading

0 comments on commit 4e3d0e6

Please sign in to comment.