diff --git a/grammar.js b/grammar.js index 3d18354..b49ace8 100644 --- a/grammar.js +++ b/grammar.js @@ -47,6 +47,8 @@ module.exports = grammar({ $.sequence_expression, $.assignment_expression, + + $.if_expression, ), nil_literal: (_) => "nil", @@ -167,6 +169,21 @@ module.exports = grammar({ field("right", $._expr), ), ), + + if_expression: ($) => prec.right( + seq( + "if", + field("condition", $._expr), + "then", + field("consequence", $._expr), + optional( + seq( + "else", + field("alternative", $._expr), + ), + ), + ), + ), } }); diff --git a/src/grammar.json b/src/grammar.json index c2a4450..0f8ee30 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -57,6 +57,10 @@ { "type": "SYMBOL", "name": "assignment_expression" + }, + { + "type": "SYMBOL", + "name": "if_expression" } ] }, @@ -785,6 +789,64 @@ } ] } + }, + "if_expression": { + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "if" + }, + { + "type": "FIELD", + "name": "condition", + "content": { + "type": "SYMBOL", + "name": "_expr" + } + }, + { + "type": "STRING", + "value": "then" + }, + { + "type": "FIELD", + "name": "consequence", + "content": { + "type": "SYMBOL", + "name": "_expr" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "else" + }, + { + "type": "FIELD", + "name": "alternative", + "content": { + "type": "SYMBOL", + "name": "_expr" + } + } + ] + }, + { + "type": "BLANK" + } + ] + } + ] + } } }, "extras": [ diff --git a/src/node-types.json b/src/node-types.json index da45bde..013d360 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -31,6 +31,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -89,6 +93,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -181,6 +189,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -263,6 +275,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -327,6 +343,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -395,6 +415,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -463,6 +487,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -505,6 +533,198 @@ } } }, + { + "type": "if_expression", + "named": true, + "fields": { + "alternative": { + "multiple": false, + "required": false, + "types": [ + { + "type": "array_expression", + "named": true + }, + { + "type": "array_value", + "named": true + }, + { + "type": "assignment_expression", + "named": true + }, + { + "type": "binary_expression", + "named": true + }, + { + "type": "function_call", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "if_expression", + "named": true + }, + { + "type": "integer_literal", + "named": true + }, + { + "type": "nil_literal", + "named": true + }, + { + "type": "record_expression", + "named": true + }, + { + "type": "record_value", + "named": true + }, + { + "type": "sequence_expression", + "named": true + }, + { + "type": "string_literal", + "named": true + }, + { + "type": "unary_expression", + "named": true + } + ] + }, + "condition": { + "multiple": false, + "required": true, + "types": [ + { + "type": "array_expression", + "named": true + }, + { + "type": "array_value", + "named": true + }, + { + "type": "assignment_expression", + "named": true + }, + { + "type": "binary_expression", + "named": true + }, + { + "type": "function_call", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "if_expression", + "named": true + }, + { + "type": "integer_literal", + "named": true + }, + { + "type": "nil_literal", + "named": true + }, + { + "type": "record_expression", + "named": true + }, + { + "type": "record_value", + "named": true + }, + { + "type": "sequence_expression", + "named": true + }, + { + "type": "string_literal", + "named": true + }, + { + "type": "unary_expression", + "named": true + } + ] + }, + "consequence": { + "multiple": false, + "required": true, + "types": [ + { + "type": "array_expression", + "named": true + }, + { + "type": "array_value", + "named": true + }, + { + "type": "assignment_expression", + "named": true + }, + { + "type": "binary_expression", + "named": true + }, + { + "type": "function_call", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "if_expression", + "named": true + }, + { + "type": "integer_literal", + "named": true + }, + { + "type": "nil_literal", + "named": true + }, + { + "type": "record_expression", + "named": true + }, + { + "type": "record_value", + "named": true + }, + { + "type": "sequence_expression", + "named": true + }, + { + "type": "string_literal", + "named": true + }, + { + "type": "unary_expression", + "named": true + } + ] + } + } + }, { "type": "record_expression", "named": true, @@ -547,6 +767,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -655,6 +879,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -718,6 +946,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -796,6 +1028,10 @@ "type": "identifier", "named": true }, + { + "type": "if_expression", + "named": true + }, { "type": "integer_literal", "named": true @@ -878,6 +1114,10 @@ "type": "]", "named": false }, + { + "type": "else", + "named": false + }, { "type": "escape_sequence", "named": true @@ -886,6 +1126,10 @@ "type": "identifier", "named": true }, + { + "type": "if", + "named": false + }, { "type": "integer_literal", "named": true @@ -902,6 +1146,10 @@ "type": "operator", "named": true }, + { + "type": "then", + "named": false + }, { "type": "{", "named": false diff --git a/src/parser.c b/src/parser.c index d2daaa7..8ebd70b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,15 +6,15 @@ #endif #define LANGUAGE_VERSION 13 -#define STATE_COUNT 66 +#define STATE_COUNT 72 #define LARGE_STATE_COUNT 2 -#define SYMBOL_COUNT 47 +#define SYMBOL_COUNT 51 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 30 +#define TOKEN_COUNT 33 #define EXTERNAL_TOKEN_COUNT 0 -#define FIELD_COUNT 13 +#define FIELD_COUNT 16 #define MAX_ALIAS_SEQUENCE_LENGTH 7 -#define PRODUCTION_ID_COUNT 15 +#define PRODUCTION_ID_COUNT 17 enum { sym_identifier = 1, @@ -46,23 +46,27 @@ enum { anon_sym_LBRACE = 27, anon_sym_RBRACE = 28, anon_sym_COLON_EQ = 29, - sym_source_file = 30, - sym__expr = 31, - sym_string_literal = 32, - sym__lvalue = 33, - sym_record_value = 34, - sym_array_value = 35, - sym_function_call = 36, - sym_unary_expression = 37, - sym_binary_expression = 38, - sym_sequence_expression = 39, - sym_array_expression = 40, - sym_record_expression = 41, - sym_assignment_expression = 42, - aux_sym_string_literal_repeat1 = 43, - aux_sym_function_call_repeat1 = 44, - aux_sym_sequence_expression_repeat1 = 45, - aux_sym_record_expression_repeat1 = 46, + anon_sym_if = 30, + anon_sym_then = 31, + anon_sym_else = 32, + sym_source_file = 33, + sym__expr = 34, + sym_string_literal = 35, + sym__lvalue = 36, + sym_record_value = 37, + sym_array_value = 38, + sym_function_call = 39, + sym_unary_expression = 40, + sym_binary_expression = 41, + sym_sequence_expression = 42, + sym_array_expression = 43, + sym_record_expression = 44, + sym_assignment_expression = 45, + sym_if_expression = 46, + aux_sym_string_literal_repeat1 = 47, + aux_sym_function_call_repeat1 = 48, + aux_sym_sequence_expression_repeat1 = 49, + aux_sym_record_expression_repeat1 = 50, }; static const char * const ts_symbol_names[] = { @@ -96,6 +100,9 @@ static const char * const ts_symbol_names[] = { [anon_sym_LBRACE] = "{", [anon_sym_RBRACE] = "}", [anon_sym_COLON_EQ] = ":=", + [anon_sym_if] = "if", + [anon_sym_then] = "then", + [anon_sym_else] = "else", [sym_source_file] = "source_file", [sym__expr] = "_expr", [sym_string_literal] = "string_literal", @@ -109,6 +116,7 @@ static const char * const ts_symbol_names[] = { [sym_array_expression] = "array_expression", [sym_record_expression] = "record_expression", [sym_assignment_expression] = "assignment_expression", + [sym_if_expression] = "if_expression", [aux_sym_string_literal_repeat1] = "string_literal_repeat1", [aux_sym_function_call_repeat1] = "function_call_repeat1", [aux_sym_sequence_expression_repeat1] = "sequence_expression_repeat1", @@ -146,6 +154,9 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_LBRACE] = anon_sym_LBRACE, [anon_sym_RBRACE] = anon_sym_RBRACE, [anon_sym_COLON_EQ] = anon_sym_COLON_EQ, + [anon_sym_if] = anon_sym_if, + [anon_sym_then] = anon_sym_then, + [anon_sym_else] = anon_sym_else, [sym_source_file] = sym_source_file, [sym__expr] = sym__expr, [sym_string_literal] = sym_string_literal, @@ -159,6 +170,7 @@ static const TSSymbol ts_symbol_map[] = { [sym_array_expression] = sym_array_expression, [sym_record_expression] = sym_record_expression, [sym_assignment_expression] = sym_assignment_expression, + [sym_if_expression] = sym_if_expression, [aux_sym_string_literal_repeat1] = aux_sym_string_literal_repeat1, [aux_sym_function_call_repeat1] = aux_sym_function_call_repeat1, [aux_sym_sequence_expression_repeat1] = aux_sym_sequence_expression_repeat1, @@ -286,6 +298,18 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, + [anon_sym_if] = { + .visible = true, + .named = false, + }, + [anon_sym_then] = { + .visible = true, + .named = false, + }, + [anon_sym_else] = { + .visible = true, + .named = false, + }, [sym_source_file] = { .visible = true, .named = true, @@ -338,6 +362,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_if_expression] = { + .visible = true, + .named = true, + }, [aux_sym_string_literal_repeat1] = { .visible = false, .named = false, @@ -357,25 +385,31 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { }; enum { - field_arguments = 1, - field_array = 2, - field_expression = 3, - field_field = 4, - field_function = 5, - field_index = 6, - field_init = 7, - field_left = 8, - field_operator = 9, - field_record = 10, - field_right = 11, - field_size = 12, - field_type = 13, + field_alternative = 1, + field_arguments = 2, + field_array = 3, + field_condition = 4, + field_consequence = 5, + field_expression = 6, + field_field = 7, + field_function = 8, + field_index = 9, + field_init = 10, + field_left = 11, + field_operator = 12, + field_record = 13, + field_right = 14, + field_size = 15, + field_type = 16, }; static const char * const ts_field_names[] = { [0] = NULL, + [field_alternative] = "alternative", [field_arguments] = "arguments", [field_array] = "array", + [field_condition] = "condition", + [field_consequence] = "consequence", [field_expression] = "expression", [field_field] = "field", [field_function] = "function", @@ -398,12 +432,14 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [6] = {.index = 9, .length = 2}, [7] = {.index = 11, .length = 2}, [8] = {.index = 13, .length = 2}, - [9] = {.index = 15, .length = 3}, - [10] = {.index = 18, .length = 3}, - [11] = {.index = 21, .length = 3}, - [12] = {.index = 24, .length = 5}, - [13] = {.index = 29, .length = 4}, - [14] = {.index = 33, .length = 2}, + [9] = {.index = 15, .length = 2}, + [10] = {.index = 17, .length = 3}, + [11] = {.index = 20, .length = 3}, + [12] = {.index = 23, .length = 3}, + [13] = {.index = 26, .length = 3}, + [14] = {.index = 29, .length = 5}, + [15] = {.index = 34, .length = 4}, + [16] = {.index = 38, .length = 2}, }; static const TSFieldMapEntry ts_field_map_entries[] = { @@ -428,32 +464,39 @@ static const TSFieldMapEntry ts_field_map_entries[] = { {field_arguments, 2}, {field_function, 0}, [13] = + {field_condition, 1}, + {field_consequence, 3}, + [15] = {field_array, 0}, {field_index, 2}, - [15] = + [17] = {field_arguments, 2}, {field_arguments, 3}, {field_function, 0}, - [18] = + [20] = {field_init, 5}, {field_size, 2}, {field_type, 0}, - [21] = + [23] = {field_field, 2}, {field_init, 4}, {field_type, 0}, - [24] = + [26] = + {field_alternative, 5}, + {field_condition, 1}, + {field_consequence, 3}, + [29] = {field_field, 2}, {field_field, 5, .inherited = true}, {field_init, 4}, {field_init, 5, .inherited = true}, {field_type, 0}, - [29] = + [34] = {field_field, 0, .inherited = true}, {field_field, 1, .inherited = true}, {field_init, 0, .inherited = true}, {field_init, 1, .inherited = true}, - [33] = + [38] = {field_field, 1}, {field_init, 3}, }; @@ -491,7 +534,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(29); if (lookahead == '>') ADVANCE(32); if (lookahead == '[') ADVANCE(18); - if (lookahead == '\\') ADVANCE(6); + if (lookahead == '\\') ADVANCE(5); if (lookahead == ']') ADVANCE(19); if (lookahead == '{') ADVANCE(36); if (lookahead == '|') ADVANCE(34); @@ -499,7 +542,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(9) + lookahead == ' ') SKIP(8) if (('0' <= lookahead && lookahead <= '9')) ADVANCE(11); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || @@ -507,7 +550,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 1: if (lookahead == '"') ADVANCE(12); - if (lookahead == '\\') ADVANCE(6); + if (lookahead == '\\') ADVANCE(5); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || @@ -518,23 +561,12 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(38); END_STATE(); case 3: - if (lookahead == '}') ADVANCE(37); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(3) - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(15); - END_STATE(); - case 4: if (('0' <= lookahead && lookahead <= '7')) ADVANCE(16); END_STATE(); - case 5: - if (('0' <= lookahead && lookahead <= '7')) ADVANCE(4); + case 4: + if (('0' <= lookahead && lookahead <= '7')) ADVANCE(3); END_STATE(); - case 6: + case 5: if (lookahead == '"' || lookahead == '\\' || lookahead == 'a' || @@ -544,20 +576,20 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == 'r' || lookahead == 't' || lookahead == 'v') ADVANCE(16); - if (lookahead == 'x') ADVANCE(8); - if (('0' <= lookahead && lookahead <= '3')) ADVANCE(5); + if (lookahead == 'x') ADVANCE(7); + if (('0' <= lookahead && lookahead <= '3')) ADVANCE(4); END_STATE(); - case 7: + case 6: if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'F') || ('a' <= lookahead && lookahead <= 'f')) ADVANCE(16); END_STATE(); - case 8: + case 7: if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(7); + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(6); END_STATE(); - case 9: + case 8: if (eof) ADVANCE(10); if (lookahead == '"') ADVANCE(12); if (lookahead == '&') ADVANCE(33); @@ -582,12 +614,42 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(9) + lookahead == ' ') SKIP(8) if (('0' <= lookahead && lookahead <= '9')) ADVANCE(11); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(15); END_STATE(); + case 9: + if (eof) ADVANCE(10); + if (lookahead == '&') ADVANCE(33); + if (lookahead == '(') ADVANCE(20); + if (lookahead == ')') ADVANCE(22); + if (lookahead == '*') ADVANCE(24); + if (lookahead == '+') ADVANCE(26); + if (lookahead == ',') ADVANCE(21); + if (lookahead == '-') ADVANCE(23); + if (lookahead == '.') ADVANCE(17); + if (lookahead == '/') ADVANCE(25); + if (lookahead == ':') ADVANCE(2); + if (lookahead == ';') ADVANCE(35); + if (lookahead == '<') ADVANCE(31); + if (lookahead == '=') ADVANCE(29); + if (lookahead == '>') ADVANCE(32); + if (lookahead == '[') ADVANCE(18); + if (lookahead == ']') ADVANCE(19); + if (lookahead == '{') ADVANCE(36); + if (lookahead == '|') ADVANCE(34); + if (lookahead == '}') ADVANCE(37); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(9) + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(15); + END_STATE(); case 10: ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); @@ -706,28 +768,61 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (lookahead == 'n') ADVANCE(1); - if (lookahead == 'o') ADVANCE(2); + if (lookahead == 'e') ADVANCE(1); + if (lookahead == 'i') ADVANCE(2); + if (lookahead == 'n') ADVANCE(3); + if (lookahead == 'o') ADVANCE(4); + if (lookahead == 't') ADVANCE(5); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0) END_STATE(); case 1: - if (lookahead == 'i') ADVANCE(3); + if (lookahead == 'l') ADVANCE(6); END_STATE(); case 2: - if (lookahead == 'f') ADVANCE(4); + if (lookahead == 'f') ADVANCE(7); END_STATE(); case 3: - if (lookahead == 'l') ADVANCE(5); + if (lookahead == 'i') ADVANCE(8); END_STATE(); case 4: - ACCEPT_TOKEN(anon_sym_of); + if (lookahead == 'f') ADVANCE(9); END_STATE(); case 5: + if (lookahead == 'h') ADVANCE(10); + END_STATE(); + case 6: + if (lookahead == 's') ADVANCE(11); + END_STATE(); + case 7: + ACCEPT_TOKEN(anon_sym_if); + END_STATE(); + case 8: + if (lookahead == 'l') ADVANCE(12); + END_STATE(); + case 9: + ACCEPT_TOKEN(anon_sym_of); + END_STATE(); + case 10: + if (lookahead == 'e') ADVANCE(13); + END_STATE(); + case 11: + if (lookahead == 'e') ADVANCE(14); + END_STATE(); + case 12: ACCEPT_TOKEN(sym_nil_literal); END_STATE(); + case 13: + if (lookahead == 'n') ADVANCE(15); + END_STATE(); + case 14: + ACCEPT_TOKEN(anon_sym_else); + END_STATE(); + case 15: + ACCEPT_TOKEN(anon_sym_then); + END_STATE(); default: return false; } @@ -736,70 +831,76 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, [1] = {.lex_state = 0}, - [2] = {.lex_state = 0}, - [3] = {.lex_state = 0}, - [4] = {.lex_state = 0}, - [5] = {.lex_state = 0}, + [2] = {.lex_state = 9}, + [3] = {.lex_state = 9}, + [4] = {.lex_state = 9}, + [5] = {.lex_state = 9}, [6] = {.lex_state = 0}, [7] = {.lex_state = 0}, [8] = {.lex_state = 0}, [9] = {.lex_state = 0}, [10] = {.lex_state = 0}, - [11] = {.lex_state = 0}, - [12] = {.lex_state = 0}, + [11] = {.lex_state = 9}, + [12] = {.lex_state = 9}, [13] = {.lex_state = 0}, - [14] = {.lex_state = 0}, - [15] = {.lex_state = 0}, - [16] = {.lex_state = 0}, - [17] = {.lex_state = 0}, - [18] = {.lex_state = 0}, + [14] = {.lex_state = 9}, + [15] = {.lex_state = 9}, + [16] = {.lex_state = 9}, + [17] = {.lex_state = 9}, + [18] = {.lex_state = 9}, [19] = {.lex_state = 0}, [20] = {.lex_state = 0}, [21] = {.lex_state = 0}, [22] = {.lex_state = 0}, [23] = {.lex_state = 0}, - [24] = {.lex_state = 0}, + [24] = {.lex_state = 9}, [25] = {.lex_state = 0}, [26] = {.lex_state = 0}, - [27] = {.lex_state = 0}, - [28] = {.lex_state = 0}, + [27] = {.lex_state = 9}, + [28] = {.lex_state = 9}, [29] = {.lex_state = 0}, - [30] = {.lex_state = 0}, - [31] = {.lex_state = 0}, + [30] = {.lex_state = 9}, + [31] = {.lex_state = 9}, [32] = {.lex_state = 0}, - [33] = {.lex_state = 0}, - [34] = {.lex_state = 0}, + [33] = {.lex_state = 9}, + [34] = {.lex_state = 9}, [35] = {.lex_state = 0}, - [36] = {.lex_state = 0}, - [37] = {.lex_state = 0}, + [36] = {.lex_state = 9}, + [37] = {.lex_state = 9}, [38] = {.lex_state = 0}, - [39] = {.lex_state = 0}, - [40] = {.lex_state = 0}, - [41] = {.lex_state = 0}, - [42] = {.lex_state = 0}, + [39] = {.lex_state = 9}, + [40] = {.lex_state = 9}, + [41] = {.lex_state = 9}, + [42] = {.lex_state = 9}, [43] = {.lex_state = 0}, [44] = {.lex_state = 0}, - [45] = {.lex_state = 0}, + [45] = {.lex_state = 9}, [46] = {.lex_state = 0}, [47] = {.lex_state = 0}, [48] = {.lex_state = 0}, [49] = {.lex_state = 0}, - [50] = {.lex_state = 1}, - [51] = {.lex_state = 1}, - [52] = {.lex_state = 1}, + [50] = {.lex_state = 0}, + [51] = {.lex_state = 0}, + [52] = {.lex_state = 0}, [53] = {.lex_state = 0}, - [54] = {.lex_state = 0}, + [54] = {.lex_state = 9}, [55] = {.lex_state = 0}, - [56] = {.lex_state = 0}, - [57] = {.lex_state = 0}, - [58] = {.lex_state = 0}, - [59] = {.lex_state = 3}, + [56] = {.lex_state = 1}, + [57] = {.lex_state = 1}, + [58] = {.lex_state = 1}, + [59] = {.lex_state = 0}, [60] = {.lex_state = 0}, - [61] = {.lex_state = 3}, - [62] = {.lex_state = 3}, - [63] = {.lex_state = 3}, + [61] = {.lex_state = 0}, + [62] = {.lex_state = 0}, + [63] = {.lex_state = 0}, [64] = {.lex_state = 0}, - [65] = {.lex_state = 0}, + [65] = {.lex_state = 9}, + [66] = {.lex_state = 0}, + [67] = {.lex_state = 9}, + [68] = {.lex_state = 0}, + [69] = {.lex_state = 9}, + [70] = {.lex_state = 9}, + [71] = {.lex_state = 0}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { @@ -833,42 +934,47 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_LBRACE] = ACTIONS(1), [anon_sym_RBRACE] = ACTIONS(1), [anon_sym_COLON_EQ] = ACTIONS(1), + [anon_sym_if] = ACTIONS(1), + [anon_sym_then] = ACTIONS(1), + [anon_sym_else] = ACTIONS(1), }, [1] = { - [sym_source_file] = STATE(60), - [sym__expr] = STATE(48), - [sym_string_literal] = STATE(48), - [sym__lvalue] = STATE(3), - [sym_record_value] = STATE(3), - [sym_array_value] = STATE(3), - [sym_function_call] = STATE(48), - [sym_unary_expression] = STATE(48), - [sym_binary_expression] = STATE(48), - [sym_sequence_expression] = STATE(48), - [sym_array_expression] = STATE(48), - [sym_record_expression] = STATE(48), - [sym_assignment_expression] = STATE(48), + [sym_source_file] = STATE(68), + [sym__expr] = STATE(53), + [sym_string_literal] = STATE(53), + [sym__lvalue] = STATE(5), + [sym_record_value] = STATE(5), + [sym_array_value] = STATE(5), + [sym_function_call] = STATE(53), + [sym_unary_expression] = STATE(53), + [sym_binary_expression] = STATE(53), + [sym_sequence_expression] = STATE(53), + [sym_array_expression] = STATE(53), + [sym_record_expression] = STATE(53), + [sym_assignment_expression] = STATE(53), + [sym_if_expression] = STATE(53), [sym_identifier] = ACTIONS(3), [sym_nil_literal] = ACTIONS(5), [sym_integer_literal] = ACTIONS(5), [anon_sym_DQUOTE] = ACTIONS(7), [anon_sym_LPAREN] = ACTIONS(9), [anon_sym_DASH] = ACTIONS(11), + [anon_sym_if] = ACTIONS(13), }, }; static const uint16_t ts_small_parse_table[] = { [0] = 5, - ACTIONS(15), 1, + ACTIONS(17), 1, anon_sym_LBRACK, - ACTIONS(18), 1, + ACTIONS(20), 1, anon_sym_LPAREN, - ACTIONS(22), 1, + ACTIONS(24), 1, anon_sym_LBRACE, - ACTIONS(20), 2, + ACTIONS(22), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(13), 18, + ACTIONS(15), 20, ts_builtin_sym_end, anon_sym_DOT, anon_sym_RBRACK, @@ -887,38 +993,13 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SEMI, anon_sym_RBRACE, anon_sym_COLON_EQ, - [34] = 5, - ACTIONS(26), 1, - anon_sym_DOT, - ACTIONS(28), 1, - anon_sym_LBRACK, - ACTIONS(32), 1, - anon_sym_COLON_EQ, - ACTIONS(30), 2, + anon_sym_then, + anon_sym_else, + [36] = 2, + ACTIONS(28), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(24), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [66] = 2, - ACTIONS(36), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(34), 19, + ACTIONS(26), 21, ts_builtin_sym_end, anon_sym_DOT, anon_sym_LBRACK, @@ -938,14 +1019,46 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SEMI, anon_sym_RBRACE, anon_sym_COLON_EQ, - [92] = 2, + anon_sym_then, + anon_sym_else, + [64] = 2, + ACTIONS(32), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(30), 21, + ts_builtin_sym_end, + anon_sym_DOT, + anon_sym_LBRACK, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_COLON_EQ, + anon_sym_then, + anon_sym_else, + [92] = 5, + ACTIONS(36), 1, + anon_sym_DOT, + ACTIONS(38), 1, + anon_sym_LBRACK, + ACTIONS(42), 1, + anon_sym_COLON_EQ, ACTIONS(40), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(38), 19, + ACTIONS(34), 18, ts_builtin_sym_end, - anon_sym_DOT, - anon_sym_LBRACK, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, @@ -961,8 +1074,9 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - anon_sym_COLON_EQ, - [118] = 8, + anon_sym_then, + anon_sym_else, + [126] = 9, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -971,16 +1085,18 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, - ACTIONS(44), 1, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(46), 1, anon_sym_RPAREN, - ACTIONS(42), 2, + ACTIONS(44), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(42), 9, + STATE(47), 10, sym__expr, sym_string_literal, sym_function_call, @@ -990,7 +1106,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [154] = 8, + sym_if_expression, + [166] = 9, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -999,16 +1116,18 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, - ACTIONS(48), 1, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(50), 1, anon_sym_RPAREN, - ACTIONS(46), 2, + ACTIONS(48), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(41), 9, + STATE(46), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1018,42 +1137,107 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [190] = 2, + sym_if_expression, + [206] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(52), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(50), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(36), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [243] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [213] = 4, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(54), 2, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(17), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [280] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(49), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [317] = 2, ACTIONS(60), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(54), 12, + ACTIONS(58), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, @@ -1062,11 +1246,13 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [240] = 2, + anon_sym_then, + anon_sym_else, + [342] = 2, ACTIONS(64), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(62), 16, + ACTIONS(62), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, @@ -1083,7 +1269,9 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [263] = 7, + anon_sym_then, + anon_sym_else, + [367] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1092,14 +1280,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(66), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(45), 9, + STATE(55), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1109,37 +1299,37 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [296] = 7, - ACTIONS(3), 1, - sym_identifier, - ACTIONS(7), 1, - anon_sym_DQUOTE, - ACTIONS(9), 1, - anon_sym_LPAREN, - ACTIONS(11), 1, + sym_if_expression, + [404] = 4, + ACTIONS(70), 2, anon_sym_DASH, - ACTIONS(68), 2, - sym_nil_literal, - sym_integer_literal, - STATE(3), 3, - sym__lvalue, - sym_record_value, - sym_array_value, - STATE(49), 9, - sym__expr, - sym_string_literal, - sym_function_call, - sym_unary_expression, - sym_binary_expression, - sym_sequence_expression, - sym_array_expression, - sym_record_expression, - sym_assignment_expression, - [329] = 2, + anon_sym_PLUS, ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(74), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(70), 16, + ACTIONS(68), 14, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [433] = 2, + ACTIONS(78), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(76), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, @@ -1156,18 +1346,21 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [352] = 2, - ACTIONS(76), 2, + anon_sym_then, + anon_sym_else, + [458] = 3, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(74), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(74), 16, + ACTIONS(68), 16, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, anon_sym_PLUS, anon_sym_GT_EQ, anon_sym_LT_EQ, @@ -1177,54 +1370,65 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [375] = 2, - ACTIONS(80), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(78), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, + anon_sym_then, + anon_sym_else, + [485] = 7, + ACTIONS(86), 1, anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [398] = 7, ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, anon_sym_PIPE, - ACTIONS(56), 2, + ACTIONS(70), 2, anon_sym_DASH, anon_sym_PLUS, - ACTIONS(58), 2, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - ACTIONS(86), 2, + ACTIONS(84), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - ACTIONS(82), 6, + ACTIONS(80), 8, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, anon_sym_SEMI, anon_sym_RBRACE, - [431] = 7, + anon_sym_then, + anon_sym_else, + [520] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + ACTIONS(90), 8, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [555] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1233,14 +1437,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(92), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(35), 9, + STATE(16), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1250,7 +1456,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [464] = 7, + sym_if_expression, + [592] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1259,14 +1466,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(94), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(36), 9, + STATE(34), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1276,7 +1485,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [497] = 7, + sym_if_expression, + [629] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1285,14 +1495,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(96), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(9), 9, + STATE(14), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1302,7 +1514,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [530] = 7, + sym_if_expression, + [666] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1311,14 +1524,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(98), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(38), 9, + STATE(41), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1328,7 +1543,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [563] = 7, + sym_if_expression, + [703] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1337,14 +1553,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(100), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(39), 9, + STATE(42), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1354,59 +1572,31 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [596] = 7, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, - anon_sym_PIPE, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, + sym_if_expression, + [740] = 2, + ACTIONS(104), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - ACTIONS(102), 6, + ACTIONS(102), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [629] = 7, - ACTIONS(3), 1, - sym_identifier, - ACTIONS(7), 1, - anon_sym_DQUOTE, - ACTIONS(9), 1, - anon_sym_LPAREN, - ACTIONS(11), 1, - anon_sym_DASH, - ACTIONS(104), 2, - sym_nil_literal, - sym_integer_literal, - STATE(3), 3, - sym__lvalue, - sym_record_value, - sym_array_value, - STATE(47), 9, - sym__expr, - sym_string_literal, - sym_function_call, - sym_unary_expression, - sym_binary_expression, - sym_sequence_expression, - sym_array_expression, - sym_record_expression, - sym_assignment_expression, - [662] = 7, + anon_sym_then, + anon_sym_else, + [765] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1415,14 +1605,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(106), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(40), 9, + STATE(52), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1432,49 +1624,8 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [695] = 2, - ACTIONS(110), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(108), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [718] = 2, - ACTIONS(114), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(112), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [741] = 7, + sym_if_expression, + [802] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1483,14 +1634,96 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(108), 2, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(45), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [839] = 2, + ACTIONS(112), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(110), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [864] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + ACTIONS(114), 8, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [899] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(116), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(22), 9, + STATE(18), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1500,11 +1733,12 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [774] = 2, + sym_if_expression, + [936] = 2, ACTIONS(120), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(118), 16, + ACTIONS(118), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, @@ -1521,7 +1755,32 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [797] = 7, + anon_sym_then, + anon_sym_else, + [961] = 2, + ACTIONS(124), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(122), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [986] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1530,14 +1789,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, - ACTIONS(122), 2, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(126), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(16), 9, + STATE(28), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1547,32 +1808,12 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [830] = 2, - ACTIONS(126), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(124), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [853] = 2, + sym_if_expression, + [1023] = 2, ACTIONS(130), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(128), 16, + ACTIONS(128), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, @@ -1589,7 +1830,32 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [876] = 7, + anon_sym_then, + anon_sym_else, + [1048] = 2, + ACTIONS(74), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(68), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [1073] = 8, ACTIONS(3), 1, sym_identifier, ACTIONS(7), 1, @@ -1598,14 +1864,16 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LPAREN, ACTIONS(11), 1, anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, ACTIONS(132), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(43), 9, + STATE(51), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1615,113 +1883,78 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [909] = 7, - ACTIONS(3), 1, - sym_identifier, - ACTIONS(7), 1, - anon_sym_DQUOTE, - ACTIONS(9), 1, - anon_sym_LPAREN, - ACTIONS(11), 1, - anon_sym_DASH, - ACTIONS(134), 2, - sym_nil_literal, - sym_integer_literal, - STATE(3), 3, - sym__lvalue, - sym_record_value, - sym_array_value, - STATE(46), 9, - sym__expr, - sym_string_literal, - sym_function_call, - sym_unary_expression, - sym_binary_expression, - sym_sequence_expression, - sym_array_expression, - sym_record_expression, - sym_assignment_expression, - [942] = 2, - ACTIONS(138), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(136), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, + sym_if_expression, + [1110] = 8, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(136), 1, + anon_sym_else, + ACTIONS(70), 2, anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - anon_sym_PLUS, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [965] = 3, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(60), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(54), 14, + ACTIONS(134), 7, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [990] = 2, - ACTIONS(60), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(54), 16, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_DASH, - anon_sym_STAR, - anon_sym_SLASH, - anon_sym_PLUS, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [1013] = 7, - ACTIONS(3), 1, - sym_identifier, - ACTIONS(7), 1, - anon_sym_DQUOTE, - ACTIONS(9), 1, - anon_sym_LPAREN, - ACTIONS(11), 1, - anon_sym_DASH, + anon_sym_then, + [1147] = 2, ACTIONS(140), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(138), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + anon_sym_AMP, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [1172] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(142), 2, sym_nil_literal, sym_integer_literal, - STATE(3), 3, + STATE(5), 3, sym__lvalue, sym_record_value, sym_array_value, - STATE(44), 9, + STATE(48), 10, sym__expr, sym_string_literal, sym_function_call, @@ -1731,60 +1964,12 @@ static const uint16_t ts_small_parse_table[] = { sym_array_expression, sym_record_expression, sym_assignment_expression, - [1046] = 5, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, + sym_if_expression, + [1209] = 2, + ACTIONS(146), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - ACTIONS(54), 8, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_AMP, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [1075] = 6, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - ACTIONS(54), 7, - ts_builtin_sym_end, - anon_sym_RBRACK, - anon_sym_COMMA, - anon_sym_RPAREN, - anon_sym_PIPE, - anon_sym_SEMI, - anon_sym_RBRACE, - [1106] = 2, - ACTIONS(144), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(142), 16, + ACTIONS(144), 18, ts_builtin_sym_end, anon_sym_RBRACK, anon_sym_COMMA, @@ -1801,475 +1986,669 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_PIPE, anon_sym_SEMI, anon_sym_RBRACE, - [1129] = 9, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, - anon_sym_PIPE, - ACTIONS(146), 1, - anon_sym_COMMA, - ACTIONS(148), 1, - anon_sym_RPAREN, - STATE(55), 1, - aux_sym_function_call_repeat1, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, + anon_sym_then, + anon_sym_else, + [1234] = 2, + ACTIONS(150), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, + ACTIONS(148), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1163] = 9, - ACTIONS(88), 1, anon_sym_AMP, - ACTIONS(90), 1, anon_sym_PIPE, - ACTIONS(150), 1, - anon_sym_RPAREN, - ACTIONS(152), 1, anon_sym_SEMI, - STATE(54), 1, - aux_sym_sequence_expression_repeat1, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - [1197] = 9, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, - anon_sym_PIPE, - ACTIONS(154), 1, - anon_sym_COMMA, - ACTIONS(156), 1, anon_sym_RBRACE, - STATE(56), 1, - aux_sym_record_expression_repeat1, - ACTIONS(56), 2, + anon_sym_then, + anon_sym_else, + [1259] = 5, + ACTIONS(70), 2, anon_sym_DASH, anon_sym_PLUS, - ACTIONS(58), 2, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - ACTIONS(86), 2, + ACTIONS(84), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1231] = 7, - ACTIONS(88), 1, + ACTIONS(68), 10, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, anon_sym_AMP, - ACTIONS(90), 1, anon_sym_PIPE, - ACTIONS(56), 2, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [1290] = 6, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(70), 2, anon_sym_DASH, anon_sym_PLUS, - ACTIONS(58), 2, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - ACTIONS(86), 2, + ACTIONS(84), 2, anon_sym_LT, anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + ACTIONS(68), 9, + ts_builtin_sym_end, + anon_sym_RBRACK, + anon_sym_COMMA, + anon_sym_RPAREN, + anon_sym_PIPE, + anon_sym_SEMI, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [1323] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(152), 2, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(54), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [1360] = 8, + ACTIONS(3), 1, + sym_identifier, + ACTIONS(7), 1, + anon_sym_DQUOTE, + ACTIONS(9), 1, + anon_sym_LPAREN, + ACTIONS(11), 1, + anon_sym_DASH, + ACTIONS(13), 1, + anon_sym_if, + ACTIONS(154), 2, + sym_nil_literal, + sym_integer_literal, + STATE(5), 3, + sym__lvalue, + sym_record_value, + sym_array_value, + STATE(50), 10, + sym__expr, + sym_string_literal, + sym_function_call, + sym_unary_expression, + sym_binary_expression, + sym_sequence_expression, + sym_array_expression, + sym_record_expression, + sym_assignment_expression, + sym_if_expression, + [1397] = 2, ACTIONS(158), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(156), 18, + ts_builtin_sym_end, + anon_sym_RBRACK, anon_sym_COMMA, anon_sym_RPAREN, - ACTIONS(84), 4, + anon_sym_DASH, + anon_sym_STAR, + anon_sym_SLASH, + anon_sym_PLUS, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1260] = 7, - ACTIONS(88), 1, anon_sym_AMP, - ACTIONS(90), 1, anon_sym_PIPE, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(160), 2, - anon_sym_COMMA, - anon_sym_RBRACE, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - [1289] = 7, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, - anon_sym_PIPE, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(162), 2, - anon_sym_RPAREN, anon_sym_SEMI, - ACTIONS(84), 4, + anon_sym_RBRACE, + anon_sym_then, + anon_sym_else, + [1422] = 9, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(160), 1, + anon_sym_RPAREN, + ACTIONS(162), 1, + anon_sym_SEMI, + STATE(61), 1, + aux_sym_sequence_expression_repeat1, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1318] = 7, - ACTIONS(88), 1, + [1456] = 9, + ACTIONS(86), 1, anon_sym_AMP, - ACTIONS(90), 1, + ACTIONS(88), 1, anon_sym_PIPE, ACTIONS(164), 1, - anon_sym_RBRACK, - ACTIONS(56), 2, - anon_sym_DASH, - anon_sym_PLUS, - ACTIONS(58), 2, - anon_sym_STAR, - anon_sym_SLASH, - ACTIONS(86), 2, - anon_sym_LT, - anon_sym_GT, - ACTIONS(84), 4, - anon_sym_GT_EQ, - anon_sym_LT_EQ, - anon_sym_EQ, - anon_sym_LT_GT, - [1346] = 7, - ACTIONS(88), 1, - anon_sym_AMP, - ACTIONS(90), 1, - anon_sym_PIPE, + anon_sym_COMMA, ACTIONS(166), 1, - ts_builtin_sym_end, - ACTIONS(56), 2, + anon_sym_RPAREN, + STATE(64), 1, + aux_sym_function_call_repeat1, + ACTIONS(70), 2, anon_sym_DASH, anon_sym_PLUS, - ACTIONS(58), 2, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - ACTIONS(86), 2, + ACTIONS(84), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1374] = 7, - ACTIONS(88), 1, + [1490] = 9, + ACTIONS(86), 1, anon_sym_AMP, - ACTIONS(90), 1, + ACTIONS(88), 1, anon_sym_PIPE, ACTIONS(168), 1, - anon_sym_RBRACK, - ACTIONS(56), 2, + anon_sym_COMMA, + ACTIONS(170), 1, + anon_sym_RBRACE, + STATE(60), 1, + aux_sym_record_expression_repeat1, + ACTIONS(70), 2, anon_sym_DASH, anon_sym_PLUS, - ACTIONS(58), 2, + ACTIONS(72), 2, anon_sym_STAR, anon_sym_SLASH, - ACTIONS(86), 2, + ACTIONS(84), 2, anon_sym_LT, anon_sym_GT, - ACTIONS(84), 4, + ACTIONS(82), 4, anon_sym_GT_EQ, anon_sym_LT_EQ, anon_sym_EQ, anon_sym_LT_GT, - [1402] = 3, - ACTIONS(170), 1, - anon_sym_DQUOTE, - STATE(51), 1, - aux_sym_string_literal_repeat1, + [1524] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, ACTIONS(172), 2, - aux_sym_string_literal_token1, - sym_escape_sequence, - [1413] = 3, - ACTIONS(174), 1, - anon_sym_DQUOTE, - STATE(52), 1, - aux_sym_string_literal_repeat1, + anon_sym_COMMA, + anon_sym_RBRACE, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1553] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(174), 2, + anon_sym_COMMA, + anon_sym_RPAREN, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1582] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, ACTIONS(176), 2, - aux_sym_string_literal_token1, - sym_escape_sequence, - [1424] = 3, + anon_sym_RPAREN, + anon_sym_SEMI, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1611] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, ACTIONS(178), 1, + anon_sym_RBRACK, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1639] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(180), 1, + ts_builtin_sym_end, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1667] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(182), 1, + anon_sym_then, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1695] = 7, + ACTIONS(86), 1, + anon_sym_AMP, + ACTIONS(88), 1, + anon_sym_PIPE, + ACTIONS(184), 1, + anon_sym_RBRACK, + ACTIONS(70), 2, + anon_sym_DASH, + anon_sym_PLUS, + ACTIONS(72), 2, + anon_sym_STAR, + anon_sym_SLASH, + ACTIONS(84), 2, + anon_sym_LT, + anon_sym_GT, + ACTIONS(82), 4, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + anon_sym_EQ, + anon_sym_LT_GT, + [1723] = 3, + ACTIONS(186), 1, anon_sym_DQUOTE, - STATE(52), 1, + STATE(58), 1, aux_sym_string_literal_repeat1, - ACTIONS(180), 2, + ACTIONS(188), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [1435] = 3, - ACTIONS(158), 1, - anon_sym_RPAREN, - ACTIONS(183), 1, - anon_sym_COMMA, - STATE(53), 1, - aux_sym_function_call_repeat1, - [1445] = 3, - ACTIONS(152), 1, - anon_sym_SEMI, - ACTIONS(186), 1, - anon_sym_RPAREN, - STATE(58), 1, - aux_sym_sequence_expression_repeat1, - [1455] = 3, - ACTIONS(146), 1, - anon_sym_COMMA, - ACTIONS(188), 1, - anon_sym_RPAREN, - STATE(53), 1, - aux_sym_function_call_repeat1, - [1465] = 3, - ACTIONS(154), 1, - anon_sym_COMMA, + [1734] = 3, ACTIONS(190), 1, - anon_sym_RBRACE, + anon_sym_DQUOTE, STATE(57), 1, - aux_sym_record_expression_repeat1, - [1475] = 3, - ACTIONS(192), 1, - anon_sym_COMMA, + aux_sym_string_literal_repeat1, + ACTIONS(192), 2, + aux_sym_string_literal_token1, + sym_escape_sequence, + [1745] = 3, ACTIONS(195), 1, - anon_sym_RBRACE, + anon_sym_DQUOTE, STATE(57), 1, - aux_sym_record_expression_repeat1, - [1485] = 3, - ACTIONS(162), 1, + aux_sym_string_literal_repeat1, + ACTIONS(197), 2, + aux_sym_string_literal_token1, + sym_escape_sequence, + [1756] = 3, + ACTIONS(174), 1, anon_sym_RPAREN, - ACTIONS(197), 1, - anon_sym_SEMI, - STATE(58), 1, - aux_sym_sequence_expression_repeat1, - [1495] = 2, - ACTIONS(200), 1, - sym_identifier, + ACTIONS(199), 1, + anon_sym_COMMA, + STATE(59), 1, + aux_sym_function_call_repeat1, + [1766] = 3, + ACTIONS(168), 1, + anon_sym_COMMA, ACTIONS(202), 1, anon_sym_RBRACE, - [1502] = 1, + STATE(63), 1, + aux_sym_record_expression_repeat1, + [1776] = 3, + ACTIONS(162), 1, + anon_sym_SEMI, ACTIONS(204), 1, - ts_builtin_sym_end, - [1506] = 1, + anon_sym_RPAREN, + STATE(62), 1, + aux_sym_sequence_expression_repeat1, + [1786] = 3, + ACTIONS(176), 1, + anon_sym_RPAREN, ACTIONS(206), 1, - sym_identifier, - [1510] = 1, - ACTIONS(208), 1, - sym_identifier, - [1514] = 1, - ACTIONS(210), 1, - anon_sym_of, - [1518] = 1, + anon_sym_SEMI, + STATE(62), 1, + aux_sym_sequence_expression_repeat1, + [1796] = 3, + ACTIONS(209), 1, + anon_sym_COMMA, ACTIONS(212), 1, - anon_sym_EQ, - [1522] = 1, + anon_sym_RBRACE, + STATE(63), 1, + aux_sym_record_expression_repeat1, + [1806] = 3, + ACTIONS(164), 1, + anon_sym_COMMA, ACTIONS(214), 1, + anon_sym_RPAREN, + STATE(59), 1, + aux_sym_function_call_repeat1, + [1816] = 2, + ACTIONS(216), 1, + sym_identifier, + ACTIONS(218), 1, + anon_sym_RBRACE, + [1823] = 1, + ACTIONS(220), 1, + anon_sym_EQ, + [1827] = 1, + ACTIONS(222), 1, + anon_sym_of, + [1831] = 1, + ACTIONS(224), 1, + ts_builtin_sym_end, + [1835] = 1, + ACTIONS(226), 1, + sym_identifier, + [1839] = 1, + ACTIONS(228), 1, + sym_identifier, + [1843] = 1, + ACTIONS(230), 1, anon_sym_EQ, }; static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 34, - [SMALL_STATE(4)] = 66, + [SMALL_STATE(3)] = 36, + [SMALL_STATE(4)] = 64, [SMALL_STATE(5)] = 92, - [SMALL_STATE(6)] = 118, - [SMALL_STATE(7)] = 154, - [SMALL_STATE(8)] = 190, - [SMALL_STATE(9)] = 213, - [SMALL_STATE(10)] = 240, - [SMALL_STATE(11)] = 263, - [SMALL_STATE(12)] = 296, - [SMALL_STATE(13)] = 329, - [SMALL_STATE(14)] = 352, - [SMALL_STATE(15)] = 375, - [SMALL_STATE(16)] = 398, - [SMALL_STATE(17)] = 431, - [SMALL_STATE(18)] = 464, - [SMALL_STATE(19)] = 497, - [SMALL_STATE(20)] = 530, - [SMALL_STATE(21)] = 563, - [SMALL_STATE(22)] = 596, - [SMALL_STATE(23)] = 629, - [SMALL_STATE(24)] = 662, - [SMALL_STATE(25)] = 695, - [SMALL_STATE(26)] = 718, - [SMALL_STATE(27)] = 741, - [SMALL_STATE(28)] = 774, - [SMALL_STATE(29)] = 797, - [SMALL_STATE(30)] = 830, - [SMALL_STATE(31)] = 853, - [SMALL_STATE(32)] = 876, - [SMALL_STATE(33)] = 909, - [SMALL_STATE(34)] = 942, - [SMALL_STATE(35)] = 965, - [SMALL_STATE(36)] = 990, - [SMALL_STATE(37)] = 1013, - [SMALL_STATE(38)] = 1046, - [SMALL_STATE(39)] = 1075, - [SMALL_STATE(40)] = 1106, - [SMALL_STATE(41)] = 1129, - [SMALL_STATE(42)] = 1163, - [SMALL_STATE(43)] = 1197, - [SMALL_STATE(44)] = 1231, - [SMALL_STATE(45)] = 1260, - [SMALL_STATE(46)] = 1289, - [SMALL_STATE(47)] = 1318, - [SMALL_STATE(48)] = 1346, - [SMALL_STATE(49)] = 1374, - [SMALL_STATE(50)] = 1402, - [SMALL_STATE(51)] = 1413, - [SMALL_STATE(52)] = 1424, - [SMALL_STATE(53)] = 1435, - [SMALL_STATE(54)] = 1445, - [SMALL_STATE(55)] = 1455, - [SMALL_STATE(56)] = 1465, - [SMALL_STATE(57)] = 1475, - [SMALL_STATE(58)] = 1485, - [SMALL_STATE(59)] = 1495, - [SMALL_STATE(60)] = 1502, - [SMALL_STATE(61)] = 1506, - [SMALL_STATE(62)] = 1510, - [SMALL_STATE(63)] = 1514, - [SMALL_STATE(64)] = 1518, - [SMALL_STATE(65)] = 1522, + [SMALL_STATE(6)] = 126, + [SMALL_STATE(7)] = 166, + [SMALL_STATE(8)] = 206, + [SMALL_STATE(9)] = 243, + [SMALL_STATE(10)] = 280, + [SMALL_STATE(11)] = 317, + [SMALL_STATE(12)] = 342, + [SMALL_STATE(13)] = 367, + [SMALL_STATE(14)] = 404, + [SMALL_STATE(15)] = 433, + [SMALL_STATE(16)] = 458, + [SMALL_STATE(17)] = 485, + [SMALL_STATE(18)] = 520, + [SMALL_STATE(19)] = 555, + [SMALL_STATE(20)] = 592, + [SMALL_STATE(21)] = 629, + [SMALL_STATE(22)] = 666, + [SMALL_STATE(23)] = 703, + [SMALL_STATE(24)] = 740, + [SMALL_STATE(25)] = 765, + [SMALL_STATE(26)] = 802, + [SMALL_STATE(27)] = 839, + [SMALL_STATE(28)] = 864, + [SMALL_STATE(29)] = 899, + [SMALL_STATE(30)] = 936, + [SMALL_STATE(31)] = 961, + [SMALL_STATE(32)] = 986, + [SMALL_STATE(33)] = 1023, + [SMALL_STATE(34)] = 1048, + [SMALL_STATE(35)] = 1073, + [SMALL_STATE(36)] = 1110, + [SMALL_STATE(37)] = 1147, + [SMALL_STATE(38)] = 1172, + [SMALL_STATE(39)] = 1209, + [SMALL_STATE(40)] = 1234, + [SMALL_STATE(41)] = 1259, + [SMALL_STATE(42)] = 1290, + [SMALL_STATE(43)] = 1323, + [SMALL_STATE(44)] = 1360, + [SMALL_STATE(45)] = 1397, + [SMALL_STATE(46)] = 1422, + [SMALL_STATE(47)] = 1456, + [SMALL_STATE(48)] = 1490, + [SMALL_STATE(49)] = 1524, + [SMALL_STATE(50)] = 1553, + [SMALL_STATE(51)] = 1582, + [SMALL_STATE(52)] = 1611, + [SMALL_STATE(53)] = 1639, + [SMALL_STATE(54)] = 1667, + [SMALL_STATE(55)] = 1695, + [SMALL_STATE(56)] = 1723, + [SMALL_STATE(57)] = 1734, + [SMALL_STATE(58)] = 1745, + [SMALL_STATE(59)] = 1756, + [SMALL_STATE(60)] = 1766, + [SMALL_STATE(61)] = 1776, + [SMALL_STATE(62)] = 1786, + [SMALL_STATE(63)] = 1796, + [SMALL_STATE(64)] = 1806, + [SMALL_STATE(65)] = 1816, + [SMALL_STATE(66)] = 1823, + [SMALL_STATE(67)] = 1827, + [SMALL_STATE(68)] = 1831, + [SMALL_STATE(69)] = 1835, + [SMALL_STATE(70)] = 1839, + [SMALL_STATE(71)] = 1843, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2), - [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(48), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), - [13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__lvalue, 1), - [15] = {.entry = {.count = 2, .reusable = true}}, REDUCE(sym__lvalue, 1), SHIFT(12), - [18] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [20] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__lvalue, 1), - [22] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), - [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expr, 1), - [26] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), - [28] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), - [30] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expr, 1), - [32] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_value, 4, .production_id = 8), - [36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_array_value, 4, .production_id = 8), - [38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_value, 3, .production_id = 5), - [40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_value, 3, .production_id = 5), - [42] = {.entry = {.count = 1, .reusable = false}}, SHIFT(42), - [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [46] = {.entry = {.count = 1, .reusable = false}}, SHIFT(41), - [48] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), - [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 3), - [52] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 3), - [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 4), - [56] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [60] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_binary_expression, 3, .production_id = 4), - [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 2), - [64] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 2), - [66] = {.entry = {.count = 1, .reusable = false}}, SHIFT(45), - [68] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), - [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 7, .production_id = 12), - [72] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 7, .production_id = 12), - [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 2), - [76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 2), - [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 6, .production_id = 11), - [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 6, .production_id = 11), - [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_unary_expression, 2, .production_id = 1), - [84] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [86] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), - [88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [90] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), - [92] = {.entry = {.count = 1, .reusable = false}}, SHIFT(35), - [94] = {.entry = {.count = 1, .reusable = false}}, SHIFT(36), - [96] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), - [98] = {.entry = {.count = 1, .reusable = false}}, SHIFT(38), - [100] = {.entry = {.count = 1, .reusable = false}}, SHIFT(39), - [102] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_expression, 6, .production_id = 10), - [104] = {.entry = {.count = 1, .reusable = false}}, SHIFT(47), - [106] = {.entry = {.count = 1, .reusable = false}}, SHIFT(40), - [108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 3), - [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 3), - [112] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 5, .production_id = 9), - [114] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 5, .production_id = 9), - [116] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(53), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(43), + [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__lvalue, 1), + [17] = {.entry = {.count = 2, .reusable = true}}, REDUCE(sym__lvalue, 1), SHIFT(13), + [20] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [22] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__lvalue, 1), + [24] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), + [26] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_value, 4, .production_id = 9), + [28] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_array_value, 4, .production_id = 9), + [30] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_value, 3, .production_id = 5), + [32] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_value, 3, .production_id = 5), + [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expr, 1), + [36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), + [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__expr, 1), + [42] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [44] = {.entry = {.count = 1, .reusable = false}}, SHIFT(47), + [46] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), + [48] = {.entry = {.count = 1, .reusable = false}}, SHIFT(46), + [50] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [52] = {.entry = {.count = 1, .reusable = false}}, SHIFT(36), + [54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), + [56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), + [58] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 2), + [60] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 2), + [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 7, .production_id = 14), + [64] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 7, .production_id = 14), + [66] = {.entry = {.count = 1, .reusable = false}}, SHIFT(55), + [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_expression, 3, .production_id = 4), + [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [72] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [74] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_binary_expression, 3, .production_id = 4), + [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 2), + [78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 2), + [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_unary_expression, 2, .production_id = 1), + [82] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [84] = {.entry = {.count = 1, .reusable = false}}, SHIFT(21), + [86] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_if_expression, 6, .production_id = 13), + [92] = {.entry = {.count = 1, .reusable = false}}, SHIFT(16), + [94] = {.entry = {.count = 1, .reusable = false}}, SHIFT(34), + [96] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), + [98] = {.entry = {.count = 1, .reusable = false}}, SHIFT(41), + [100] = {.entry = {.count = 1, .reusable = false}}, SHIFT(42), + [102] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 6, .production_id = 12), + [104] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 6, .production_id = 12), + [106] = {.entry = {.count = 1, .reusable = false}}, SHIFT(52), + [108] = {.entry = {.count = 1, .reusable = false}}, SHIFT(45), + [110] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 3), + [112] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 3), + [114] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array_expression, 6, .production_id = 11), + [116] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 3, .production_id = 2), [120] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 3, .production_id = 2), - [122] = {.entry = {.count = 1, .reusable = false}}, SHIFT(16), - [124] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 4), - [126] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 4), + [122] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 5, .production_id = 10), + [124] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 5, .production_id = 10), + [126] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), [128] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_expression, 3, .production_id = 3), [130] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_record_expression, 3, .production_id = 3), - [132] = {.entry = {.count = 1, .reusable = false}}, SHIFT(43), - [134] = {.entry = {.count = 1, .reusable = false}}, SHIFT(46), - [136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 4, .production_id = 7), - [138] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 4, .production_id = 7), - [140] = {.entry = {.count = 1, .reusable = false}}, SHIFT(44), - [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment_expression, 3, .production_id = 6), - [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment_expression, 3, .production_id = 6), - [146] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), - [148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [152] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), - [154] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), - [156] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), - [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 4, .production_id = 14), - [162] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), - [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [166] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [168] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), - [170] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10), - [172] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), - [174] = {.entry = {.count = 1, .reusable = false}}, SHIFT(25), - [176] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), - [178] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_literal_repeat1, 2), - [180] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_literal_repeat1, 2), SHIFT_REPEAT(52), - [183] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), SHIFT_REPEAT(37), - [186] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [188] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [190] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [192] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 13), SHIFT_REPEAT(62), - [195] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 13), - [197] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), SHIFT_REPEAT(33), - [200] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), - [202] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), - [204] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [206] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [208] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), - [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), - [212] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [132] = {.entry = {.count = 1, .reusable = false}}, SHIFT(51), + [134] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_if_expression, 4, .production_id = 8), + [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), + [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 4), + [140] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 4), + [142] = {.entry = {.count = 1, .reusable = false}}, SHIFT(48), + [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_expression, 3), + [146] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_expression, 3), + [148] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_call, 4, .production_id = 7), + [150] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_call, 4, .production_id = 7), + [152] = {.entry = {.count = 1, .reusable = false}}, SHIFT(54), + [154] = {.entry = {.count = 1, .reusable = false}}, SHIFT(50), + [156] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment_expression, 3, .production_id = 6), + [158] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment_expression, 3, .production_id = 6), + [160] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), + [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), + [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), + [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [168] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), + [170] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [172] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 4, .production_id = 16), + [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), + [176] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), + [178] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [180] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [182] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [184] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), + [186] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), + [188] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [190] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_literal_repeat1, 2), + [192] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_literal_repeat1, 2), SHIFT_REPEAT(57), + [195] = {.entry = {.count = 1, .reusable = false}}, SHIFT(27), + [197] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), + [199] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_function_call_repeat1, 2), SHIFT_REPEAT(44), + [202] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [204] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [206] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_sequence_expression_repeat1, 2), SHIFT_REPEAT(35), + [209] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 15), SHIFT_REPEAT(69), + [212] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_record_expression_repeat1, 2, .production_id = 15), + [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), + [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), + [218] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), + [220] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [222] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [224] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), + [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), }; #ifdef __cplusplus diff --git a/test/corpus/control_flow.txt b/test/corpus/control_flow.txt new file mode 100644 index 0000000..ffc0cdc --- /dev/null +++ b/test/corpus/control_flow.txt @@ -0,0 +1,42 @@ +================================================================================ +If then else +================================================================================ + +if 12 then 27 else 42 + +-------------------------------------------------------------------------------- + +(source_file + (if_expression + condition: (integer_literal) + consequence: (integer_literal) + alternative: (integer_literal))) + +================================================================================ +If then +================================================================================ + +if 12 then 27 + +-------------------------------------------------------------------------------- + +(source_file + (if_expression + condition: (integer_literal) + consequence: (integer_literal))) + +================================================================================ +Dangling else +================================================================================ + +if 12 then if 27 then 42 else "nope" + +-------------------------------------------------------------------------------- + +(source_file + (if_expression + condition: (integer_literal) + consequence: (if_expression + condition: (integer_literal) + consequence: (integer_literal) + alternative: (string_literal))))