From 5995338720962754e90aaebf80b9f76fd690ff47 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 22 Aug 2023 19:02:07 -0400 Subject: [PATCH] Add macro parsing --- grammar.js | 6 + highlights.scm | 1 + src/grammar.json | 17 ++ src/node-types.json | 17 ++ src/parser.c | 719 ++++++++++++++++++++++++++++---------------- 5 files changed, 504 insertions(+), 256 deletions(-) diff --git a/grammar.js b/grammar.js index 1f51d23..fc4277b 100644 --- a/grammar.js +++ b/grammar.js @@ -11,6 +11,7 @@ module.exports = grammar({ $.integer, $.string, $.list, + $.macro, seq($.identifier, $.operator, $.identifier) ), @@ -37,5 +38,10 @@ module.exports = grammar({ repeat1(seq($.expression, optional(','))), ')' ), + + macro: $ => choice( + "assert", + "assert_equal" + ) } }); diff --git a/highlights.scm b/highlights.scm index 861cb3d..a55b167 100644 --- a/highlights.scm +++ b/highlights.scm @@ -2,3 +2,4 @@ (operator) @operator (integer) @number.integer (string) @string +(macro) @functions.builtin diff --git a/src/grammar.json b/src/grammar.json index af0895f..bef786a 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -40,6 +40,10 @@ "type": "SYMBOL", "name": "list" }, + { + "type": "SYMBOL", + "name": "macro" + }, { "type": "SEQ", "members": [ @@ -144,6 +148,19 @@ "value": ")" } ] + }, + "macro": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "assert" + }, + { + "type": "STRING", + "value": "assert_equal" + } + ] } }, "extras": [ diff --git a/src/node-types.json b/src/node-types.json index 29db175..17d343c 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -19,6 +19,10 @@ "type": "list", "named": true }, + { + "type": "macro", + "named": true + }, { "type": "operator", "named": true @@ -45,6 +49,11 @@ ] } }, + { + "type": "macro", + "named": true, + "fields": {} + }, { "type": "operator", "named": true, @@ -105,6 +114,14 @@ "type": "=", "named": false }, + { + "type": "assert", + "named": false + }, + { + "type": "assert_equal", + "named": false + }, { "type": "comment", "named": true diff --git a/src/parser.c b/src/parser.c index 22203eb..b89df98 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,11 +6,11 @@ #endif #define LANGUAGE_VERSION 14 -#define STATE_COUNT 16 +#define STATE_COUNT 17 #define LARGE_STATE_COUNT 3 -#define SYMBOL_COUNT 22 +#define SYMBOL_COUNT 25 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 16 +#define TOKEN_COUNT 18 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 0 #define MAX_ALIAS_SEQUENCE_LENGTH 3 @@ -32,12 +32,15 @@ enum { anon_sym_LPAREN = 13, anon_sym_COMMA = 14, anon_sym_RPAREN = 15, - sym_source_file = 16, - sym_expression = 17, - sym_operator = 18, - sym_list = 19, - aux_sym_source_file_repeat1 = 20, - aux_sym_list_repeat1 = 21, + anon_sym_assert = 16, + anon_sym_assert_equal = 17, + sym_source_file = 18, + sym_expression = 19, + sym_operator = 20, + sym_list = 21, + sym_macro = 22, + aux_sym_source_file_repeat1 = 23, + aux_sym_list_repeat1 = 24, }; static const char * const ts_symbol_names[] = { @@ -57,10 +60,13 @@ static const char * const ts_symbol_names[] = { [anon_sym_LPAREN] = "(", [anon_sym_COMMA] = ",", [anon_sym_RPAREN] = ")", + [anon_sym_assert] = "assert", + [anon_sym_assert_equal] = "assert_equal", [sym_source_file] = "source_file", [sym_expression] = "expression", [sym_operator] = "operator", [sym_list] = "list", + [sym_macro] = "macro", [aux_sym_source_file_repeat1] = "source_file_repeat1", [aux_sym_list_repeat1] = "list_repeat1", }; @@ -82,10 +88,13 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_LPAREN] = anon_sym_LPAREN, [anon_sym_COMMA] = anon_sym_COMMA, [anon_sym_RPAREN] = anon_sym_RPAREN, + [anon_sym_assert] = anon_sym_assert, + [anon_sym_assert_equal] = anon_sym_assert_equal, [sym_source_file] = sym_source_file, [sym_expression] = sym_expression, [sym_operator] = sym_operator, [sym_list] = sym_list, + [sym_macro] = sym_macro, [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, [aux_sym_list_repeat1] = aux_sym_list_repeat1, }; @@ -155,6 +164,14 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, + [anon_sym_assert] = { + .visible = true, + .named = false, + }, + [anon_sym_assert_equal] = { + .visible = true, + .named = false, + }, [sym_source_file] = { .visible = true, .named = true, @@ -171,6 +188,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_macro] = { + .visible = true, + .named = true, + }, [aux_sym_source_file_repeat1] = { .visible = false, .named = false, @@ -206,6 +227,7 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [13] = 13, [14] = 14, [15] = 15, + [16] = 16, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -213,145 +235,264 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(6); + if (eof) ADVANCE(7); if (lookahead == '"') ADVANCE(2); - if (lookahead == '#') ADVANCE(4); - if (lookahead == '&') ADVANCE(17); + if (lookahead == '#') ADVANCE(5); + if (lookahead == '&') ADVANCE(28); if (lookahead == '\'') ADVANCE(3); - if (lookahead == '(') ADVANCE(21); - if (lookahead == ')') ADVANCE(23); - if (lookahead == '+') ADVANCE(13); - if (lookahead == ',') ADVANCE(22); - if (lookahead == '-') ADVANCE(12); - if (lookahead == '/') ADVANCE(15); - if (lookahead == ';') ADVANCE(14); - if (lookahead == '=') ADVANCE(11); - if (lookahead == '|') ADVANCE(16); + if (lookahead == '(') ADVANCE(32); + if (lookahead == ')') ADVANCE(34); + if (lookahead == '+') ADVANCE(24); + if (lookahead == ',') ADVANCE(33); + if (lookahead == '-') ADVANCE(23); + if (lookahead == '/') ADVANCE(26); + if (lookahead == ';') ADVANCE(25); + if (lookahead == '=') ADVANCE(22); + if (lookahead == 'a') ADVANCE(17); + if (lookahead == '|') ADVANCE(27); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(18); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(29); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(10); + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(21); END_STATE(); case 1: - if (lookahead == '\n') ADVANCE(7); - if (lookahead == '\r') ADVANCE(8); + if (lookahead == '\n') ADVANCE(8); + if (lookahead == '\r') ADVANCE(9); if (lookahead != 0) ADVANCE(1); END_STATE(); case 2: - if (lookahead == '"') ADVANCE(19); + if (lookahead == '"') ADVANCE(30); if (lookahead != 0 && lookahead != '\n') ADVANCE(2); END_STATE(); case 3: - if (lookahead == '\'') ADVANCE(20); + if (lookahead == '\'') ADVANCE(31); if (lookahead != 0 && lookahead != '\n') ADVANCE(3); END_STATE(); case 4: - if (lookahead != 0 && - lookahead != '\n') ADVANCE(1); - END_STATE(); - case 5: - if (eof) ADVANCE(6); - if (lookahead == '"') ADVANCE(2); - if (lookahead == '#') ADVANCE(4); - if (lookahead == '(') ADVANCE(21); - if (lookahead == ')') ADVANCE(23); - if (lookahead == ',') ADVANCE(22); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(5) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(18); + lookahead == ' ') SKIP(4) if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(10); + lookahead == '|') ADVANCE(21); + END_STATE(); + case 5: + if (lookahead != 0 && + lookahead != '\n') ADVANCE(1); END_STATE(); case 6: - ACCEPT_TOKEN(ts_builtin_sym_end); + if (eof) ADVANCE(7); + if (lookahead == '"') ADVANCE(2); + if (lookahead == '#') ADVANCE(5); + if (lookahead == '(') ADVANCE(32); + if (lookahead == ')') ADVANCE(34); + if (lookahead == ',') ADVANCE(33); + if (lookahead == 'a') ADVANCE(17); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(6) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(29); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('b' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); END_STATE(); case 7: - ACCEPT_TOKEN(sym_comment); + ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); case 8: ACCEPT_TOKEN(sym_comment); - if (lookahead == '\n') ADVANCE(7); - if (lookahead == '\r') ADVANCE(8); - if (lookahead != 0) ADVANCE(1); END_STATE(); case 9: - ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(9); - if (lookahead == '.' || - lookahead == '|') ADVANCE(10); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(9); + ACCEPT_TOKEN(sym_comment); + if (lookahead == '\n') ADVANCE(8); + if (lookahead == '\r') ADVANCE(9); + if (lookahead != 0) ADVANCE(1); END_STATE(); case 10: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(9); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'a') ADVANCE(13); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(10); + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(20); END_STATE(); case 11: - ACCEPT_TOKEN(anon_sym_EQ); - END_STATE(); - case 12: - ACCEPT_TOKEN(anon_sym_DASH); - END_STATE(); - case 13: - ACCEPT_TOKEN(anon_sym_PLUS); - END_STATE(); - case 14: - ACCEPT_TOKEN(anon_sym_SEMI); - END_STATE(); - case 15: - ACCEPT_TOKEN(anon_sym_SLASH); - END_STATE(); - case 16: - ACCEPT_TOKEN(anon_sym_PIPE); - if (lookahead == '_') ADVANCE(9); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'e') ADVANCE(15); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(10); + lookahead == '|') ADVANCE(21); + END_STATE(); + case 12: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'e') ADVANCE(14); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); + case 13: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'l') ADVANCE(36); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); + case 14: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'q') ADVANCE(19); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); + case 15: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'r') ADVANCE(18); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); + END_STATE(); + case 16: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 's') ADVANCE(11); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); END_STATE(); case 17: - ACCEPT_TOKEN(anon_sym_AMP); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 's') ADVANCE(16); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); END_STATE(); case 18: - ACCEPT_TOKEN(sym_integer); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 't') ADVANCE(35); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); END_STATE(); case 19: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == 'u') ADVANCE(10); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); + case 20: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); + case 21: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(20); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); + END_STATE(); + case 22: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 23: + ACCEPT_TOKEN(anon_sym_DASH); + END_STATE(); + case 24: + ACCEPT_TOKEN(anon_sym_PLUS); + END_STATE(); + case 25: + ACCEPT_TOKEN(anon_sym_SEMI); + END_STATE(); + case 26: + ACCEPT_TOKEN(anon_sym_SLASH); + END_STATE(); + case 27: + ACCEPT_TOKEN(anon_sym_PIPE); + if (lookahead == '_') ADVANCE(20); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); + END_STATE(); + case 28: + ACCEPT_TOKEN(anon_sym_AMP); + END_STATE(); + case 29: + ACCEPT_TOKEN(sym_integer); + END_STATE(); + case 30: ACCEPT_TOKEN(sym_string); - if (lookahead == '"') ADVANCE(19); + if (lookahead == '"') ADVANCE(30); if (lookahead != 0 && lookahead != '\n') ADVANCE(2); END_STATE(); - case 20: + case 31: ACCEPT_TOKEN(sym_function); - if (lookahead == '\'') ADVANCE(20); + if (lookahead == '\'') ADVANCE(31); if (lookahead != 0 && lookahead != '\n') ADVANCE(3); END_STATE(); - case 21: + case 32: ACCEPT_TOKEN(anon_sym_LPAREN); END_STATE(); - case 22: + case 33: ACCEPT_TOKEN(anon_sym_COMMA); END_STATE(); - case 23: + case 34: ACCEPT_TOKEN(anon_sym_RPAREN); END_STATE(); + case 35: + ACCEPT_TOKEN(anon_sym_assert); + if (lookahead == '_') ADVANCE(12); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(21); + END_STATE(); + case 36: + ACCEPT_TOKEN(anon_sym_assert_equal); + if (lookahead == '_') ADVANCE(20); + if (lookahead == '.' || + lookahead == '|') ADVANCE(21); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + END_STATE(); default: return false; } @@ -359,21 +500,22 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, - [1] = {.lex_state = 5}, + [1] = {.lex_state = 6}, [2] = {.lex_state = 0}, - [3] = {.lex_state = 5}, - [4] = {.lex_state = 5}, - [5] = {.lex_state = 5}, - [6] = {.lex_state = 5}, - [7] = {.lex_state = 5}, - [8] = {.lex_state = 5}, - [9] = {.lex_state = 5}, - [10] = {.lex_state = 5}, - [11] = {.lex_state = 5}, - [12] = {.lex_state = 5}, - [13] = {.lex_state = 0}, - [14] = {.lex_state = 5}, - [15] = {.lex_state = 5}, + [3] = {.lex_state = 6}, + [4] = {.lex_state = 6}, + [5] = {.lex_state = 6}, + [6] = {.lex_state = 6}, + [7] = {.lex_state = 6}, + [8] = {.lex_state = 6}, + [9] = {.lex_state = 6}, + [10] = {.lex_state = 6}, + [11] = {.lex_state = 6}, + [12] = {.lex_state = 6}, + [13] = {.lex_state = 6}, + [14] = {.lex_state = 0}, + [15] = {.lex_state = 4}, + [16] = {.lex_state = 4}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { @@ -394,11 +536,14 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_LPAREN] = ACTIONS(1), [anon_sym_COMMA] = ACTIONS(1), [anon_sym_RPAREN] = ACTIONS(1), + [anon_sym_assert] = ACTIONS(1), + [anon_sym_assert_equal] = ACTIONS(1), }, [1] = { - [sym_source_file] = STATE(13), + [sym_source_file] = STATE(14), [sym_expression] = STATE(3), - [sym_list] = STATE(5), + [sym_list] = STATE(7), + [sym_macro] = STATE(7), [aux_sym_source_file_repeat1] = STATE(3), [ts_builtin_sym_end] = ACTIONS(3), [sym_comment] = ACTIONS(5), @@ -406,179 +551,232 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_integer] = ACTIONS(9), [sym_string] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), + [anon_sym_assert] = ACTIONS(13), + [anon_sym_assert_equal] = ACTIONS(13), }, [2] = { - [sym_operator] = STATE(15), - [ts_builtin_sym_end] = ACTIONS(13), - [sym_comment] = ACTIONS(13), - [sym_identifier] = ACTIONS(15), - [anon_sym_EQ] = ACTIONS(17), - [anon_sym_DASH] = ACTIONS(17), - [anon_sym_PLUS] = ACTIONS(17), - [anon_sym_SEMI] = ACTIONS(17), - [anon_sym_SLASH] = ACTIONS(17), - [anon_sym_PIPE] = ACTIONS(19), - [anon_sym_AMP] = ACTIONS(17), - [sym_integer] = ACTIONS(13), - [sym_string] = ACTIONS(13), - [anon_sym_LPAREN] = ACTIONS(13), - [anon_sym_COMMA] = ACTIONS(13), - [anon_sym_RPAREN] = ACTIONS(13), + [sym_operator] = STATE(16), + [ts_builtin_sym_end] = ACTIONS(15), + [sym_comment] = ACTIONS(15), + [sym_identifier] = ACTIONS(17), + [anon_sym_EQ] = ACTIONS(19), + [anon_sym_DASH] = ACTIONS(19), + [anon_sym_PLUS] = ACTIONS(19), + [anon_sym_SEMI] = ACTIONS(19), + [anon_sym_SLASH] = ACTIONS(19), + [anon_sym_PIPE] = ACTIONS(21), + [anon_sym_AMP] = ACTIONS(19), + [sym_integer] = ACTIONS(15), + [sym_string] = ACTIONS(15), + [anon_sym_LPAREN] = ACTIONS(15), + [anon_sym_COMMA] = ACTIONS(15), + [anon_sym_RPAREN] = ACTIONS(15), + [anon_sym_assert] = ACTIONS(17), + [anon_sym_assert_equal] = ACTIONS(17), }, }; static const uint16_t ts_small_parse_table[] = { - [0] = 7, + [0] = 8, ACTIONS(7), 1, sym_identifier, ACTIONS(11), 1, anon_sym_LPAREN, - ACTIONS(21), 1, - ts_builtin_sym_end, ACTIONS(23), 1, - sym_comment, - STATE(5), 1, - sym_list, - ACTIONS(9), 2, - sym_integer, - sym_string, - STATE(4), 2, - sym_expression, - aux_sym_source_file_repeat1, - [24] = 7, + ts_builtin_sym_end, ACTIONS(25), 1, - ts_builtin_sym_end, - ACTIONS(27), 1, sym_comment, - ACTIONS(30), 1, - sym_identifier, - ACTIONS(36), 1, - anon_sym_LPAREN, - STATE(5), 1, - sym_list, - ACTIONS(33), 2, - sym_integer, - sym_string, - STATE(4), 2, - sym_expression, - aux_sym_source_file_repeat1, - [48] = 1, - ACTIONS(13), 8, - ts_builtin_sym_end, - sym_comment, - sym_identifier, - sym_integer, - sym_string, - anon_sym_LPAREN, - anon_sym_COMMA, - anon_sym_RPAREN, - [59] = 7, - ACTIONS(7), 1, - sym_identifier, - ACTIONS(11), 1, - anon_sym_LPAREN, - ACTIONS(39), 1, - anon_sym_RPAREN, - STATE(5), 1, - sym_list, - STATE(9), 1, - aux_sym_list_repeat1, - STATE(11), 1, - sym_expression, ACTIONS(9), 2, sym_integer, sym_string, - [82] = 1, - ACTIONS(41), 8, - ts_builtin_sym_end, - sym_comment, - sym_identifier, - sym_integer, - sym_string, - anon_sym_LPAREN, - anon_sym_COMMA, - anon_sym_RPAREN, - [93] = 1, - ACTIONS(43), 8, - ts_builtin_sym_end, - sym_comment, - sym_identifier, - sym_integer, - sym_string, - anon_sym_LPAREN, - anon_sym_COMMA, - anon_sym_RPAREN, - [104] = 7, - ACTIONS(45), 1, - sym_identifier, - ACTIONS(51), 1, - anon_sym_LPAREN, - ACTIONS(54), 1, - anon_sym_RPAREN, - STATE(5), 1, - sym_list, - STATE(9), 1, - aux_sym_list_repeat1, - STATE(11), 1, + ACTIONS(13), 2, + anon_sym_assert, + anon_sym_assert_equal, + STATE(4), 2, sym_expression, - ACTIONS(48), 2, + aux_sym_source_file_repeat1, + STATE(7), 2, + sym_list, + sym_macro, + [29] = 8, + ACTIONS(27), 1, + ts_builtin_sym_end, + ACTIONS(29), 1, + sym_comment, + ACTIONS(32), 1, + sym_identifier, + ACTIONS(38), 1, + anon_sym_LPAREN, + ACTIONS(35), 2, sym_integer, sym_string, - [127] = 6, + ACTIONS(41), 2, + anon_sym_assert, + anon_sym_assert_equal, + STATE(4), 2, + sym_expression, + aux_sym_source_file_repeat1, + STATE(7), 2, + sym_list, + sym_macro, + [58] = 8, ACTIONS(7), 1, sym_identifier, ACTIONS(11), 1, anon_sym_LPAREN, - STATE(5), 1, - sym_list, + ACTIONS(44), 1, + anon_sym_RPAREN, STATE(6), 1, aux_sym_list_repeat1, - STATE(11), 1, + STATE(12), 1, sym_expression, ACTIONS(9), 2, sym_integer, sym_string, - [147] = 2, - ACTIONS(58), 1, - anon_sym_COMMA, - ACTIONS(56), 5, + ACTIONS(13), 2, + anon_sym_assert, + anon_sym_assert_equal, + STATE(7), 2, + sym_list, + sym_macro, + [86] = 8, + ACTIONS(46), 1, sym_identifier, + ACTIONS(52), 1, + anon_sym_LPAREN, + ACTIONS(55), 1, + anon_sym_RPAREN, + STATE(6), 1, + aux_sym_list_repeat1, + STATE(12), 1, + sym_expression, + ACTIONS(49), 2, sym_integer, sym_string, - anon_sym_LPAREN, - anon_sym_RPAREN, - [158] = 1, - ACTIONS(54), 5, + ACTIONS(57), 2, + anon_sym_assert, + anon_sym_assert_equal, + STATE(7), 2, + sym_list, + sym_macro, + [114] = 2, + ACTIONS(17), 3, sym_identifier, - sym_integer, - sym_string, - anon_sym_LPAREN, - anon_sym_RPAREN, - [166] = 1, - ACTIONS(60), 1, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(15), 7, ts_builtin_sym_end, - [170] = 1, - ACTIONS(62), 1, + sym_comment, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_COMMA, + anon_sym_RPAREN, + [129] = 7, + ACTIONS(7), 1, sym_identifier, - [174] = 1, - ACTIONS(64), 1, + ACTIONS(11), 1, + anon_sym_LPAREN, + STATE(5), 1, + aux_sym_list_repeat1, + STATE(12), 1, + sym_expression, + ACTIONS(9), 2, + sym_integer, + sym_string, + ACTIONS(13), 2, + anon_sym_assert, + anon_sym_assert_equal, + STATE(7), 2, + sym_list, + sym_macro, + [154] = 2, + ACTIONS(62), 3, + sym_identifier, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(60), 7, + ts_builtin_sym_end, + sym_comment, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_COMMA, + anon_sym_RPAREN, + [169] = 2, + ACTIONS(66), 3, + sym_identifier, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(64), 7, + ts_builtin_sym_end, + sym_comment, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_COMMA, + anon_sym_RPAREN, + [184] = 2, + ACTIONS(70), 3, + sym_identifier, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(68), 7, + ts_builtin_sym_end, + sym_comment, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_COMMA, + anon_sym_RPAREN, + [199] = 3, + ACTIONS(76), 1, + anon_sym_COMMA, + ACTIONS(72), 3, + sym_identifier, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(74), 4, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_RPAREN, + [214] = 2, + ACTIONS(78), 3, + sym_identifier, + anon_sym_assert, + anon_sym_assert_equal, + ACTIONS(55), 4, + sym_integer, + sym_string, + anon_sym_LPAREN, + anon_sym_RPAREN, + [226] = 1, + ACTIONS(80), 1, + ts_builtin_sym_end, + [230] = 1, + ACTIONS(82), 1, + sym_identifier, + [234] = 1, + ACTIONS(84), 1, sym_identifier, }; static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(3)] = 0, - [SMALL_STATE(4)] = 24, - [SMALL_STATE(5)] = 48, - [SMALL_STATE(6)] = 59, - [SMALL_STATE(7)] = 82, - [SMALL_STATE(8)] = 93, - [SMALL_STATE(9)] = 104, - [SMALL_STATE(10)] = 127, - [SMALL_STATE(11)] = 147, - [SMALL_STATE(12)] = 158, - [SMALL_STATE(13)] = 166, - [SMALL_STATE(14)] = 170, - [SMALL_STATE(15)] = 174, + [SMALL_STATE(4)] = 29, + [SMALL_STATE(5)] = 58, + [SMALL_STATE(6)] = 86, + [SMALL_STATE(7)] = 114, + [SMALL_STATE(8)] = 129, + [SMALL_STATE(9)] = 154, + [SMALL_STATE(10)] = 169, + [SMALL_STATE(11)] = 184, + [SMALL_STATE(12)] = 199, + [SMALL_STATE(13)] = 214, + [SMALL_STATE(14)] = 226, + [SMALL_STATE(15)] = 230, + [SMALL_STATE(16)] = 234, }; static const TSParseActionEntry ts_parse_actions[] = { @@ -586,32 +784,41 @@ static const TSParseActionEntry ts_parse_actions[] = { [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), - [15] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), - [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), - [21] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [25] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [27] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), - [30] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2), - [33] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), - [36] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(10), - [39] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [41] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3), - [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), - [45] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(2), - [48] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(5), - [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(10), - [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), - [56] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1), - [58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [60] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1), - [64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), + [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), + [17] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), + [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15), + [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [27] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [29] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), + [32] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2), + [35] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(7), + [38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(8), + [41] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(9), + [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [46] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(2), + [49] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(7), + [52] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8), + [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), + [57] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(9), + [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_macro, 1), + [62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_macro, 1), + [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3), + [66] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 3), + [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), + [70] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3), + [72] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1), + [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1), + [76] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), + [80] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1), + [84] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), }; #ifdef __cplusplus