diff --git a/src/grammar.json b/src/grammar.json index 24d006e2e..fec220814 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -476,24 +476,54 @@ { "type": "SEQ", "members": [ + { + "type": "STRING", + "value": "type" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "type_identifier" + } + }, { "type": "CHOICE", "members": [ { - "type": "STRING", - "value": "type" + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "as" + }, + { + "type": "FIELD", + "name": "alias", + "content": { + "type": "SYMBOL", + "name": "type_identifier" + } + } + ] }, { "type": "BLANK" } ] - }, + } + ] + }, + { + "type": "SEQ", + "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", - "name": "type_identifier" + "name": "constructor_name" } }, { @@ -511,7 +541,7 @@ "name": "alias", "content": { "type": "SYMBOL", - "name": "type_identifier" + "name": "constructor_name" } } ] diff --git a/src/node-types.json b/src/node-types.json index 71abfc294..fd79e8f33 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -4693,6 +4693,10 @@ "multiple": false, "required": false, "types": [ + { + "type": "constructor_name", + "named": true + }, { "type": "identifier", "named": true @@ -4707,6 +4711,10 @@ "multiple": false, "required": true, "types": [ + { + "type": "constructor_name", + "named": true + }, { "type": "identifier", "named": true diff --git a/src/parser.c b/src/parser.c index 4aad481de..5bedd6348 100644 --- a/src/parser.c +++ b/src/parser.c @@ -73321,7 +73321,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2936), 1, anon_sym_RBRACE, @@ -73330,7 +73330,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, STATE(1631), 1, sym_unqualified_import, ACTIONS(5), 2, @@ -73380,7 +73380,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, @@ -73389,7 +73389,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, STATE(1631), 1, sym_unqualified_import, ACTIONS(5), 2, @@ -73438,7 +73438,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, @@ -73447,7 +73447,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, STATE(1631), 1, sym_unqualified_import, ACTIONS(5), 2, @@ -73510,7 +73510,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, @@ -73519,7 +73519,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, STATE(1631), 1, sym_unqualified_import, ACTIONS(5), 2, @@ -73568,7 +73568,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, @@ -73579,7 +73579,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, ACTIONS(5), 2, sym_statement_comment, sym_comment, @@ -73588,7 +73588,7 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, @@ -73599,7 +73599,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, ACTIONS(5), 2, sym_statement_comment, sym_comment, @@ -73608,14 +73608,14 @@ static const uint16_t ts_small_parse_table[] = { sym_module_comment, ACTIONS(99), 1, sym__name, - ACTIONS(2723), 1, + ACTIONS(101), 1, sym__upname, ACTIONS(2938), 1, anon_sym_type, STATE(1588), 1, sym_identifier, STATE(1589), 1, - sym_type_identifier, + sym_constructor_name, STATE(1631), 1, sym_unqualified_import, ACTIONS(5), 2, @@ -78302,10 +78302,10 @@ static const uint16_t ts_small_parse_table[] = { [87462] = 4, ACTIONS(3), 1, sym_module_comment, - ACTIONS(2723), 1, + ACTIONS(451), 1, sym__upname, STATE(1740), 1, - sym_type_identifier, + sym_constructor_name, ACTIONS(5), 2, sym_statement_comment, sym_comment,