From c433a87670bd0fdd66691bee8c8e1dddc287d07c Mon Sep 17 00:00:00 2001 From: beeb <703631+beeb@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:41:58 +0100 Subject: [PATCH] fix: typo in event_parameter --- grammar.js | 4 ++-- queries/highlights.scm | 6 ++--- src/grammar.json | 7 +++--- src/node-types.json | 4 ++-- src/parser.c | 24 +++++++++---------- test/corpus/event.txt | 10 ++++---- .../tree_sitter_solidity/typed_parser.py | 8 +++---- 7 files changed, 32 insertions(+), 31 deletions(-) diff --git a/grammar.js b/grammar.js index 2888b5d..c843a1e 100644 --- a/grammar.js +++ b/grammar.js @@ -276,11 +276,11 @@ module.exports = grammar({ _event_parameter_list: $ => seq( "(", - commaSep($.event_paramater), + commaSep($.event_parameter), ")" ), - event_paramater: $ => seq( + event_parameter: $ => seq( field("type", $.type_name), optional("indexed"), optional(field("name", $.identifier)), diff --git a/queries/highlights.scm b/queries/highlights.scm index 69c167b..4db59d3 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -77,7 +77,7 @@ ; Function parameters (call_struct_argument name: (identifier) @field) -(event_paramater name: (identifier) @parameter) +(event_parameter name: (identifier) @parameter) (parameter name: (identifier) @variable.parameter) ; Yul functions @@ -159,7 +159,7 @@ (import_directive "as" @include) (import_directive "from" @include) -(event_paramater "indexed" @keyword) +(event_parameter "indexed" @keyword) ; Punctuation @@ -214,4 +214,4 @@ [ "delete" "new" -] @keyword.operator \ No newline at end of file +] @keyword.operator diff --git a/src/grammar.json b/src/grammar.json index 2b85918..c6fa4f1 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1085,7 +1085,7 @@ "members": [ { "type": "SYMBOL", - "name": "event_paramater" + "name": "event_parameter" }, { "type": "REPEAT", @@ -1098,7 +1098,7 @@ }, { "type": "SYMBOL", - "name": "event_paramater" + "name": "event_parameter" } ] } @@ -1128,7 +1128,7 @@ } ] }, - "event_paramater": { + "event_parameter": { "type": "SEQ", "members": [ { @@ -7082,3 +7082,4 @@ "inline": [], "supertypes": [] } + diff --git a/src/node-types.json b/src/node-types.json index 1f1be32..9e07b0f 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -2267,14 +2267,14 @@ "required": false, "types": [ { - "type": "event_paramater", + "type": "event_parameter", "named": true } ] } }, { - "type": "event_paramater", + "type": "event_parameter", "named": true, "fields": { "name": { diff --git a/src/parser.c b/src/parser.c index cce2fb4..76b0b68 100644 --- a/src/parser.c +++ b/src/parser.c @@ -371,7 +371,7 @@ enum ts_symbol_identifiers { sym_enum_declaration = 352, sym_event_definition = 353, sym__event_parameter_list = 354, - sym_event_paramater = 355, + sym_event_parameter = 355, sym_using_directive = 356, sym_any_source_type = 357, sym__statement = 358, @@ -886,7 +886,7 @@ static const char * const ts_symbol_names[] = { [sym_enum_declaration] = "enum_declaration", [sym_event_definition] = "event_definition", [sym__event_parameter_list] = "_event_parameter_list", - [sym_event_paramater] = "event_paramater", + [sym_event_parameter] = "event_parameter", [sym_using_directive] = "using_directive", [sym_any_source_type] = "any_source_type", [sym__statement] = "_statement", @@ -1401,7 +1401,7 @@ static const TSSymbol ts_symbol_map[] = { [sym_enum_declaration] = sym_enum_declaration, [sym_event_definition] = sym_event_definition, [sym__event_parameter_list] = sym__event_parameter_list, - [sym_event_paramater] = sym_event_paramater, + [sym_event_parameter] = sym_event_parameter, [sym_using_directive] = sym_using_directive, [sym_any_source_type] = sym_any_source_type, [sym__statement] = sym__statement, @@ -2981,7 +2981,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, - [sym_event_paramater] = { + [sym_event_parameter] = { .visible = true, .named = true, }, @@ -29137,7 +29137,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_comment] = ACTIONS(3), }, [117] = { - [sym_event_paramater] = STATE(660), + [sym_event_parameter] = STATE(660), [sym_type_name] = STATE(483), [sym__array_type] = STATE(313), [sym__function_type] = STATE(315), @@ -29393,7 +29393,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_comment] = ACTIONS(3), }, [119] = { - [sym_event_paramater] = STATE(660), + [sym_event_parameter] = STATE(660), [sym_type_name] = STATE(483), [sym__array_type] = STATE(313), [sym__function_type] = STATE(315), @@ -30033,7 +30033,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_comment] = ACTIONS(3), }, [124] = { - [sym_event_paramater] = STATE(578), + [sym_event_parameter] = STATE(578), [sym_type_name] = STATE(483), [sym__array_type] = STATE(313), [sym__function_type] = STATE(315), @@ -30417,7 +30417,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_comment] = ACTIONS(3), }, [127] = { - [sym_event_paramater] = STATE(660), + [sym_event_parameter] = STATE(660), [sym_type_name] = STATE(483), [sym__array_type] = STATE(313), [sym__function_type] = STATE(315), @@ -61906,7 +61906,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [1983] = {.entry = {.count = 1, .reusable = false}}, SHIFT(480), [1985] = {.entry = {.count = 1, .reusable = true}}, SHIFT(480), [1987] = {.entry = {.count = 1, .reusable = false}}, SHIFT(670), - [1989] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_paramater, 1, .production_id = 14), + [1989] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_parameter, 1, .production_id = 14), [1991] = {.entry = {.count = 1, .reusable = false}}, SHIFT(549), [1993] = {.entry = {.count = 1, .reusable = false}}, SHIFT(481), [1995] = {.entry = {.count = 1, .reusable = true}}, SHIFT(481), @@ -61987,7 +61987,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [2150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(760), [2152] = {.entry = {.count = 1, .reusable = true}}, SHIFT(117), [2154] = {.entry = {.count = 1, .reusable = true}}, SHIFT(656), - [2156] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_paramater, 2, .production_id = 14), + [2156] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_parameter, 2, .production_id = 14), [2158] = {.entry = {.count = 1, .reusable = true}}, SHIFT(112), [2160] = {.entry = {.count = 1, .reusable = true}}, SHIFT(304), [2162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(501), @@ -62101,7 +62101,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [2392] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__return_parameters_repeat1, 2, .production_id = 56), [2394] = {.entry = {.count = 1, .reusable = false}}, SHIFT(735), [2396] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_call_argument, 3), - [2398] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_paramater, 3, .production_id = 67), + [2398] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_parameter, 3, .production_id = 67), [2400] = {.entry = {.count = 1, .reusable = true}}, SHIFT(801), [2402] = {.entry = {.count = 1, .reusable = true}}, SHIFT(384), [2404] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_call_argument, 5), @@ -62111,7 +62111,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [2412] = {.entry = {.count = 1, .reusable = true}}, SHIFT(544), [2414] = {.entry = {.count = 1, .reusable = true}}, SHIFT(142), [2416] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__event_parameter_list, 3), - [2418] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_paramater, 2, .production_id = 24), + [2418] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_event_parameter, 2, .production_id = 24), [2420] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_return_type_definition, 2), [2422] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), [2424] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), diff --git a/test/corpus/event.txt b/test/corpus/event.txt index aa81b71..2fa8328 100644 --- a/test/corpus/event.txt +++ b/test/corpus/event.txt @@ -49,7 +49,7 @@ contract Example { body: (contract_body (event_definition name: (identifier) - (event_paramater type: (type_name (primitive_type))))))) + (event_parameter type: (type_name (primitive_type))))))) ==================== Event parameters @@ -68,14 +68,14 @@ contract Example { (event_definition name: (identifier) - (event_paramater type: (type_name (primitive_type))) + (event_parameter type: (type_name (primitive_type))) - (event_paramater + (event_parameter type: (type_name (primitive_type)) name: (identifier)) - (event_paramater type: (type_name (primitive_type))) + (event_parameter type: (type_name (primitive_type))) - (event_paramater + (event_parameter type: (type_name (primitive_type)) name: (identifier)))))) diff --git a/typed-libraries/python/tree_sitter_solidity/typed_parser.py b/typed-libraries/python/tree_sitter_solidity/typed_parser.py index 3255120..601a5a6 100644 --- a/typed-libraries/python/tree_sitter_solidity/typed_parser.py +++ b/typed-libraries/python/tree_sitter_solidity/typed_parser.py @@ -277,9 +277,9 @@ class ErrorParameter(TreeSitterNode): class EventDefinition(TreeSitterNode): field_names = ['name'] name: 'Identifier' - children: Optional[List['EventParamater']] + children: Optional[List['EventParameter']] -class EventParamater(TreeSitterNode): +class EventParameter(TreeSitterNode): field_names = ['name', 'type'] name: Optional['Identifier'] type: 'TypeName' @@ -956,8 +956,8 @@ class YulLeave(TreeSitterNode): ContractDeclaration, 'do_while_statement': DoWhileStatement, 'emit_statement': EmitStatement, 'enum_declaration': EnumDeclaration, 'error_declaration': ErrorDeclaration, 'error_parameter': - ErrorParameter, 'event_definition': EventDefinition, 'event_paramater': - EventParamater, 'expression_statement': ExpressionStatement, + ErrorParameter, 'event_definition': EventDefinition, 'event_parameter': + EventParameter, 'expression_statement': ExpressionStatement, 'fallback_receive_definition': FallbackReceiveDefinition, 'false': False, 'for_statement': ForStatement, 'function_body': FunctionBody, 'function_definition': FunctionDefinition, 'hex_string_literal':