From 2f77e1b933fd416f429481ceabaf8b999d7b2005 Mon Sep 17 00:00:00 2001 From: Amarin Phaosawasdi Date: Tue, 26 Mar 2024 19:21:56 -0700 Subject: [PATCH] refactor grammar a bit more --- .../src/semgrep-kotlin/grammar.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lang/semgrep-grammars/src/semgrep-kotlin/grammar.js b/lang/semgrep-grammars/src/semgrep-kotlin/grammar.js index a5063a88..0c3886a4 100644 --- a/lang/semgrep-grammars/src/semgrep-kotlin/grammar.js +++ b/lang/semgrep-grammars/src/semgrep-kotlin/grammar.js @@ -91,18 +91,18 @@ module.exports = grammar(standard_grammar, { // add, and the second seems to be unused. // So we just need to fix _statement. _statement: ($, previous) => choice( - previous, - $.partial_class_declaration, + ...previous.members, + $.partial_class_declaration, ), - partial_class_declaration: $ => prec.left(seq( - optional($.type_parameters), - seq(optional($.modifiers), "constructor"), - $._class_parameters, - optional(seq(":", $._delegation_specifiers)), - optional($.type_constraints), - optional($.class_body) - )), + partial_class_declaration: $ => prec.left(seq( + optional($.type_parameters), + seq(optional($.modifiers), "constructor"), + $._class_parameters, + optional(seq(":", $._delegation_specifiers)), + optional($.type_constraints), + optional($.class_body) + )), class_parameter: ($, previous) => { return choice(