From 3bc77aab19f14750252aa353091c47e26bb35e4b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 23 Apr 2024 14:56:10 +0000 Subject: [PATCH] Remove 'selection_type' alias --- grammar.js | 2 +- queries/highlights.scm | 3 ++- src/grammar.json | 9 ++------- src/node-types.json | 6 +----- src/parser.c | 21 +-------------------- test/corpus/select.txt | 16 ++++++++-------- 6 files changed, 15 insertions(+), 42 deletions(-) diff --git a/grammar.js b/grammar.js index ad43ec2..c108823 100644 --- a/grammar.js +++ b/grammar.js @@ -128,7 +128,7 @@ module.exports = grammar({ ), select_value: ($) => seq( - field("name", alias($.identifier, $.selection_type)), + field("name", $.identifier), "(", field("arguments", optional(commaSeparated($._string_literal))), ")", diff --git a/queries/highlights.scm b/queries/highlights.scm index 4209180..13cdcde 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -51,7 +51,8 @@ (unset) (default) ] @variable.builtin -(selection_type) @function.builtin +(select_value + name: (identifier) @function.builtin) ; }}} ; Expressions {{{ diff --git a/src/grammar.json b/src/grammar.json index 3651dc7..3c81287 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -493,13 +493,8 @@ "type": "FIELD", "name": "name", "content": { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "identifier" - }, - "named": true, - "value": "selection_type" + "type": "SYMBOL", + "name": "identifier" } }, { diff --git a/src/node-types.json b/src/node-types.json index cab1db6..3719f90 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -476,7 +476,7 @@ "required": true, "types": [ { - "type": "selection_type", + "type": "identifier", "named": true } ] @@ -578,10 +578,6 @@ "type": "select", "named": false }, - { - "type": "selection_type", - "named": true - }, { "type": "true", "named": false diff --git a/src/parser.c b/src/parser.c index 34eedda..af1eb6c 100644 --- a/src/parser.c +++ b/src/parser.c @@ -8,7 +8,7 @@ #define STATE_COUNT 117 #define LARGE_STATE_COUNT 2 #define SYMBOL_COUNT 59 -#define ALIAS_COUNT 1 +#define ALIAS_COUNT 0 #define TOKEN_COUNT 30 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 11 @@ -74,7 +74,6 @@ enum ts_symbol_identifiers { aux_sym_select_value_repeat1 = 56, aux_sym_select_cases_repeat1 = 57, aux_sym_list_expression_repeat1 = 58, - alias_sym_selection_type = 59, }; static const char * const ts_symbol_names[] = { @@ -137,7 +136,6 @@ static const char * const ts_symbol_names[] = { [aux_sym_select_value_repeat1] = "select_value_repeat1", [aux_sym_select_cases_repeat1] = "select_cases_repeat1", [aux_sym_list_expression_repeat1] = "list_expression_repeat1", - [alias_sym_selection_type] = "selection_type", }; static const TSSymbol ts_symbol_map[] = { @@ -200,7 +198,6 @@ static const TSSymbol ts_symbol_map[] = { [aux_sym_select_value_repeat1] = aux_sym_select_value_repeat1, [aux_sym_select_cases_repeat1] = aux_sym_select_cases_repeat1, [aux_sym_list_expression_repeat1] = aux_sym_list_expression_repeat1, - [alias_sym_selection_type] = alias_sym_selection_type, }; static const TSSymbolMetadata ts_symbol_metadata[] = { @@ -440,10 +437,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = false, }, - [alias_sym_selection_type] = { - .visible = true, - .named = true, - }, }; enum ts_field_identifiers { @@ -564,18 +557,6 @@ static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE [2] = { [1] = anon_sym_PLUS_EQ, }, - [14] = { - [0] = alias_sym_selection_type, - }, - [15] = { - [0] = alias_sym_selection_type, - }, - [16] = { - [0] = alias_sym_selection_type, - }, - [17] = { - [0] = alias_sym_selection_type, - }, }; static const uint16_t ts_non_terminal_alias_map[] = { diff --git a/test/corpus/select.txt b/test/corpus/select.txt index b928e6c..7563e96 100644 --- a/test/corpus/select.txt +++ b/test/corpus/select.txt @@ -15,7 +15,7 @@ foo = select(release_variable("RELEASE_TEST"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal)) (select_cases (select_case @@ -42,7 +42,7 @@ foo = select(soong_config_variable("my_namespace", "my_var"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal) (interpreted_string_literal)) (select_cases @@ -72,7 +72,7 @@ foo = select(variant("arch"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal)) (select_cases (select_case @@ -102,7 +102,7 @@ foo = select(variant("VARIANT"), {}) (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal)) (select_cases)))) @@ -126,7 +126,7 @@ foo = select(variant("VARIANT"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal)) (select_cases (select_case @@ -162,7 +162,7 @@ foo = select(variant(), { (operator) (select_expression (select_value - (selection_type)) + (identifier)) (select_cases (select_case (interpreted_string_literal) @@ -188,7 +188,7 @@ foo = select(some_unknown_type("CONDITION"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal)) (select_cases (select_case @@ -215,7 +215,7 @@ foo = select(release_variable("ONE", "TWO"), { (operator) (select_expression (select_value - (selection_type) + (identifier) (interpreted_string_literal) (interpreted_string_literal)) (select_cases