Add 'operator' aliases

This commit is contained in:
Bruno BELANYI 2024-04-08 02:13:43 +01:00
parent 25924c3c5c
commit 3e46a9b762
7 changed files with 121 additions and 68 deletions

View file

@ -28,7 +28,7 @@ module.exports = grammar({
assignment: ($) => seq( assignment: ($) => seq(
field("left", $.identifier), field("left", $.identifier),
field("operator", choice("=", "+=")), field("operator", alias(choice("=", "+="), $.operator)),
field("right", $._expr), field("right", $._expr),
), ),
@ -189,7 +189,7 @@ module.exports = grammar({
binary_expression: ($) => prec.left(seq( binary_expression: ($) => prec.left(seq(
field("left", $._expr), field("left", $._expr),
field("operator", "+"), field("operator", alias("+", $.operator)),
field("right", $._expr), field("right", $._expr),
)), )),

10
src/grammar.json generated
View file

@ -48,6 +48,8 @@
{ {
"type": "FIELD", "type": "FIELD",
"name": "operator", "name": "operator",
"content": {
"type": "ALIAS",
"content": { "content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
@ -60,6 +62,9 @@
"value": "+=" "value": "+="
} }
] ]
},
"named": true,
"value": "operator"
} }
}, },
{ {
@ -851,9 +856,14 @@
{ {
"type": "FIELD", "type": "FIELD",
"name": "operator", "name": "operator",
"content": {
"type": "ALIAS",
"content": { "content": {
"type": "STRING", "type": "STRING",
"value": "+" "value": "+"
},
"named": true,
"value": "operator"
} }
}, },
{ {

24
src/node-types.json generated
View file

@ -18,12 +18,8 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "+=", "type": "operator",
"named": false "named": true
},
{
"type": "=",
"named": false
} }
] ]
}, },
@ -122,8 +118,8 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "+", "type": "operator",
"named": false "named": true
} }
] ]
}, },
@ -648,14 +644,6 @@
"type": ")", "type": ")",
"named": false "named": false
}, },
{
"type": "+",
"named": false
},
{
"type": "+=",
"named": false
},
{ {
"type": ",", "type": ",",
"named": false "named": false
@ -696,6 +684,10 @@
"type": "identifier", "type": "identifier",
"named": true "named": true
}, },
{
"type": "operator",
"named": true
},
{ {
"type": "raw_string_literal", "type": "raw_string_literal",
"named": true "named": true

78
src/parser.c generated
View file

@ -14,7 +14,7 @@
#define EXTERNAL_TOKEN_COUNT 0 #define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 12 #define FIELD_COUNT 12
#define MAX_ALIAS_SEQUENCE_LENGTH 6 #define MAX_ALIAS_SEQUENCE_LENGTH 6
#define PRODUCTION_ID_COUNT 19 #define PRODUCTION_ID_COUNT 20
enum ts_symbol_identifiers { enum ts_symbol_identifiers {
anon_sym_POUND = 1, anon_sym_POUND = 1,
@ -84,7 +84,7 @@ static const char * const ts_symbol_names[] = {
[anon_sym_POUND] = "#", [anon_sym_POUND] = "#",
[aux_sym_comment_token1] = "comment_token1", [aux_sym_comment_token1] = "comment_token1",
[anon_sym_EQ] = "=", [anon_sym_EQ] = "=",
[anon_sym_PLUS_EQ] = "+=", [anon_sym_PLUS_EQ] = "operator",
[anon_sym_LBRACE] = "{", [anon_sym_LBRACE] = "{",
[anon_sym_COMMA] = ",", [anon_sym_COMMA] = ",",
[anon_sym_RBRACE] = "}", [anon_sym_RBRACE] = "}",
@ -110,7 +110,7 @@ static const char * const ts_symbol_names[] = {
[anon_sym_unset] = "unset", [anon_sym_unset] = "unset",
[anon_sym_LBRACK] = "[", [anon_sym_LBRACK] = "[",
[anon_sym_RBRACK] = "]", [anon_sym_RBRACK] = "]",
[anon_sym_PLUS] = "+", [anon_sym_PLUS] = "operator",
[sym_source_file] = "source_file", [sym_source_file] = "source_file",
[sym__definition] = "_definition", [sym__definition] = "_definition",
[sym_comment] = "comment", [sym_comment] = "comment",
@ -174,7 +174,7 @@ static const TSSymbol ts_symbol_map[] = {
[anon_sym_unset] = anon_sym_unset, [anon_sym_unset] = anon_sym_unset,
[anon_sym_LBRACK] = anon_sym_LBRACK, [anon_sym_LBRACK] = anon_sym_LBRACK,
[anon_sym_RBRACK] = anon_sym_RBRACK, [anon_sym_RBRACK] = anon_sym_RBRACK,
[anon_sym_PLUS] = anon_sym_PLUS, [anon_sym_PLUS] = anon_sym_PLUS_EQ,
[sym_source_file] = sym_source_file, [sym_source_file] = sym_source_file,
[sym__definition] = sym__definition, [sym__definition] = sym__definition,
[sym_comment] = sym_comment, [sym_comment] = sym_comment,
@ -226,7 +226,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
}, },
[anon_sym_PLUS_EQ] = { [anon_sym_PLUS_EQ] = {
.visible = true, .visible = true,
.named = false, .named = true,
}, },
[anon_sym_LBRACE] = { [anon_sym_LBRACE] = {
.visible = true, .visible = true,
@ -330,7 +330,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
}, },
[anon_sym_PLUS] = { [anon_sym_PLUS] = {
.visible = true, .visible = true,
.named = false, .named = true,
}, },
[sym_source_file] = { [sym_source_file] = {
.visible = true, .visible = true,
@ -494,16 +494,17 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
[6] = {.index = 11, .length = 3}, [6] = {.index = 11, .length = 3},
[7] = {.index = 14, .length = 3}, [7] = {.index = 14, .length = 3},
[8] = {.index = 17, .length = 1}, [8] = {.index = 17, .length = 1},
[9] = {.index = 18, .length = 2}, [9] = {.index = 3, .length = 3},
[10] = {.index = 20, .length = 5}, [10] = {.index = 18, .length = 2},
[11] = {.index = 25, .length = 2}, [11] = {.index = 20, .length = 5},
[12] = {.index = 27, .length = 4}, [12] = {.index = 25, .length = 2},
[13] = {.index = 31, .length = 4}, [13] = {.index = 27, .length = 4},
[14] = {.index = 35, .length = 2}, [14] = {.index = 31, .length = 4},
[15] = {.index = 37, .length = 2}, [15] = {.index = 35, .length = 2},
[16] = {.index = 39, .length = 2}, [16] = {.index = 37, .length = 2},
[17] = {.index = 41, .length = 4}, [17] = {.index = 39, .length = 2},
[18] = {.index = 45, .length = 2}, [18] = {.index = 41, .length = 4},
[19] = {.index = 45, .length = 2},
}; };
static const TSFieldMapEntry ts_field_map_entries[] = { static const TSFieldMapEntry ts_field_map_entries[] = {
@ -576,6 +577,9 @@ static const TSFieldMapEntry ts_field_map_entries[] = {
static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
[0] = {0}, [0] = {0},
[3] = {
[1] = anon_sym_PLUS_EQ,
},
}; };
static const uint16_t ts_non_terminal_alias_map[] = { static const uint16_t ts_non_terminal_alias_map[] = {
@ -7318,17 +7322,17 @@ static const TSParseActionEntry ts_parse_actions[] = {
[55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2),
[57] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(43), [57] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(43),
[60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_interpreted_string_literal, 3), [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_interpreted_string_literal, 3),
[62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 14), [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 15),
[64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 2), [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 2),
[66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 1), [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 1),
[68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 3, .production_id = 7), [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 3, .production_id = 7),
[70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_expression, 6), [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_expression, 6),
[72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 8), [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 8),
[74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 5, .production_id = 14), [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 5, .production_id = 15),
[76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 5, .production_id = 13), [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 5, .production_id = 14),
[78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 13), [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 14),
[80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 7), [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 7),
[82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 3), [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 9),
[84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 2), [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 2),
[86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean_literal, 1), [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean_literal, 1),
[88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 2), [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 2),
@ -7352,8 +7356,8 @@ static const TSParseActionEntry ts_parse_actions[] = {
[125] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_interpreted_string_literal_repeat1, 2), SHIFT_REPEAT(59), [125] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_interpreted_string_literal_repeat1, 2), SHIFT_REPEAT(59),
[128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), [128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5),
[130] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), [130] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20),
[132] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 15), SHIFT_REPEAT(11), [132] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 16), SHIFT_REPEAT(11),
[135] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 15), [135] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 16),
[137] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), [137] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64),
[139] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73), [139] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73),
[141] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), [141] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72),
@ -7374,23 +7378,23 @@ static const TSParseActionEntry ts_parse_actions[] = {
[171] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_interpreted_string_literal_repeat1, 1), [171] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_interpreted_string_literal_repeat1, 1),
[173] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), [173] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52),
[175] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), [175] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23),
[177] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__colon_property, 3, .production_id = 9), [177] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__colon_property, 3, .production_id = 10),
[179] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), [179] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58),
[181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83), [181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83),
[183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), [183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27),
[185] = {.entry = {.count = 1, .reusable = true}}, SHIFT(84), [185] = {.entry = {.count = 1, .reusable = true}}, SHIFT(84),
[187] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), [187] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49),
[189] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88), [189] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88),
[191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 11), SHIFT_REPEAT(85), [191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 12), SHIFT_REPEAT(85),
[194] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 11), [194] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 12),
[196] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__equal_property, 3, .production_id = 9), [196] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__equal_property, 3, .production_id = 10),
[198] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 11), SHIFT_REPEAT(87), [198] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 12), SHIFT_REPEAT(87),
[201] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 11), [201] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 12),
[203] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86), [203] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86),
[205] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__definition, 1), [205] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__definition, 1),
[207] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 1), [207] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 1),
[209] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 6), [209] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 6),
[211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 10), [211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 11),
[213] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 7), [213] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 7),
[215] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__case_value, 1), [215] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__case_value, 1),
[217] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 3), [217] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 3),
@ -7401,16 +7405,16 @@ static const TSParseActionEntry ts_parse_actions[] = {
[227] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 3, .production_id = 4), [227] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 3, .production_id = 4),
[229] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_module, 1, .production_id = 2), [229] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_module, 1, .production_id = 2),
[231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 4, .production_id = 5), [231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 4, .production_id = 5),
[233] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 6, .production_id = 10), [233] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 6, .production_id = 11),
[235] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 6, .production_id = 12), [235] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 6, .production_id = 13),
[237] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 4, .production_id = 6), [237] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 4, .production_id = 6),
[239] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 12), [239] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 13),
[241] = {.entry = {.count = 1, .reusable = false}}, SHIFT(119), [241] = {.entry = {.count = 1, .reusable = false}}, SHIFT(119),
[243] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118), [243] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118),
[245] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), [245] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24),
[247] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), [247] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42),
[249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(106), [249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(106),
[251] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_soong_config_variable, 6, .production_id = 17), [251] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_soong_config_variable, 6, .production_id = 18),
[253] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), [253] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36),
[255] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 2), [255] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 2),
[257] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), [257] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3),
@ -7421,7 +7425,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
[267] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), [267] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41),
[269] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), [269] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33),
[271] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), [271] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78),
[273] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_value, 4, .production_id = 16), [273] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_value, 4, .production_id = 17),
[275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(95), [275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(95),
[277] = {.entry = {.count = 1, .reusable = true}}, SHIFT(117), [277] = {.entry = {.count = 1, .reusable = true}}, SHIFT(117),
[279] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 3), [279] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 3),
@ -7429,8 +7433,8 @@ static const TSParseActionEntry ts_parse_actions[] = {
[283] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), [283] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
[285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
[287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), [287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7),
[289] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_default_case, 3, .production_id = 18), [289] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_default_case, 3, .production_id = 19),
[291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_case, 3, .production_id = 18), [291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_case, 3, .production_id = 19),
[293] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 4), [293] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 4),
[295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(102), [295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(102),
[297] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_comment, 2), [297] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_comment, 2),

View file

@ -17,6 +17,7 @@ foo = 42
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))
================================================================================ ================================================================================
@ -30,6 +31,7 @@ foo = bar
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(identifier))) (identifier)))
================================================================================ ================================================================================
@ -43,6 +45,7 @@ foo += 12
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))
================================================================================ ================================================================================
@ -57,9 +60,11 @@ bar = 27
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))
================================================================================ ================================================================================
@ -78,19 +83,25 @@ qux += 1
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))

View file

@ -10,9 +10,11 @@ foo = true
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(boolean_literal)) (boolean_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(boolean_literal))) (boolean_literal)))
================================================================================ ================================================================================
@ -27,9 +29,11 @@ false = true
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(boolean_literal)) (boolean_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(boolean_literal))) (boolean_literal)))
================================================================================ ================================================================================
@ -44,9 +48,11 @@ foo = 42
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))
================================================================================ ================================================================================
@ -61,9 +67,11 @@ foo = -42
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal)) (integer_literal))
(assignment (assignment
(identifier) (identifier)
(operator)
(integer_literal))) (integer_literal)))
================================================================================ ================================================================================
@ -77,6 +85,7 @@ foo = "Hello World!"
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(interpreted_string_literal))) (interpreted_string_literal)))
================================================================================ ================================================================================
@ -90,6 +99,7 @@ foo = "Hello\nWorld!"
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(interpreted_string_literal (interpreted_string_literal
(escape_sequence)))) (escape_sequence))))
@ -104,6 +114,7 @@ foo = `Hello\nWorld!`
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(raw_string_literal))) (raw_string_literal)))
================================================================================ ================================================================================
@ -117,6 +128,7 @@ foo = []
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression))) (list_expression)))
================================================================================ ================================================================================
@ -130,6 +142,7 @@ foo = [42]
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(integer_literal)))) (integer_literal))))
@ -146,6 +159,7 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(integer_literal)))) (integer_literal))))
@ -162,6 +176,7 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(integer_literal)))) (integer_literal))))
@ -179,6 +194,7 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(integer_literal) (integer_literal)
(interpreted_string_literal)))) (interpreted_string_literal))))
@ -198,6 +214,7 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(list_expression (list_expression
(integer_literal)) (integer_literal))
@ -218,6 +235,7 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(ERROR)))) (ERROR))))
@ -232,6 +250,7 @@ foo = {}
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression))) (map_expression)))
================================================================================ ================================================================================
@ -245,6 +264,7 @@ foo = {foo:42}
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(property (property
(identifier) (identifier)
@ -263,6 +283,7 @@ foo = {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(property (property
(identifier) (identifier)
@ -281,6 +302,7 @@ foo = {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(property (property
(identifier) (identifier)
@ -300,6 +322,7 @@ foo = {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(property (property
(identifier) (identifier)
@ -321,6 +344,7 @@ foo = {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(property (property
(identifier) (identifier)
@ -342,6 +366,7 @@ foo = {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(map_expression (map_expression
(ERROR)))) (ERROR))))
@ -359,12 +384,16 @@ foo = [
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(list_expression (list_expression
(binary_expression (binary_expression
(binary_expression (binary_expression
(integer_literal) (integer_literal)
(operator)
(integer_literal)) (integer_literal))
(operator)
(integer_literal)) (integer_literal))
(binary_expression (binary_expression
(interpreted_string_literal) (interpreted_string_literal)
(operator)
(interpreted_string_literal))))) (interpreted_string_literal)))))

View file

@ -12,6 +12,7 @@ foo = select(release_variable("RELEASE_TEST"), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(select_value (select_value
(selection_type) (selection_type)
@ -37,6 +38,7 @@ foo = select(soong_config_variable("my_namespace", "my_var"), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(soong_config_variable (soong_config_variable
(selection_type) (selection_type)
@ -66,6 +68,7 @@ foo = select(variant("arch"), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(select_value (select_value
(selection_type) (selection_type)
@ -95,6 +98,7 @@ foo = select(variant("VARIANT"), {})
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(select_value (select_value
(selection_type) (selection_type)
@ -118,6 +122,7 @@ foo = select(variant("VARIANT"), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(select_value (select_value
(selection_type) (selection_type)
@ -153,6 +158,7 @@ foo = select(variant(), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(select_expression (select_expression
(select_value (select_value
(selection_type) (selection_type)
@ -178,6 +184,7 @@ foo = select(some_unknown_type("CONDITION"), {
(source_file (source_file
(assignment (assignment
(identifier) (identifier)
(operator)
(ERROR (ERROR
(identifier) (identifier)
(identifier) (identifier)