From c9ad8a5a31e7d1bfefc6431d9c4c2346e10b7926 Mon Sep 17 00:00:00 2001 From: lightless Date: Thu, 3 Jul 2025 16:20:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20modifiers=20=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grammar.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/grammar.js b/grammar.js index a97fd9f..cbe4ef1 100644 --- a/grammar.js +++ b/grammar.js @@ -887,11 +887,13 @@ module.exports = grammar({ field('body', $.class_body), ), - modifiers: $ => repeat1(choice( - $._annotation, + visibility: $ => choice( 'public', 'protected', 'private', + ), + + _modifier: $ => choice( 'abstract', 'static', 'final', @@ -903,6 +905,12 @@ module.exports = grammar({ 'volatile', 'sealed', 'non-sealed', + ), + + modifiers: $ => repeat1(choice( + $._annotation, + $.visibility, + alias($._modifier, $.modifier), )), type_parameters: $ => seq(