diff --git a/Makefile b/Makefile index e421948..f12211c 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ all: .PHONE: test test: all - tree-sitter test --apply-all-captures + tree-sitter test .PHONE: update-tests update-tests: all - tree-sitter test -u --apply-all-captures + tree-sitter test -u playground: nix shell pkgs#emscripten --command tree-sitter build-wasm diff --git a/flake.nix b/flake.nix index e7053c4..4c513fb 100644 --- a/flake.nix +++ b/flake.nix @@ -93,7 +93,7 @@ tree-sitter = { enable = true; name = "tree-sitter tests"; - entry = "${tree-sitter-env}/bin/tree-sitter test --apply-all-captures"; + entry = "${tree-sitter-env}/bin/tree-sitter test"; pass_filenames = false; }; diff --git a/grammar.js b/grammar.js index 86d0dd6..40e7e24 100644 --- a/grammar.js +++ b/grammar.js @@ -51,7 +51,7 @@ module.exports = grammar({ ), _new_module: ($) => seq( - field("type", $.identifier), + $.identifier, "(", optional(commaSeparated( alias(field("property", $._equal_property), $.property) diff --git a/queries/highlights.scm b/queries/highlights.scm deleted file mode 100644 index 7422e6f..0000000 --- a/queries/highlights.scm +++ /dev/null @@ -1,69 +0,0 @@ -[ - (line_comment) - (block_comment) -] @comment - -; Operators {{{ -(operator) @operator - -(integer_literal ("-") @operator) -; }}} - -; Punctuation {{{ -[ - "," - ":" -] @punctuation.delimiter - -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket -; }}} - -; Literal {{{ -(boolean_literal) @boolean - -(integer_literal) @number - -[ - (raw_string_literal) - (interpreted_string_literal) -] @string - -(escape_sequence) @string.escape -; }}} - -; Declarations {{{ -(identifier) @variable - -(module - type: (identifier) @module) - -(module - (property - field: (identifier) @variable.member)) -; }}} - -; Built-ins {{{ -[ - (unset) - "default" -] @variable.builtin -(selection_type) @function.builtin -; }}} - -; Expressions {{{ -(map_expression - (property - field: (identifier) @property)) - -(select_expression - "select" @keyword.conditional) -; }}} - -; vim: sw=2 foldmethod=marker diff --git a/src/grammar.json b/src/grammar.json index c9b0e32..02c7230 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -195,12 +195,8 @@ "type": "SEQ", "members": [ { - "type": "FIELD", - "name": "type", - "content": { - "type": "SYMBOL", - "name": "identifier" - } + "type": "SYMBOL", + "name": "identifier" }, { "type": "STRING", diff --git a/src/node-types.json b/src/node-types.json index 0a7db28..37c3eff 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -344,7 +344,7 @@ }, "type": { "multiple": false, - "required": true, + "required": false, "types": [ { "type": "identifier", @@ -352,6 +352,16 @@ } ] } + }, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "identifier", + "named": true + } + ] } }, { diff --git a/src/parser.c b/src/parser.c index f7c2b6f..d9a2ff9 100644 --- a/src/parser.c +++ b/src/parser.c @@ -14,7 +14,7 @@ #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 12 #define MAX_ALIAS_SEQUENCE_LENGTH 6 -#define PRODUCTION_ID_COUNT 17 +#define PRODUCTION_ID_COUNT 20 enum ts_symbol_identifiers { anon_sym_SLASH_SLASH = 1, @@ -515,21 +515,24 @@ static const char * const ts_field_names[] = { static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [1] = {.index = 0, .length = 2}, - [2] = {.index = 2, .length = 3}, - [3] = {.index = 5, .length = 1}, - [4] = {.index = 6, .length = 4}, - [5] = {.index = 10, .length = 3}, - [6] = {.index = 13, .length = 1}, - [7] = {.index = 2, .length = 3}, - [8] = {.index = 14, .length = 2}, - [9] = {.index = 16, .length = 5}, - [10] = {.index = 21, .length = 2}, - [11] = {.index = 23, .length = 4}, - [12] = {.index = 27, .length = 2}, - [13] = {.index = 29, .length = 2}, - [14] = {.index = 31, .length = 2}, - [15] = {.index = 33, .length = 4}, + [2] = {.index = 2, .length = 1}, + [3] = {.index = 3, .length = 3}, + [4] = {.index = 6, .length = 1}, + [5] = {.index = 7, .length = 4}, + [6] = {.index = 11, .length = 3}, + [7] = {.index = 14, .length = 3}, + [8] = {.index = 17, .length = 1}, + [9] = {.index = 3, .length = 3}, + [10] = {.index = 18, .length = 2}, + [11] = {.index = 20, .length = 5}, + [12] = {.index = 25, .length = 2}, + [13] = {.index = 27, .length = 4}, + [14] = {.index = 31, .length = 4}, + [15] = {.index = 35, .length = 2}, [16] = {.index = 37, .length = 2}, + [17] = {.index = 39, .length = 2}, + [18] = {.index = 41, .length = 4}, + [19] = {.index = 45, .length = 2}, }; static const TSFieldMapEntry ts_field_map_entries[] = { @@ -537,61 +540,72 @@ static const TSFieldMapEntry ts_field_map_entries[] = { {field_property, 0, .inherited = true}, {field_type, 0, .inherited = true}, [2] = + {field_property, 0, .inherited = true}, + [3] = {field_left, 0}, {field_operator, 1}, {field_right, 2}, - [5] = - {field_type, 0}, [6] = + {field_type, 0}, + [7] = {field_field, 2, .inherited = true}, {field_property, 2}, {field_type, 0}, {field_value, 2, .inherited = true}, - [10] = + [11] = + {field_field, 2, .inherited = true}, + {field_property, 2}, + {field_value, 2, .inherited = true}, + [14] = {field_field, 1, .inherited = true}, {field_property, 1}, {field_value, 1, .inherited = true}, - [13] = + [17] = {field_element, 1}, - [14] = + [18] = {field_field, 0}, {field_value, 2}, - [16] = + [20] = {field_field, 2, .inherited = true}, {field_property, 2}, {field_property, 3, .inherited = true}, {field_type, 0}, {field_value, 2, .inherited = true}, - [21] = + [25] = {field_property, 0, .inherited = true}, {field_property, 1, .inherited = true}, - [23] = + [27] = + {field_field, 2, .inherited = true}, + {field_property, 2}, + {field_property, 3, .inherited = true}, + {field_value, 2, .inherited = true}, + [31] = {field_field, 1, .inherited = true}, {field_property, 1}, {field_property, 2, .inherited = true}, {field_value, 1, .inherited = true}, - [27] = + [35] = {field_element, 1}, {field_element, 2, .inherited = true}, - [29] = + [37] = {field_element, 0, .inherited = true}, {field_element, 1, .inherited = true}, - [31] = + [39] = {field_condition, 2}, {field_type, 0}, - [33] = + [41] = {field_condition, 3}, {field_namespace, 2}, {field_type, 0}, {field_variable, 4}, - [37] = + [45] = {field_pattern, 0}, {field_value, 2}, }; static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { [0] = {0}, - [2] = { + [3] = { [1] = anon_sym_PLUS_EQ, }, }; @@ -7262,7 +7276,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(227), 2, + ACTIONS(235), 2, ts_builtin_sym_end, sym_identifier, STATE(84), 2, @@ -7273,7 +7287,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(235), 2, + ACTIONS(237), 2, ts_builtin_sym_end, sym_identifier, STATE(85), 2, @@ -7284,7 +7298,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(237), 2, + ACTIONS(239), 2, ts_builtin_sym_end, sym_identifier, STATE(86), 2, @@ -7295,7 +7309,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(239), 2, + ACTIONS(241), 2, ts_builtin_sym_end, sym_identifier, STATE(87), 2, @@ -7318,7 +7332,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(241), 2, + ACTIONS(243), 2, ts_builtin_sym_end, sym_identifier, STATE(89), 2, @@ -7329,7 +7343,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(243), 1, + ACTIONS(245), 1, anon_sym_COMMA, STATE(90), 2, sym_line_comment, @@ -7339,7 +7353,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(245), 1, + ACTIONS(247), 1, anon_sym_COMMA, STATE(91), 2, sym_line_comment, @@ -7349,7 +7363,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(247), 1, + ACTIONS(249), 1, anon_sym_RPAREN, STATE(92), 2, sym_line_comment, @@ -7359,7 +7373,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(249), 1, + ACTIONS(251), 1, anon_sym_COMMA, STATE(93), 2, sym_line_comment, @@ -7369,7 +7383,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(251), 1, + ACTIONS(253), 1, aux_sym_integer_literal_token1, STATE(94), 2, sym_line_comment, @@ -7379,7 +7393,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(253), 1, + ACTIONS(255), 1, anon_sym_RPAREN, STATE(95), 2, sym_line_comment, @@ -7389,7 +7403,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(255), 1, + ACTIONS(257), 1, anon_sym_RPAREN, STATE(96), 2, sym_line_comment, @@ -7399,7 +7413,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(257), 1, + ACTIONS(259), 1, anon_sym_SLASH, STATE(97), 2, sym_line_comment, @@ -7409,7 +7423,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(259), 1, + ACTIONS(261), 1, anon_sym_COMMA, STATE(98), 2, sym_line_comment, @@ -7419,7 +7433,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(261), 1, + ACTIONS(263), 1, anon_sym_RBRACE, STATE(99), 2, sym_line_comment, @@ -7429,7 +7443,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(263), 1, + ACTIONS(265), 1, anon_sym_RPAREN, STATE(100), 2, sym_line_comment, @@ -7439,7 +7453,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(265), 1, + ACTIONS(267), 1, anon_sym_COLON, STATE(101), 2, sym_line_comment, @@ -7449,7 +7463,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(267), 1, + ACTIONS(269), 1, anon_sym_COLON, STATE(102), 2, sym_line_comment, @@ -7459,7 +7473,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(269), 1, + ACTIONS(271), 1, anon_sym_COMMA, STATE(103), 2, sym_line_comment, @@ -7469,7 +7483,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(271), 1, + ACTIONS(273), 1, anon_sym_COMMA, STATE(104), 2, sym_line_comment, @@ -7479,7 +7493,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(273), 1, + ACTIONS(275), 1, anon_sym_COLON, STATE(105), 2, sym_line_comment, @@ -7489,7 +7503,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(275), 1, + ACTIONS(277), 1, anon_sym_EQ, STATE(106), 2, sym_line_comment, @@ -7499,7 +7513,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(277), 1, + ACTIONS(279), 1, anon_sym_RPAREN, STATE(107), 2, sym_line_comment, @@ -7509,7 +7523,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(279), 1, + ACTIONS(281), 1, anon_sym_LPAREN, STATE(108), 2, sym_line_comment, @@ -7519,7 +7533,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(102), 1, anon_sym_SLASH_STAR, - ACTIONS(281), 1, + ACTIONS(283), 1, aux_sym_line_comment_token1, STATE(109), 2, sym_line_comment, @@ -7529,7 +7543,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(283), 1, + ACTIONS(285), 1, ts_builtin_sym_end, STATE(110), 2, sym_line_comment, @@ -7539,7 +7553,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(285), 1, + ACTIONS(287), 1, anon_sym_RBRACE, STATE(111), 2, sym_line_comment, @@ -7549,7 +7563,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(287), 1, + ACTIONS(289), 1, anon_sym_RPAREN, STATE(112), 2, sym_line_comment, @@ -7559,7 +7573,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(289), 1, + ACTIONS(291), 1, anon_sym_COMMA, STATE(113), 2, sym_line_comment, @@ -7569,7 +7583,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(102), 1, anon_sym_SLASH_STAR, - ACTIONS(291), 1, + ACTIONS(293), 1, aux_sym_block_comment_token1, STATE(114), 2, sym_line_comment, @@ -7579,7 +7593,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(293), 1, + ACTIONS(295), 1, anon_sym_LPAREN, STATE(115), 2, sym_line_comment, @@ -7599,7 +7613,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(295), 1, + ACTIONS(297), 1, anon_sym_LPAREN, STATE(117), 2, sym_line_comment, @@ -7609,7 +7623,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(297), 1, + ACTIONS(299), 1, anon_sym_COMMA, STATE(118), 2, sym_line_comment, @@ -7619,7 +7633,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(299), 1, + ACTIONS(301), 1, anon_sym_COMMA, STATE(119), 2, sym_line_comment, @@ -7629,16 +7643,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SLASH_SLASH, ACTIONS(5), 1, anon_sym_SLASH_STAR, - ACTIONS(301), 1, + ACTIONS(303), 1, anon_sym_RPAREN, STATE(120), 2, sym_line_comment, sym_block_comment, [2541] = 1, - ACTIONS(303), 1, + ACTIONS(305), 1, ts_builtin_sym_end, [2545] = 1, - ACTIONS(305), 1, + ACTIONS(307), 1, ts_builtin_sym_end, }; @@ -7800,19 +7814,19 @@ static const TSParseActionEntry ts_parse_actions[] = { [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__string_literal, 1), [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 1), [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean_literal, 1), - [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 5, .production_id = 11), - [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 6), + [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 5, .production_id = 14), + [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 8), [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_expression, 6), - [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 3, .production_id = 6), + [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 3, .production_id = 8), [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expr, 1), - [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 12), - [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 7), + [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 4, .production_id = 15), + [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 9), [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 2), - [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 5), - [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 5, .production_id = 12), - [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 11), + [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 7), + [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list_expression, 5, .production_id = 15), + [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 4, .production_id = 14), [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 2), - [92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 3, .production_id = 5), + [92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_map_expression, 3, .production_id = 7), [94] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer_literal, 2), [96] = {.entry = {.count = 1, .reusable = true}}, SHIFT(108), [98] = {.entry = {.count = 1, .reusable = true}}, SHIFT(117), @@ -7849,74 +7863,75 @@ static const TSParseActionEntry ts_parse_actions[] = { [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [168] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 6), + [168] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 8), [170] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), [172] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83), - [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, .production_id = 2), - [176] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 13), SHIFT_REPEAT(10), - [179] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 13), + [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, .production_id = 3), + [176] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 16), SHIFT_REPEAT(10), + [179] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_expression_repeat1, 2, .production_id = 16), [181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), [183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), [185] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), - [187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__colon_property, 3, .production_id = 8), + [187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__colon_property, 3, .production_id = 10), [189] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), - [191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 10), SHIFT_REPEAT(88), - [194] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 10), - [196] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__equal_property, 3, .production_id = 8), + [191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 12), SHIFT_REPEAT(88), + [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 = 10), [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(89), - [200] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 10), SHIFT_REPEAT(71), - [203] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 10), + [200] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 12), SHIFT_REPEAT(71), + [203] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 12), [205] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), [207] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [209] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 3, .production_id = 3), - [211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_module_repeat1, 2, .production_id = 5), - [213] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__old_module_repeat1, 2, .production_id = 5), - [215] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 9), + [209] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 3), + [211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__new_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__new_module, 5, .production_id = 13), [217] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__case_value, 1), - [219] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 9), + [219] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 11), [221] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 1), - [223] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 4), + [223] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 5, .production_id = 5), [225] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__definition, 1), [227] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_module, 1, .production_id = 1), [229] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 4, .production_id = 4), - [233] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 4, .production_id = 4), - [235] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 4), - [237] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 3, .production_id = 3), - [239] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 6, .production_id = 9), - [241] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 6, .production_id = 9), - [243] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_value, 4, .production_id = 14), - [245] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_soong_config_variable, 6, .production_id = 15), - [247] = {.entry = {.count = 1, .reusable = true}}, SHIFT(90), - [249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), - [251] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), - [253] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [255] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 5), - [257] = {.entry = {.count = 1, .reusable = false}}, SHIFT(122), - [259] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), - [261] = {.entry = {.count = 1, .reusable = true}}, SHIFT(96), - [263] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 2), - [265] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [267] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [269] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), - [271] = {.entry = {.count = 1, .reusable = true}}, SHIFT(111), - [273] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [277] = {.entry = {.count = 1, .reusable = true}}, SHIFT(91), - [279] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), - [281] = {.entry = {.count = 1, .reusable = false}}, SHIFT(121), - [283] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(120), - [287] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 3), - [289] = {.entry = {.count = 1, .reusable = true}}, SHIFT(99), - [291] = {.entry = {.count = 1, .reusable = false}}, SHIFT(97), - [293] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), - [295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [297] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_default_case, 3, .production_id = 16), - [299] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_case, 3, .production_id = 16), - [301] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 4), - [303] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_line_comment, 2), - [305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block_comment, 3), + [231] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 4, .production_id = 6), + [233] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 4, .production_id = 5), + [235] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_module, 1, .production_id = 2), + [237] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 5, .production_id = 6), + [239] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 3, .production_id = 4), + [241] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__old_module, 6, .production_id = 11), + [243] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__new_module, 6, .production_id = 13), + [245] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_value, 4, .production_id = 17), + [247] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_soong_config_variable, 6, .production_id = 18), + [249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(90), + [251] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [253] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), + [255] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [257] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 5), + [259] = {.entry = {.count = 1, .reusable = false}}, SHIFT(122), + [261] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), + [263] = {.entry = {.count = 1, .reusable = true}}, SHIFT(96), + [265] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 2), + [267] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [269] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [271] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), + [273] = {.entry = {.count = 1, .reusable = true}}, SHIFT(111), + [275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [277] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [279] = {.entry = {.count = 1, .reusable = true}}, SHIFT(91), + [281] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [283] = {.entry = {.count = 1, .reusable = false}}, SHIFT(121), + [285] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(120), + [289] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 3), + [291] = {.entry = {.count = 1, .reusable = true}}, SHIFT(99), + [293] = {.entry = {.count = 1, .reusable = false}}, SHIFT(97), + [295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [297] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [299] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_default_case, 3, .production_id = 19), + [301] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_case, 3, .production_id = 19), + [303] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_select_cases, 4), + [305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_line_comment, 2), + [307] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block_comment, 3), }; #ifdef __cplusplus diff --git a/test/corpus/modules.txt b/test/corpus/modules.txt index 1eb7e9a..73d87bc 100644 --- a/test/corpus/modules.txt +++ b/test/corpus/modules.txt @@ -107,40 +107,6 @@ foo { (identifier) (interpreted_string_literal))))))) -================================================================================ -Multiple modules -================================================================================ - -foo { - answer: 42, - value: "test", -} - -bar { - baz: "qux", - done: true, -} - --------------------------------------------------------------------------------- - -(source_file - (module - (identifier) - (property - (identifier) - (integer_literal)) - (property - (identifier) - (interpreted_string_literal))) - (module - (identifier) - (property - (identifier) - (interpreted_string_literal)) - (property - (identifier) - (boolean_literal)))) - ================================================================================ Rogue comma ================================================================================ diff --git a/test/corpus/select.txt b/test/corpus/select.txt index fb76530..92f1342 100644 --- a/test/corpus/select.txt +++ b/test/corpus/select.txt @@ -192,26 +192,3 @@ foo = select(some_unknown_type("CONDITION"), { (interpreted_string_literal)) (interpreted_string_literal)) (ERROR)) - -================================================================================ -Select as an identifier -================================================================================ - -select = 42 - -foo { - select: false, -} - --------------------------------------------------------------------------------- - -(source_file - (assignment - (identifier) - (operator) - (integer_literal)) - (module - (identifier) - (property - (identifier) - (boolean_literal)))) diff --git a/test/highlight/builtins.bp b/test/highlight/builtins.bp deleted file mode 100644 index 508a8ed..0000000 --- a/test/highlight/builtins.bp +++ /dev/null @@ -1,14 +0,0 @@ -foo = select(soong_config_variable("my_namespace", "my_var"), { - // ^ function.builtin - "foo": unset, - // ^ variable.builtin - default: select(variant("VARIANT") {}), - // <- variable.builtin - // ^ function.builtin -}) - -/* Assigning to builtins is conveniently not allowed at runtime */ -unset = 12 -// <- variable.builtin -default = 27 -// <- variable.builtin diff --git a/test/highlight/comments.bp b/test/highlight/comments.bp deleted file mode 100644 index 6e93dc9..0000000 --- a/test/highlight/comments.bp +++ /dev/null @@ -1,10 +0,0 @@ -/* This is comment */ -/* <- comment - ^ comment - ^ comment - */ -// And another comment -/* <- comment - ^ comment - ^ comment - */ diff --git a/test/highlight/identifiers.bp b/test/highlight/identifiers.bp deleted file mode 100644 index d855b5f..0000000 --- a/test/highlight/identifiers.bp +++ /dev/null @@ -1,3 +0,0 @@ -foo = bar + "baz" -// <- variable -// ^ variable diff --git a/test/highlight/litterals.bp b/test/highlight/litterals.bp deleted file mode 100644 index dfbdc71..0000000 --- a/test/highlight/litterals.bp +++ /dev/null @@ -1,19 +0,0 @@ -foo = 0 -// ^ number - -foo = -42 -// ^ number - -foo = true -// ^ boolean - -foo = "foo\nbar" -// ^ string -// ^ string.escape -// ^ string.escape -// ^ string -// ^ string - -foo = `baz` -// ^ string -// ^ string diff --git a/test/highlight/modules.bp b/test/highlight/modules.bp deleted file mode 100644 index 248acdf..0000000 --- a/test/highlight/modules.bp +++ /dev/null @@ -1,21 +0,0 @@ -foo {} -// <- module - -foo () -// <- module - -foo { -// <- module - field: 12, - // <- variable.member - another_field: 27, - // <- variable.member -} - -foo ( -// <- module - field = 42, - // <- variable.member - done = false, - // <- variable.member -) diff --git a/test/highlight/operators.bp b/test/highlight/operators.bp deleted file mode 100644 index cfb75ac..0000000 --- a/test/highlight/operators.bp +++ /dev/null @@ -1,9 +0,0 @@ -foo = bar -// ^ operator - -foo += 1 -// ^ operator - -foo = -1 + 2 -// ^ operator -// ^ operator diff --git a/test/highlight/properties.bp b/test/highlight/properties.bp deleted file mode 100644 index 6bc97ef..0000000 --- a/test/highlight/properties.bp +++ /dev/null @@ -1,7 +0,0 @@ -foo { - field: { - // <- variable.member - key: 42, - // <- property - }, -} diff --git a/test/highlight/punctuation.bp b/test/highlight/punctuation.bp deleted file mode 100644 index bc00194..0000000 --- a/test/highlight/punctuation.bp +++ /dev/null @@ -1,15 +0,0 @@ -foo ( - // <- punctuation.bracket - bar = [ - //^ punctuation.bracket - { - // <- punctuation.bracket - key: "value", - // ^ punctuation.delimiter - // ^ punctuation.delimiter - }, - // <- punctuation.bracket - ] - // <- punctuation.bracket -) -// <- punctuation.bracket diff --git a/test/highlight/select.bp b/test/highlight/select.bp deleted file mode 100644 index 831608d..0000000 --- a/test/highlight/select.bp +++ /dev/null @@ -1,15 +0,0 @@ -foo = select(soong_config_variable("my_namespace", "my_var"), { - // ^ keyword.conditional - "foo": unset, - default: "bar", -}) - -// It can still be used as a normal variable name -select = 42 -// <- variable - -// Or module property -foo { - select: 42, - // <- variable.member -}