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)),
// default *must* be the last one, enforced at parse-time...
optional(seq($.default_case, ",")),
optional(seq(alias($.default_case, $.select_case), ",")),
"}",
),

5
src/grammar.json generated
View file

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

70
src/node-types.json generated
View file

@ -177,68 +177,6 @@
"named": true,
"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",
"named": true,
@ -415,6 +353,10 @@
"multiple": false,
"required": true,
"types": [
{
"type": "default",
"named": true
},
{
"type": "interpreted_string_literal",
"named": true
@ -481,10 +423,6 @@
"multiple": true,
"required": false,
"types": [
{
"type": "default_case",
"named": true
},
{
"type": "select_case",
"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_select_cases] = "select_cases",
[sym_select_case] = "select_case",
[sym_default_case] = "default_case",
[sym_default_case] = "select_case",
[sym__case_value] = "_case_value",
[sym_list_expression] = "list_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_select_cases] = sym_select_cases,
[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_list_expression] = sym_list_expression,
[sym_map_expression] = sym_map_expression,

View file

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