diff --git a/grammar.js b/grammar.js index 1ff2838..768a26b 100644 --- a/grammar.js +++ b/grammar.js @@ -285,7 +285,7 @@ module.exports = grammar({ array_type: ($) => seq( "array", "of", - field("element_type", $.identifier), + field("element_type", $._type_identifier), ), function_declaration: ($) => seq( diff --git a/src/grammar.json b/src/grammar.json index 11518af..a257483 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1234,7 +1234,7 @@ "name": "element_type", "content": { "type": "SYMBOL", - "name": "identifier" + "name": "_type_identifier" } } ] diff --git a/src/node-types.json b/src/node-types.json index b6918cd..cc879b3 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -180,7 +180,7 @@ "required": true, "types": [ { - "type": "identifier", + "type": "type_identifier", "named": true } ] diff --git a/src/parser.c b/src/parser.c index 8e9c799..568e118 100644 --- a/src/parser.c +++ b/src/parser.c @@ -895,6 +895,9 @@ static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE [0] = alias_sym_type_identifier, [2] = alias_sym_field_identifier, }, + [28] = { + [2] = alias_sym_type_identifier, + }, [32] = { [3] = alias_sym_type_identifier, }, diff --git a/test/corpus/declarations.txt b/test/corpus/declarations.txt index 2425d99..af2e017 100644 --- a/test/corpus/declarations.txt +++ b/test/corpus/declarations.txt @@ -93,7 +93,7 @@ type array_of_int = array of int (type_declaration name: (identifier) value: (array_type - element_type: (identifier)))) + element_type: (type_identifier)))) ================================================================================ Array type declaration non-associativity @@ -108,7 +108,7 @@ type array_of_array_of_int = array of array of int (type_declaration name: (identifier) value: (array_type - element_type: (identifier))) + element_type: (type_identifier))) (identifier)) (identifier))