diff --git a/common/define-grammar.js b/common/define-grammar.js index 48697339..7a0e6827 100644 --- a/common/define-grammar.js +++ b/common/define-grammar.js @@ -423,10 +423,17 @@ module.exports = function defineGrammar(dialect) { ), ), - visibility_modifier: _ => choice( - keyword('public'), - keyword('protected'), - keyword('private'), + visibility_modifier: $ => seq( + choice( + keyword('public'), + keyword('protected'), + keyword('private'), + ), + optional(seq( + token.immediate('('), + alias($.name, $.operation), + token.immediate(')'), + )), ), function_definition: $ => seq( diff --git a/test/corpus/class.txt b/test/corpus/class.txt index 38f2fbe8..f00f886c 100644 --- a/test/corpus/class.txt +++ b/test/corpus/class.txt @@ -1010,3 +1010,82 @@ class User implements Named { (name)))) (name) (compound_statement))))))) + +========================================= +Asymmetric Property Visibility +========================================= + +