Add 'type_identifier' alias

This is more appropriate, and actually closer to the specified grammar.
This commit is contained in:
Bruno BELANYI 2022-06-03 10:15:37 +02:00
parent 6e40691a35
commit 2be5056793
6 changed files with 140 additions and 86 deletions

View file

@ -21,8 +21,13 @@ module.exports = grammar({
// Ensure we don't extract keywords from tokens // Ensure we don't extract keywords from tokens
word: ($) => $.identifier, word: ($) => $.identifier,
inline: ($) => [
$._type_identifier,
],
conflicts: ($) => [ conflicts: ($) => [
[$._lvalue, $.array_expression], [$._lvalue, $.array_expression],
[$._lvalue, $._type_identifier],
], ],
externals: ($) => [ externals: ($) => [
@ -81,6 +86,8 @@ module.exports = grammar({
// NOTE: includes reserved identifiers // NOTE: includes reserved identifiers
identifier: (_) => /[_a-zA-Z0-9]+/, identifier: (_) => /[_a-zA-Z0-9]+/,
_type_identifier: ($) => alias($.identifier, $.type_identifier),
escape_sequence: (_) => token.immediate( escape_sequence: (_) => token.immediate(
seq( seq(
"\\", "\\",
@ -156,7 +163,7 @@ module.exports = grammar({
sequence_expression: ($) => seq("(", sepBy(";", $._expr), ")"), sequence_expression: ($) => seq("(", sepBy(";", $._expr), ")"),
array_expression: ($) => seq( array_expression: ($) => seq(
field("type", $.identifier), field("type", $._type_identifier),
"[", "[",
field("size", $._expr), field("size", $._expr),
"]", "]",
@ -165,7 +172,7 @@ module.exports = grammar({
), ),
record_expression: ($) => seq( record_expression: ($) => seq(
field("type", $.identifier), field("type", $._type_identifier),
"{", "{",
sepBy( sepBy(
",", ",",
@ -258,7 +265,7 @@ module.exports = grammar({
$.array_type, $.array_type,
), ),
type_alias: ($) => $.identifier, type_alias: ($) => $._type_identifier,
record_type: ($) => seq( record_type: ($) => seq(
"{", "{",
@ -293,7 +300,7 @@ module.exports = grammar({
_function_declaration_common: ($) => seq( _function_declaration_common: ($) => seq(
field("name", $.identifier), field("name", $.identifier),
field("parameters", $.parameters), field("parameters", $.parameters),
optional(seq(":", field("return_type", $.identifier))), optional(seq(":", field("return_type", $._type_identifier))),
), ),
parameters: ($) => seq( parameters: ($) => seq(
@ -305,7 +312,7 @@ module.exports = grammar({
variable_declaration: ($) => seq( variable_declaration: ($) => seq(
"var", "var",
field("name", $.identifier), field("name", $.identifier),
optional(seq(":", field("type", $.identifier))), optional(seq(":", field("type", $._type_identifier))),
":=", ":=",
field("value", $._expr), field("value", $._expr),
), ),

View file

@ -133,6 +133,15 @@
"type": "PATTERN", "type": "PATTERN",
"value": "[_a-zA-Z0-9]+" "value": "[_a-zA-Z0-9]+"
}, },
"_type_identifier": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "identifier"
},
"named": true,
"value": "type_identifier"
},
"escape_sequence": { "escape_sequence": {
"type": "IMMEDIATE_TOKEN", "type": "IMMEDIATE_TOKEN",
"content": { "content": {
@ -660,7 +669,7 @@
"name": "type", "name": "type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "_type_identifier"
} }
}, },
{ {
@ -701,7 +710,7 @@
"name": "type", "name": "type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "_type_identifier"
} }
}, },
{ {
@ -1127,7 +1136,7 @@
}, },
"type_alias": { "type_alias": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "_type_identifier"
}, },
"record_type": { "record_type": {
"type": "SEQ", "type": "SEQ",
@ -1293,7 +1302,7 @@
"name": "return_type", "name": "return_type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "_type_identifier"
} }
} }
] ]
@ -1381,7 +1390,7 @@
"name": "type", "name": "type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "_type_identifier"
} }
} }
] ]
@ -1437,6 +1446,10 @@
[ [
"_lvalue", "_lvalue",
"array_expression" "array_expression"
],
[
"_lvalue",
"_type_identifier"
] ]
], ],
"precedences": [], "precedences": [],
@ -1446,7 +1459,9 @@
"name": "comment" "name": "comment"
} }
], ],
"inline": [], "inline": [
"_type_identifier"
],
"supertypes": [] "supertypes": []
} }

View file

@ -164,7 +164,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -1018,7 +1018,7 @@
"required": false, "required": false,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -1450,7 +1450,7 @@
"required": false, "required": false,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -1554,7 +1554,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -1831,7 +1831,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -1984,7 +1984,7 @@
"required": false, "required": false,
"types": [ "types": [
{ {
"type": "identifier", "type": "type_identifier",
"named": true "named": true
} }
] ]
@ -2363,6 +2363,10 @@
"type": "type", "type": "type",
"named": false "named": false
}, },
{
"type": "type_identifier",
"named": true
},
{ {
"type": "var", "type": "var",
"named": false "named": false

View file

@ -9,12 +9,12 @@
#define STATE_COUNT 148 #define STATE_COUNT 148
#define LARGE_STATE_COUNT 2 #define LARGE_STATE_COUNT 2
#define SYMBOL_COUNT 87 #define SYMBOL_COUNT 87
#define ALIAS_COUNT 0 #define ALIAS_COUNT 1
#define TOKEN_COUNT 49 #define TOKEN_COUNT 49
#define EXTERNAL_TOKEN_COUNT 1 #define EXTERNAL_TOKEN_COUNT 1
#define FIELD_COUNT 26 #define FIELD_COUNT 26
#define MAX_ALIAS_SEQUENCE_LENGTH 8 #define MAX_ALIAS_SEQUENCE_LENGTH 8
#define PRODUCTION_ID_COUNT 36 #define PRODUCTION_ID_COUNT 37
enum { enum {
sym_identifier = 1, sym_identifier = 1,
@ -103,6 +103,7 @@ enum {
aux_sym__declaration_chunk_repeat1 = 84, aux_sym__declaration_chunk_repeat1 = 84,
aux_sym__declaration_chunk_repeat2 = 85, aux_sym__declaration_chunk_repeat2 = 85,
aux_sym_record_type_repeat1 = 86, aux_sym_record_type_repeat1 = 86,
alias_sym_type_identifier = 87,
}; };
static const char * const ts_symbol_names[] = { static const char * const ts_symbol_names[] = {
@ -193,6 +194,7 @@ static const char * const ts_symbol_names[] = {
[aux_sym__declaration_chunk_repeat1] = "_declaration_chunk_repeat1", [aux_sym__declaration_chunk_repeat1] = "_declaration_chunk_repeat1",
[aux_sym__declaration_chunk_repeat2] = "_declaration_chunk_repeat2", [aux_sym__declaration_chunk_repeat2] = "_declaration_chunk_repeat2",
[aux_sym_record_type_repeat1] = "record_type_repeat1", [aux_sym_record_type_repeat1] = "record_type_repeat1",
[alias_sym_type_identifier] = "type_identifier",
}; };
static const TSSymbol ts_symbol_map[] = { static const TSSymbol ts_symbol_map[] = {
@ -283,6 +285,7 @@ static const TSSymbol ts_symbol_map[] = {
[aux_sym__declaration_chunk_repeat1] = aux_sym__declaration_chunk_repeat1, [aux_sym__declaration_chunk_repeat1] = aux_sym__declaration_chunk_repeat1,
[aux_sym__declaration_chunk_repeat2] = aux_sym__declaration_chunk_repeat2, [aux_sym__declaration_chunk_repeat2] = aux_sym__declaration_chunk_repeat2,
[aux_sym_record_type_repeat1] = aux_sym_record_type_repeat1, [aux_sym_record_type_repeat1] = aux_sym_record_type_repeat1,
[alias_sym_type_identifier] = alias_sym_type_identifier,
}; };
static const TSSymbolMetadata ts_symbol_metadata[] = { static const TSSymbolMetadata ts_symbol_metadata[] = {
@ -634,6 +637,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = false, .visible = false,
.named = false, .named = false,
}, },
[alias_sym_type_identifier] = {
.visible = true,
.named = true,
},
}; };
enum { enum {
@ -710,27 +717,27 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
[12] = {.index = 21, .length = 2}, [12] = {.index = 21, .length = 2},
[13] = {.index = 23, .length = 1}, [13] = {.index = 23, .length = 1},
[14] = {.index = 24, .length = 1}, [14] = {.index = 24, .length = 1},
[15] = {.index = 25, .length = 2}, [16] = {.index = 25, .length = 2},
[16] = {.index = 27, .length = 4}, [17] = {.index = 27, .length = 4},
[17] = {.index = 31, .length = 2}, [18] = {.index = 31, .length = 2},
[18] = {.index = 33, .length = 3}, [19] = {.index = 33, .length = 3},
[19] = {.index = 36, .length = 2}, [20] = {.index = 36, .length = 2},
[20] = {.index = 38, .length = 2}, [21] = {.index = 38, .length = 2},
[21] = {.index = 40, .length = 2}, [22] = {.index = 40, .length = 2},
[22] = {.index = 42, .length = 3}, [23] = {.index = 42, .length = 3},
[23] = {.index = 45, .length = 3}, [24] = {.index = 45, .length = 3},
[24] = {.index = 48, .length = 3}, [25] = {.index = 48, .length = 3},
[25] = {.index = 51, .length = 3}, [26] = {.index = 51, .length = 3},
[26] = {.index = 54, .length = 3}, [27] = {.index = 54, .length = 3},
[27] = {.index = 57, .length = 1}, [28] = {.index = 57, .length = 1},
[28] = {.index = 58, .length = 2}, [29] = {.index = 58, .length = 2},
[29] = {.index = 60, .length = 4}, [30] = {.index = 60, .length = 4},
[30] = {.index = 64, .length = 4}, [31] = {.index = 64, .length = 4},
[31] = {.index = 68, .length = 3}, [32] = {.index = 68, .length = 3},
[32] = {.index = 71, .length = 5}, [33] = {.index = 71, .length = 5},
[33] = {.index = 76, .length = 4}, [34] = {.index = 76, .length = 4},
[34] = {.index = 80, .length = 4}, [35] = {.index = 80, .length = 4},
[35] = {.index = 84, .length = 2}, [36] = {.index = 84, .length = 2},
}; };
static const TSFieldMapEntry ts_field_map_entries[] = { static const TSFieldMapEntry ts_field_map_entries[] = {
@ -859,9 +866,30 @@ 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},
[5] = {
[0] = alias_sym_type_identifier,
},
[7] = { [7] = {
[1] = anon_sym_DASH, [1] = anon_sym_DASH,
}, },
[15] = {
[0] = alias_sym_type_identifier,
},
[23] = {
[3] = alias_sym_type_identifier,
},
[24] = {
[0] = alias_sym_type_identifier,
},
[25] = {
[0] = alias_sym_type_identifier,
},
[32] = {
[3] = alias_sym_type_identifier,
},
[33] = {
[0] = alias_sym_type_identifier,
},
}; };
static const uint16_t ts_non_terminal_alias_map[] = { static const uint16_t ts_non_terminal_alias_map[] = {
@ -5269,9 +5297,9 @@ static const TSParseActionEntry ts_parse_actions[] = {
[54] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), [54] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53),
[56] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expr, 1), [56] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expr, 1),
[58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), [58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54),
[60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_value, 4, .production_id = 17), [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_value, 4, .production_id = 18),
[62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_array_value, 4, .production_id = 17), [62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_array_value, 4, .production_id = 18),
[64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_expression, 6, .production_id = 23), [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_expression, 6, .production_id = 24),
[66] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), [66] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47),
[68] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), [68] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48),
[70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49),
@ -5280,24 +5308,24 @@ static const TSParseActionEntry ts_parse_actions[] = {
[76] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), [76] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51),
[78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 4, .production_id = 10), [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 4, .production_id = 10),
[80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 4, .production_id = 10), [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 4, .production_id = 10),
[82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 6, .production_id = 26), [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 6, .production_id = 27),
[84] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 6, .production_id = 26), [84] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 6, .production_id = 27),
[86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_if_expression, 6, .production_id = 25), [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_if_expression, 6, .production_id = 26),
[88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 6, .production_id = 24), [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 6, .production_id = 25),
[90] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 6, .production_id = 24), [90] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 6, .production_id = 25),
[92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 3), [92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 3),
[94] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 3), [94] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 3),
[96] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 5, .production_id = 20), [96] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 5, .production_id = 21),
[98] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 5, .production_id = 20), [98] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 5, .production_id = 21),
[100] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 5, .production_id = 19), [100] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 5, .production_id = 20),
[102] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 5, .production_id = 19), [102] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 5, .production_id = 20),
[104] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 5, .production_id = 18), [104] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 5, .production_id = 19),
[106] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 5, .production_id = 18), [106] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 5, .production_id = 19),
[108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 4, .production_id = 14), [108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 4, .production_id = 14),
[110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 4, .production_id = 14), [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 4, .production_id = 14),
[112] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 4, .production_id = 13), [112] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_let_expression, 4, .production_id = 13),
[114] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 4, .production_id = 13), [114] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_let_expression, 4, .production_id = 13),
[116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_for_expression, 8, .production_id = 34), [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_for_expression, 8, .production_id = 35),
[118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_while_expression, 4, .production_id = 12), [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_while_expression, 4, .production_id = 12),
[120] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 2), [120] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 2),
[122] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 2), [122] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 2),
@ -5307,8 +5335,8 @@ static const TSParseActionEntry ts_parse_actions[] = {
[130] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 4), [130] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 4),
[132] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 3), [132] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 3),
[134] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 3), [134] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 3),
[136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 7, .production_id = 32), [136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 7, .production_id = 33),
[138] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 7, .production_id = 32), [138] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 7, .production_id = 33),
[140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 2), [140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 2),
[142] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 2), [142] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 2),
[144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment_expression, 3, .production_id = 9), [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment_expression, 3, .production_id = 9),
@ -5355,9 +5383,9 @@ static const TSParseActionEntry ts_parse_actions[] = {
[226] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), [226] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18),
[228] = {.entry = {.count = 1, .reusable = false}}, SHIFT(74), [228] = {.entry = {.count = 1, .reusable = false}}, SHIFT(74),
[230] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20), [230] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20),
[232] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_declaration, 4, .production_id = 16), [232] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_declaration, 4, .production_id = 17),
[234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable_declaration, 4, .production_id = 15), [234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable_declaration, 4, .production_id = 16),
[236] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable_declaration, 6, .production_id = 31), [236] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable_declaration, 6, .production_id = 32),
[238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2), [238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2),
[240] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2), SHIFT_REPEAT(147), [240] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2), SHIFT_REPEAT(147),
[243] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2), SHIFT_REPEAT(128), [243] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunks, 2), SHIFT_REPEAT(128),
@ -5381,7 +5409,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
[283] = {.entry = {.count = 1, .reusable = true}}, SHIFT(143), [283] = {.entry = {.count = 1, .reusable = true}}, SHIFT(143),
[285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10),
[287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), [287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22),
[289] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 4, .production_id = 35), [289] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 4, .production_id = 36),
[291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), [291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2),
[293] = {.entry = {.count = 1, .reusable = true}}, SHIFT(136), [293] = {.entry = {.count = 1, .reusable = true}}, SHIFT(136),
[295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), [295] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63),
@ -5392,47 +5420,47 @@ static const TSParseActionEntry ts_parse_actions[] = {
[305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2), [305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2),
[307] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2), SHIFT_REPEAT(128), [307] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2), SHIFT_REPEAT(128),
[310] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2), SHIFT_REPEAT(123), [310] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat2, 2), SHIFT_REPEAT(123),
[313] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 4, .production_id = 29), [313] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 4, .production_id = 30),
[315] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat1, 2), [315] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat1, 2),
[317] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat1, 2), SHIFT_REPEAT(147), [317] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__declaration_chunk_repeat1, 2), SHIFT_REPEAT(147),
[320] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 3, .production_id = 21), [320] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 3, .production_id = 22),
[322] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 2), [322] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parameters, 2),
[324] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__function_declaration_common, 2, .production_id = 6), [324] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__function_declaration_common, 2, .production_id = 6),
[326] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144), [326] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144),
[328] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__function_declaration_common, 4, .production_id = 22), [328] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__function_declaration_common, 4, .production_id = 23),
[330] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_alias, 1), [330] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_alias, 1, .production_id = 15),
[332] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_type, 3, .production_id = 27), [332] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_type, 3, .production_id = 28),
[334] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_primitive_declaration, 2, .production_id = 2), [334] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_primitive_declaration, 2, .production_id = 2),
[336] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_declaration, 4, .production_id = 15), [336] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_declaration, 4, .production_id = 16),
[338] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 4, .production_id = 29), [338] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 4, .production_id = 30),
[340] = {.entry = {.count = 1, .reusable = false}}, SHIFT(93), [340] = {.entry = {.count = 1, .reusable = false}}, SHIFT(93),
[342] = {.entry = {.count = 1, .reusable = true}}, SHIFT(111), [342] = {.entry = {.count = 1, .reusable = true}}, SHIFT(111),
[344] = {.entry = {.count = 1, .reusable = false}}, SHIFT(137), [344] = {.entry = {.count = 1, .reusable = false}}, SHIFT(137),
[346] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 2), [346] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 2),
[348] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 3, .production_id = 21), [348] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_type, 3, .production_id = 22),
[350] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_declaration, 2, .production_id = 3), [350] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_declaration, 2, .production_id = 3),
[352] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), [352] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19),
[354] = {.entry = {.count = 1, .reusable = true}}, SHIFT(103), [354] = {.entry = {.count = 1, .reusable = true}}, SHIFT(103),
[356] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31), [356] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31),
[358] = {.entry = {.count = 1, .reusable = true}}, SHIFT(106), [358] = {.entry = {.count = 1, .reusable = true}}, SHIFT(106),
[360] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), SHIFT_REPEAT(62), [360] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), SHIFT_REPEAT(62),
[363] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 30), SHIFT_REPEAT(127), [363] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 31), SHIFT_REPEAT(127),
[366] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 30), [366] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 31),
[368] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_literal_repeat1, 2), [368] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_literal_repeat1, 2),
[370] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_literal_repeat1, 2), SHIFT_REPEAT(106), [370] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_literal_repeat1, 2), SHIFT_REPEAT(106),
[373] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 21), [373] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_type_repeat1, 2, .production_id = 22),
[375] = {.entry = {.count = 1, .reusable = true}}, SHIFT(127), [375] = {.entry = {.count = 1, .reusable = true}}, SHIFT(127),
[377] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), [377] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87),
[379] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), SHIFT_REPEAT(55), [379] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), SHIFT_REPEAT(55),
[382] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__typed_field, 3, .production_id = 28), [382] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__typed_field, 3, .production_id = 29),
[384] = {.entry = {.count = 1, .reusable = true}}, SHIFT(145), [384] = {.entry = {.count = 1, .reusable = true}}, SHIFT(145),
[386] = {.entry = {.count = 1, .reusable = true}}, SHIFT(99), [386] = {.entry = {.count = 1, .reusable = true}}, SHIFT(99),
[388] = {.entry = {.count = 1, .reusable = true}}, SHIFT(97), [388] = {.entry = {.count = 1, .reusable = true}}, SHIFT(97),
[390] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), [390] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
[392] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), [392] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21),
[394] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [394] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
[396] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 33), SHIFT_REPEAT(143), [396] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 34), SHIFT_REPEAT(143),
[399] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 33), [399] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 34),
[401] = {.entry = {.count = 1, .reusable = true}}, SHIFT(100), [401] = {.entry = {.count = 1, .reusable = true}}, SHIFT(100),
[403] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), [403] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23),
[405] = {.entry = {.count = 1, .reusable = true}}, SHIFT(89), [405] = {.entry = {.count = 1, .reusable = true}}, SHIFT(89),

View file

@ -18,7 +18,7 @@ type alias = int
(type_declaration (type_declaration
name: (identifier) name: (identifier)
value: (type_alias value: (type_alias
(identifier)))) (type_identifier))))
================================================================================ ================================================================================
Record type declaration Record type declaration
@ -146,7 +146,7 @@ function func(a: int, b: int) : string = "string"
type: (identifier) type: (identifier)
name: (identifier) name: (identifier)
type: (identifier)) type: (identifier))
return_type: (identifier) return_type: (type_identifier)
body: (string_literal))) body: (string_literal)))
================================================================================ ================================================================================
@ -204,7 +204,7 @@ primitive prim() : int
(primitive_declaration (primitive_declaration
name: (identifier) name: (identifier)
parameters: (parameters) parameters: (parameters)
return_type: (identifier))) return_type: (type_identifier)))
================================================================================ ================================================================================
Variable declaration Variable declaration
@ -230,7 +230,7 @@ var a : int := 27
(source_file (source_file
(variable_declaration (variable_declaration
name: (identifier) name: (identifier)
type: (identifier) type: (type_identifier)
value: (integer_literal))) value: (integer_literal)))
================================================================================ ================================================================================

View file

@ -8,7 +8,7 @@ array_of_int[42] of 0
(source_file (source_file
(array_expression (array_expression
type: (identifier) type: (type_identifier)
size: (integer_literal) size: (integer_literal)
init: (integer_literal))) init: (integer_literal)))
@ -22,10 +22,10 @@ array_of_array_of_int[12] of array_of_int[27] of 0
(source_file (source_file
(array_expression (array_expression
type: (identifier) type: (type_identifier)
size: (integer_literal) size: (integer_literal)
init: (array_expression init: (array_expression
type: (identifier) type: (type_identifier)
size: (integer_literal) size: (integer_literal)
init: (integer_literal)))) init: (integer_literal))))
@ -39,7 +39,7 @@ record_type { a = 12, b = "27" }
(source_file (source_file
(record_expression (record_expression
type: (identifier) type: (type_identifier)
field: (identifier) field: (identifier)
init: (integer_literal) init: (integer_literal)
field: (identifier) field: (identifier)
@ -55,7 +55,7 @@ record_type { a = 12 }
(source_file (source_file
(record_expression (record_expression
type: (identifier) type: (type_identifier)
field: (identifier) field: (identifier)
init: (integer_literal))) init: (integer_literal)))
@ -69,7 +69,7 @@ record_type {}
(source_file (source_file
(record_expression (record_expression
type: (identifier))) type: (type_identifier)))
================================================================================ ================================================================================
Record expression trailing comma Record expression trailing comma
@ -81,7 +81,7 @@ record_type { a = 12, }
(source_file (source_file
(record_expression (record_expression
type: (identifier) type: (type_identifier)
field: (identifier) field: (identifier)
init: (integer_literal) init: (integer_literal)
(ERROR))) (ERROR)))