From 62d925e1b75f808ea6dd1cff9cb9c61ea9885954 Mon Sep 17 00:00:00 2001 From: Lycs-D <139197676+Lycs-D@users.noreply.github.com> Date: Thu, 11 Jan 2024 20:49:10 +0800 Subject: [PATCH] [tree_sitter_v] fix qualified type (#8) --- tree_sitter_v/grammar.cjs | 2 +- tree_sitter_v/src/grammar.json | 26 +++++++++++++++----------- tree_sitter_v/src/parser.c | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tree_sitter_v/grammar.cjs b/tree_sitter_v/grammar.cjs index 736fed31..f80c3fde 100644 --- a/tree_sitter_v/grammar.cjs +++ b/tree_sitter_v/grammar.cjs @@ -882,7 +882,7 @@ module.exports = grammar({ seq(field("left", $._expression), "!in", field("right", $._expression)), ), - enum_fetch: ($) => seq(".", $.reference_expression), + enum_fetch: ($) => prec.dynamic(-1, seq(".", $.reference_expression)), match_expression: ($) => seq( diff --git a/tree_sitter_v/src/grammar.json b/tree_sitter_v/src/grammar.json index d63f0d69..70ea670f 100644 --- a/tree_sitter_v/src/grammar.json +++ b/tree_sitter_v/src/grammar.json @@ -4373,17 +4373,21 @@ } }, "enum_fetch": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "." - }, - { - "type": "SYMBOL", - "name": "reference_expression" - } - ] + "type": "PREC_DYNAMIC", + "value": -1, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "reference_expression" + } + ] + } }, "match_expression": { "type": "SEQ", diff --git a/tree_sitter_v/src/parser.c b/tree_sitter_v/src/parser.c index 48d17951..80fc3e89 100644 --- a/tree_sitter_v/src/parser.c +++ b/tree_sitter_v/src/parser.c @@ -305882,8 +305882,8 @@ static const TSParseActionEntry ts_parse_actions[] = { [2882] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expression_without_blocks, 1), [2884] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expression_without_blocks, 1), [2886] = {.entry = {.count = 2, .reusable = false}}, REDUCE(sym__expression_without_blocks, 1), SHIFT(4293), - [2889] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_fetch, 2), - [2891] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_enum_fetch, 2), + [2889] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_fetch, 2, .dynamic_precedence = -1), + [2891] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_enum_fetch, 2, .dynamic_precedence = -1), [2893] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expression_with_blocks, 1), [2895] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expression_with_blocks, 1), [2897] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_not_is_expression, 3, .dynamic_precedence = 2, .production_id = 29),