support attributes without arguments (i.e. `@internal`) (#84)

pull/844/head
Alex Manning 2024-04-23 11:22:39 +07:00 committed by GitHub
parent bcf9c45b56
commit e7f5d6ea39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

@ -62,7 +62,7 @@ module.exports = grammar({
seq( seq(
"@", "@",
field("name", $.identifier), field("name", $.identifier),
field("arguments", alias($._attribute_arguments, $.arguments)) optional(field("arguments", alias($._attribute_arguments, $.arguments)))
), ),
_attribute_arguments: ($) => _attribute_arguments: ($) =>

@ -46,3 +46,22 @@ pub fn wibble() { todo }
parameters: (function_parameters) parameters: (function_parameters)
body: (function_body body: (function_body
(todo)))) (todo))))
================================================================================
Attribute without arguments
================================================================================
@internal
pub fn wibble() { todo }
--------------------------------------------------------------------------------
(source_file
(attribute
name: (identifier))
(function
(visibility_modifier)
name: (identifier)
parameters: (function_parameters)
body: (function_body
(todo))))