From 734f4452dd9c54504518c1099187abd9256bccb2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 23 Apr 2024 14:52:36 +0000 Subject: [PATCH] Rename fields in 'select_value' This aligns with upstream, and makes more sense given their usage. --- grammar.js | 4 ++-- src/grammar.json | 4 ++-- src/node-types.json | 4 ++-- src/parser.c | 56 ++++++++++++++++++++++++--------------------- 4 files changed, 36 insertions(+), 32 deletions(-) diff --git a/grammar.js b/grammar.js index 497b8f7..ad43ec2 100644 --- a/grammar.js +++ b/grammar.js @@ -128,9 +128,9 @@ module.exports = grammar({ ), select_value: ($) => seq( - field("type", alias($.identifier, $.selection_type)), + field("name", alias($.identifier, $.selection_type)), "(", - field("condition", optional(commaSeparated($._string_literal))), + field("arguments", optional(commaSeparated($._string_literal))), ")", ), diff --git a/src/grammar.json b/src/grammar.json index c16b22d..3651dc7 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -491,7 +491,7 @@ "members": [ { "type": "FIELD", - "name": "type", + "name": "name", "content": { "type": "ALIAS", "content": { @@ -508,7 +508,7 @@ }, { "type": "FIELD", - "name": "condition", + "name": "arguments", "content": { "type": "CHOICE", "members": [ diff --git a/src/node-types.json b/src/node-types.json index 3e59430..cab1db6 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -453,7 +453,7 @@ "type": "select_value", "named": true, "fields": { - "condition": { + "arguments": { "multiple": true, "required": false, "types": [ @@ -471,7 +471,7 @@ } ] }, - "type": { + "name": { "multiple": false, "required": true, "types": [ diff --git a/src/parser.c b/src/parser.c index 02a91a2..34eedda 100644 --- a/src/parser.c +++ b/src/parser.c @@ -11,7 +11,7 @@ #define ALIAS_COUNT 1 #define TOKEN_COUNT 30 #define EXTERNAL_TOKEN_COUNT 0 -#define FIELD_COUNT 10 +#define FIELD_COUNT 11 #define MAX_ALIAS_SEQUENCE_LENGTH 6 #define PRODUCTION_ID_COUNT 19 @@ -447,24 +447,26 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { }; enum ts_field_identifiers { - field_condition = 1, + field_arguments = 1, field_element = 2, field_field = 3, field_left = 4, - field_operator = 5, - field_pattern = 6, - field_property = 7, - field_right = 8, - field_type = 9, - field_value = 10, + field_name = 5, + field_operator = 6, + field_pattern = 7, + field_property = 8, + field_right = 9, + field_type = 10, + field_value = 11, }; static const char * const ts_field_names[] = { [0] = NULL, - [field_condition] = "condition", + [field_arguments] = "arguments", [field_element] = "element", [field_field] = "field", [field_left] = "left", + [field_name] = "name", [field_operator] = "operator", [field_pattern] = "pattern", [field_property] = "property", @@ -487,11 +489,11 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [11] = {.index = 23, .length = 4}, [12] = {.index = 27, .length = 2}, [13] = {.index = 29, .length = 2}, - [14] = {.index = 5, .length = 1}, - [15] = {.index = 31, .length = 2}, - [16] = {.index = 33, .length = 3}, - [17] = {.index = 36, .length = 4}, - [18] = {.index = 40, .length = 2}, + [14] = {.index = 31, .length = 1}, + [15] = {.index = 32, .length = 2}, + [16] = {.index = 34, .length = 3}, + [17] = {.index = 37, .length = 4}, + [18] = {.index = 41, .length = 2}, }; static const TSFieldMapEntry ts_field_map_entries[] = { @@ -539,18 +541,20 @@ static const TSFieldMapEntry ts_field_map_entries[] = { {field_element, 0, .inherited = true}, {field_element, 1, .inherited = true}, [31] = - {field_condition, 2}, - {field_type, 0}, - [33] = - {field_condition, 2}, - {field_condition, 3}, - {field_type, 0}, - [36] = - {field_condition, 2}, - {field_condition, 3}, - {field_condition, 4}, - {field_type, 0}, - [40] = + {field_name, 0}, + [32] = + {field_arguments, 2}, + {field_name, 0}, + [34] = + {field_arguments, 2}, + {field_arguments, 3}, + {field_name, 0}, + [37] = + {field_arguments, 2}, + {field_arguments, 3}, + {field_arguments, 4}, + {field_name, 0}, + [41] = {field_pattern, 0}, {field_value, 2}, };