@@ -245,7 +245,7 @@ module.exports = grammar(Python, {
245245 optional ( seq ( "=" , $ . expression ) ) ,
246246 repeat ( seq (
247247 "," ,
248- optional ( $ . type_qualifier ) ,
248+ optional ( $ . type_modifier ) ,
249249 $ . identifier ,
250250 optional ( seq ( "=" , $ . expression ) ) ,
251251 ) ) ,
@@ -404,12 +404,15 @@ module.exports = grammar(Python, {
404404 alias ( seq ( "long" , "long" ) , "long long" ) ,
405405 ) ) ,
406406
407- // type: ['const'] (NAME ('.' PY_NAME)* | int_type | '(' type ')') ['complex'] [type_qualifier]
407+ type_qualifier : $ =>
408+ repeat1 ( choice ( "const" , "volatile" ) ) ,
409+
410+ // type: ['const'] (NAME ('.' PY_NAME)* | int_type | '(' type ')') ['complex'] [type_modifier]
408411 c_type : $ =>
409412 prec . right (
410413 PREC . c_type ,
411414 seq (
412- optional ( choice ( "const" , "volatile" ) ) ,
415+ optional ( $ . type_qualifier ) ,
413416 choice (
414417 seq (
415418 field ( "type" , $ . identifier ) ,
@@ -422,33 +425,33 @@ module.exports = grammar(Python, {
422425 seq ( "(" , $ . c_type , ")" ) ,
423426 ) ,
424427 optional ( "complex" ) ,
425- repeat ( $ . type_qualifier ) ,
428+ repeat ( $ . type_modifier ) ,
426429 ) ,
427430 ) ,
428431
429432 c_name : $ =>
430- seq ( optional ( $ . type_qualifier ) , $ . identifier ) ,
433+ seq ( optional ( $ . type_modifier ) , $ . identifier ) ,
431434
432435 maybe_typed_name : $ =>
433436 choice (
434437 seq (
435- optional ( choice ( "const" , "volatile" ) ) ,
438+ optional ( $ . type_qualifier ) ,
436439 field ( "type" , choice ( $ . identifier , $ . int_type ) ) ,
437440 optional ( seq (
438441 repeat ( seq (
439442 "." ,
440443 $ . identifier ,
441444 ) ) ,
442445 optional ( "complex" ) ,
443- repeat ( $ . type_qualifier ) ,
446+ repeat ( $ . type_modifier ) ,
444447 ) ) ,
445448 field ( "name" , optional ( choice ( $ . identifier , $ . operator_name , $ . c_function_pointer_name ) ) ) ,
446- repeat ( $ . type_qualifier ) ,
449+ repeat ( $ . type_modifier ) ,
447450 ) ,
448451 seq (
449- optional ( choice ( "const" , "volatile" ) ) ,
452+ optional ( $ . type_qualifier ) ,
450453 field ( "name" , choice ( $ . identifier , $ . operator_name ) ) ,
451- repeat ( $ . type_qualifier ) ,
454+ repeat ( $ . type_modifier ) ,
452455 ) ,
453456 ) ,
454457
@@ -462,10 +465,11 @@ module.exports = grammar(Python, {
462465 $ . c_parameters ,
463466 ) ,
464467
465- // type_qualifier : '*' | '**' | '&' | type_index ('.' NAME [type_index])*
466- type_qualifier : $ =>
468+ // type_modifier : '*' | '**' | '&' | type_index ('.' NAME [type_index])*
469+ type_modifier : $ =>
467470 choice (
468471 "*" ,
472+ seq ( "*" , "const" ) ,
469473 "**" ,
470474 "&" ,
471475 "__stdcall" ,
0 commit comments