Alias 'default_case' to 'select_case'

There's not much use in the node being a different name.
This commit is contained in:
Bruno BELANYI 2024-04-09 13:09:48 +01:00
parent 8db7b053f5
commit e6a2757c51
5 changed files with 17 additions and 74 deletions

View file

@ -155,7 +155,7 @@ module.exports = grammar({
"{", "{",
optional(trailingCommaSeparated($.select_case)), optional(trailingCommaSeparated($.select_case)),
// default *must* be the last one, enforced at parse-time... // default *must* be the last one, enforced at parse-time...
optional(seq($.default_case, ",")), optional(seq(alias($.default_case, $.select_case), ",")),
"}", "}",
), ),

9
src/grammar.json generated
View file

@ -635,8 +635,13 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "ALIAS",
"name": "default_case" "content": {
"type": "SYMBOL",
"name": "default_case"
},
"named": true,
"value": "select_case"
}, },
{ {
"type": "STRING", "type": "STRING",

70
src/node-types.json generated
View file

@ -177,68 +177,6 @@
"named": true, "named": true,
"fields": {} "fields": {}
}, },
{
"type": "default_case",
"named": true,
"fields": {
"pattern": {
"multiple": false,
"required": true,
"types": [
{
"type": "default",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "binary_expression",
"named": true
},
{
"type": "boolean_literal",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "integer_literal",
"named": true
},
{
"type": "interpreted_string_literal",
"named": true
},
{
"type": "list_expression",
"named": true
},
{
"type": "map_expression",
"named": true
},
{
"type": "raw_string_literal",
"named": true
},
{
"type": "select_expression",
"named": true
},
{
"type": "unset",
"named": true
}
]
}
}
},
{ {
"type": "integer_literal", "type": "integer_literal",
"named": true, "named": true,
@ -415,6 +353,10 @@
"multiple": false, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{
"type": "default",
"named": true
},
{ {
"type": "interpreted_string_literal", "type": "interpreted_string_literal",
"named": true "named": true
@ -481,10 +423,6 @@
"multiple": true, "multiple": true,
"required": false, "required": false,
"types": [ "types": [
{
"type": "default_case",
"named": true
},
{ {
"type": "select_case", "type": "select_case",
"named": true "named": true

4
src/parser.c generated
View file

@ -134,7 +134,7 @@ static const char * const ts_symbol_names[] = {
[sym_soong_config_variable] = "soong_config_variable", [sym_soong_config_variable] = "soong_config_variable",
[sym_select_cases] = "select_cases", [sym_select_cases] = "select_cases",
[sym_select_case] = "select_case", [sym_select_case] = "select_case",
[sym_default_case] = "default_case", [sym_default_case] = "select_case",
[sym__case_value] = "_case_value", [sym__case_value] = "_case_value",
[sym_list_expression] = "list_expression", [sym_list_expression] = "list_expression",
[sym_map_expression] = "map_expression", [sym_map_expression] = "map_expression",
@ -201,7 +201,7 @@ static const TSSymbol ts_symbol_map[] = {
[sym_soong_config_variable] = sym_soong_config_variable, [sym_soong_config_variable] = sym_soong_config_variable,
[sym_select_cases] = sym_select_cases, [sym_select_cases] = sym_select_cases,
[sym_select_case] = sym_select_case, [sym_select_case] = sym_select_case,
[sym_default_case] = sym_default_case, [sym_default_case] = sym_select_case,
[sym__case_value] = sym__case_value, [sym__case_value] = sym__case_value,
[sym_list_expression] = sym_list_expression, [sym_list_expression] = sym_list_expression,
[sym_map_expression] = sym_map_expression, [sym_map_expression] = sym_map_expression,

View file

@ -21,7 +21,7 @@ foo = select(release_variable("RELEASE_TEST"), {
(select_case (select_case
(interpreted_string_literal) (interpreted_string_literal)
(interpreted_string_literal)) (interpreted_string_literal))
(default_case (select_case
(default) (default)
(unset)))))) (unset))))))
@ -136,7 +136,7 @@ foo = select(variant("VARIANT"), {
(interpreted_string_literal) (interpreted_string_literal)
(interpreted_string_literal)) (interpreted_string_literal))
(ERROR (ERROR
(default_case (select_case
(default) (default)
(unset))) (unset)))
(select_case (select_case
@ -169,7 +169,7 @@ foo = select(variant(), {
(select_case (select_case
(interpreted_string_literal) (interpreted_string_literal)
(unset)) (unset))
(default_case (select_case
(default) (default)
(interpreted_string_literal)))))) (interpreted_string_literal))))))