|
|
@ -62,8 +62,8 @@ module.exports = grammar({ |
|
|
[$._type_specifier, $._expression_not_binary], |
|
|
[$._type_specifier, $._expression_not_binary], |
|
|
[$._type_specifier, $._expression_not_binary, $.macro_type_specifier], |
|
|
[$._type_specifier, $._expression_not_binary, $.macro_type_specifier], |
|
|
[$._type_specifier, $.macro_type_specifier], |
|
|
[$._type_specifier, $.macro_type_specifier], |
|
|
[$._typedef_type_specifier, $.macro_type_specifier], |
|
|
|
|
|
[$.sized_type_specifier], |
|
|
[$.sized_type_specifier], |
|
|
|
|
|
[$._type_specifier, $.sized_type_specifier], |
|
|
[$.attributed_statement], |
|
|
[$.attributed_statement], |
|
|
[$._declaration_modifiers, $.attributed_statement], |
|
|
[$._declaration_modifiers, $.attributed_statement], |
|
|
[$.enum_specifier], |
|
|
[$.enum_specifier], |
|
|
@ -242,7 +242,7 @@ module.exports = grammar({ |
|
|
type_definition: $ => seq( |
|
|
type_definition: $ => seq( |
|
|
'typedef', |
|
|
'typedef', |
|
|
repeat($.type_qualifier), |
|
|
repeat($.type_qualifier), |
|
|
field('type', $._typedef_type_specifier), |
|
|
|
|
|
|
|
|
field('type', $._type_specifier), |
|
|
repeat($.type_qualifier), |
|
|
repeat($.type_qualifier), |
|
|
commaSep1(field('declarator', $._type_declarator)), |
|
|
commaSep1(field('declarator', $._type_declarator)), |
|
|
';', |
|
|
';', |
|
|
@ -358,6 +358,8 @@ module.exports = grammar({ |
|
|
alias($.array_type_declarator, $.array_declarator), |
|
|
alias($.array_type_declarator, $.array_declarator), |
|
|
alias($.parenthesized_type_declarator, $.parenthesized_declarator), |
|
|
alias($.parenthesized_type_declarator, $.parenthesized_declarator), |
|
|
$._type_identifier, |
|
|
$._type_identifier, |
|
|
|
|
|
alias(choice('signed', 'unsigned', 'long', 'short'), $.primitive_type), |
|
|
|
|
|
$.primitive_type, |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
_abstract_declarator: $ => choice( |
|
|
_abstract_declarator: $ => choice( |
|
|
@ -508,16 +510,6 @@ module.exports = grammar({ |
|
|
'noreturn', |
|
|
'noreturn', |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
_typedef_type_specifier: $ => choice( |
|
|
|
|
|
$.struct_specifier, |
|
|
|
|
|
$.union_specifier, |
|
|
|
|
|
$.enum_specifier, |
|
|
|
|
|
$.macro_type_specifier, |
|
|
|
|
|
alias($._typedef_sized_type_specifier, $.sized_type_specifier), |
|
|
|
|
|
$.primitive_type, |
|
|
|
|
|
$._type_identifier, |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
_type_specifier: $ => choice( |
|
|
_type_specifier: $ => choice( |
|
|
$.struct_specifier, |
|
|
$.struct_specifier, |
|
|
$.union_specifier, |
|
|
$.union_specifier, |
|
|
@ -528,13 +520,6 @@ module.exports = grammar({ |
|
|
$._type_identifier, |
|
|
$._type_identifier, |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
_typedef_sized_type_specifier: _ => repeat1(choice( |
|
|
|
|
|
'signed', |
|
|
|
|
|
'unsigned', |
|
|
|
|
|
'long', |
|
|
|
|
|
'short', |
|
|
|
|
|
)), |
|
|
|
|
|
|
|
|
|
|
|
sized_type_specifier: $ => seq( |
|
|
sized_type_specifier: $ => seq( |
|
|
repeat1(choice( |
|
|
repeat1(choice( |
|
|
'signed', |
|
|
'signed', |
|
|
@ -1168,7 +1153,10 @@ module.exports = grammar({ |
|
|
identifier: _ => |
|
|
identifier: _ => |
|
|
/(\p{XID_Start}|_|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})(\p{XID_Continue}|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})*/, |
|
|
/(\p{XID_Start}|_|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})(\p{XID_Continue}|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})*/, |
|
|
|
|
|
|
|
|
_type_identifier: $ => alias($.identifier, $.type_identifier), |
|
|
|
|
|
|
|
|
_type_identifier: $ => alias( |
|
|
|
|
|
$.identifier, |
|
|
|
|
|
$.type_identifier, |
|
|
|
|
|
), |
|
|
_field_identifier: $ => alias($.identifier, $.field_identifier), |
|
|
_field_identifier: $ => alias($.identifier, $.field_identifier), |
|
|
_statement_identifier: $ => alias($.identifier, $.statement_identifier), |
|
|
_statement_identifier: $ => alias($.identifier, $.statement_identifier), |
|
|
|
|
|
|
|
|
|