diff --git a/grammar.js b/grammar.js index 47af21188..ef7fd796f 100644 --- a/grammar.js +++ b/grammar.js @@ -59,7 +59,7 @@ module.exports = grammar(C, { placeholder_type_specifier: $ => seq( field('constraint', optional($._type_specifier)), - choice($.auto, $.decltype_auto) + choice($.auto, alias($.decltype_auto, $.decltype)) ), auto: $ => 'auto', diff --git a/src/grammar.json b/src/grammar.json index 1e9e92d4c..e04541fff 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -7496,8 +7496,13 @@ "name": "auto" }, { - "type": "SYMBOL", - "name": "decltype_auto" + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "decltype_auto" + }, + "named": true, + "value": "decltype" } ] } diff --git a/src/node-types.json b/src/node-types.json index 767e44b46..8604576e4 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -1857,18 +1857,7 @@ { "type": "_expression", "named": true - } - ] - } - }, - { - "type": "decltype_auto", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ + }, { "type": "auto", "named": true @@ -3532,7 +3521,7 @@ "named": true }, { - "type": "decltype_auto", + "type": "decltype", "named": true } ] diff --git a/src/parser.c b/src/parser.c index 010c1554b..7453fde3d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -719,7 +719,7 @@ static const char * const ts_symbol_names[] = { [sym_string_literal] = "string_literal", [sym__empty_declaration] = "_empty_declaration", [sym_placeholder_type_specifier] = "placeholder_type_specifier", - [sym_decltype_auto] = "decltype_auto", + [sym_decltype_auto] = "decltype", [sym_decltype] = "decltype", [sym_class_specifier] = "class_specifier", [sym__class_name] = "_class_name", @@ -1131,7 +1131,7 @@ static const TSSymbol ts_symbol_map[] = { [sym_string_literal] = sym_string_literal, [sym__empty_declaration] = sym__empty_declaration, [sym_placeholder_type_specifier] = sym_placeholder_type_specifier, - [sym_decltype_auto] = sym_decltype_auto, + [sym_decltype_auto] = sym_decltype, [sym_decltype] = sym_decltype, [sym_class_specifier] = sym_class_specifier, [sym__class_name] = sym__class_name, diff --git a/test/corpus/concepts.txt b/test/corpus/concepts.txt index d9703f6b2..0c989ecc4 100644 --- a/test/corpus/concepts.txt +++ b/test/corpus/concepts.txt @@ -426,7 +426,7 @@ Sortable decltype(auto) foo = i(); (declaration (placeholder_type_specifier (type_identifier) - (decltype_auto + (decltype (auto))) (init_declarator (identifier)