Add additional names

This commit is contained in:
Fabian Stamm 2024-10-02 00:06:44 +02:00
parent 69a6f0444e
commit 2d1d028fee
5 changed files with 58 additions and 30 deletions

View File

@ -84,7 +84,12 @@ module.exports = grammar({
),
")",
),
function_argument: ($) => seq($.identifier, ":", $.type),
function_argument: ($) =>
seq(
field("argument_identifier", $.identifier),
":",
field("argument_type", $.type),
),
pair: ($) =>
seq(

8
src/grammar.json generated
View File

@ -510,17 +510,25 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "argument_identifier",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": ":"
},
{
"type": "FIELD",
"name": "argument_type",
"content": {
"type": "SYMBOL",
"name": "type"
}
}
]
},
"pair": {

13
src/node-types.json generated
View File

@ -203,21 +203,28 @@
{
"type": "function_argument",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"argument_identifier": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
},
"argument_type": {
"multiple": false,
"required": true,
"types": [
{
"type": "type",
"named": true
}
]
}
}
},
{
"type": "function_arguments",

30
src/parser.c generated
View File

@ -11,9 +11,9 @@
#define ALIAS_COUNT 0
#define TOKEN_COUNT 28
#define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 5
#define FIELD_COUNT 7
#define MAX_ALIAS_SEQUENCE_LENGTH 5
#define PRODUCTION_ID_COUNT 5
#define PRODUCTION_ID_COUNT 6
enum ts_symbol_identifiers {
anon_sym_type = 1,
@ -468,15 +468,19 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
};
enum ts_field_identifiers {
field_key = 1,
field_name = 2,
field_parameters = 3,
field_return_type = 4,
field_value = 5,
field_argument_identifier = 1,
field_argument_type = 2,
field_key = 3,
field_name = 4,
field_parameters = 5,
field_return_type = 6,
field_value = 7,
};
static const char * const ts_field_names[] = {
[0] = NULL,
[field_argument_identifier] = "argument_identifier",
[field_argument_type] = "argument_type",
[field_key] = "key",
[field_name] = "name",
[field_parameters] = "parameters",
@ -488,7 +492,8 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
[1] = {.index = 0, .length = 2},
[2] = {.index = 2, .length = 2},
[3] = {.index = 4, .length = 2},
[4] = {.index = 6, .length = 3},
[4] = {.index = 6, .length = 2},
[5] = {.index = 8, .length = 3},
};
static const TSFieldMapEntry ts_field_map_entries[] = {
@ -502,6 +507,9 @@ static const TSFieldMapEntry ts_field_map_entries[] = {
{field_name, 1},
{field_parameters, 2},
[6] =
{field_argument_identifier, 0},
{field_argument_type, 2},
[8] =
{field_name, 0},
{field_parameters, 1},
{field_return_type, 3},
@ -2363,8 +2371,8 @@ static const TSParseActionEntry ts_parse_actions[] = {
[136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_type, 2, 0, 0),
[138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_service_notification, 4, 0, 3),
[140] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_service_notification, 4, 0, 3),
[142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_service_function, 5, 0, 4),
[144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_service_function, 5, 0, 4),
[142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_service_function, 5, 0, 5),
[144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_service_function, 5, 0, 5),
[146] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66),
[148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83),
[150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56),
@ -2406,7 +2414,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
[225] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_value_assignment, 3, 0, 0),
[227] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11),
[229] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_value, 1, 0, 0),
[231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_argument, 3, 0, 0),
[231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_argument, 3, 0, 4),
[233] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46),
[235] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54),
[237] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29),