@@ -67,6 +67,7 @@ module.exports = grammar({
67
67
[ $ . enum_specifier ] ,
68
68
[ $ . _type_specifier , $ . _old_style_parameter_list ] ,
69
69
[ $ . parameter_list , $ . _old_style_parameter_list ] ,
70
+ [ $ . function_declarator , $ . _function_declaration_declarator ] ,
70
71
] ,
71
72
72
73
word : $ => $ . identifier ,
@@ -244,13 +245,15 @@ module.exports = grammar({
244
245
245
246
declaration : $ => seq (
246
247
$ . _declaration_specifiers ,
247
- $ . _declaration_declarator ,
248
+ commaSep1 ( field ( 'declarator' , choice (
249
+ seq (
250
+ $ . _declaration_declarator ,
251
+ optional ( $ . gnu_asm_expression ) ,
252
+ ) ,
253
+ $ . init_declarator ,
254
+ ) ) ) ,
248
255
';' ,
249
256
) ,
250
- _declaration_declarator : $ => commaSep1 ( field ( 'declarator' , choice (
251
- seq ( $ . _declarator , optional ( $ . gnu_asm_expression ) ) ,
252
- $ . init_declarator ,
253
- ) ) ) ,
254
257
255
258
type_definition : $ => seq (
256
259
optional ( '__extension__' ) ,
@@ -357,6 +360,15 @@ module.exports = grammar({
357
360
$ . identifier ,
358
361
) ,
359
362
363
+ _declaration_declarator : $ => choice (
364
+ $ . attributed_declarator ,
365
+ $ . pointer_declarator ,
366
+ alias ( $ . _function_declaration_declarator , $ . function_declarator ) ,
367
+ $ . array_declarator ,
368
+ $ . parenthesized_declarator ,
369
+ $ . identifier ,
370
+ ) ,
371
+
360
372
_field_declarator : $ => choice (
361
373
alias ( $ . attributed_field_declarator , $ . attributed_declarator ) ,
362
374
alias ( $ . pointer_field_declarator , $ . pointer_declarator ) ,
@@ -446,12 +458,25 @@ module.exports = grammar({
446
458
) ) ) ,
447
459
448
460
function_declarator : $ => prec . right ( 1 ,
461
+ seq (
462
+ field ( 'declarator' , $ . _declarator ) ,
463
+ field ( 'parameters' , $ . parameter_list ) ,
464
+ optional ( $ . gnu_asm_expression ) ,
465
+ repeat ( choice (
466
+ $ . attribute_specifier ,
467
+ $ . identifier ,
468
+ alias ( $ . preproc_call_expression , $ . call_expression ) ,
469
+ ) ) ,
470
+ ) ) ,
471
+
472
+ _function_declaration_declarator : $ => prec . right ( 1 ,
449
473
seq (
450
474
field ( 'declarator' , $ . _declarator ) ,
451
475
field ( 'parameters' , $ . parameter_list ) ,
452
476
optional ( $ . gnu_asm_expression ) ,
453
477
repeat ( $ . attribute_specifier ) ,
454
478
) ) ,
479
+
455
480
function_field_declarator : $ => prec ( 1 , seq (
456
481
field ( 'declarator' , $ . _field_declarator ) ,
457
482
field ( 'parameters' , $ . parameter_list ) ,
0 commit comments