From 3aa005530f97b1164442ae03984f23c96ee857c8 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 24 Aug 2023 09:31:26 -0400 Subject: [PATCH] Add new tests and grammar --- corpus/tests.txt | 67 ++- grammar.js | 26 +- src/grammar.json | 75 +-- src/node-types.json | 72 ++- src/parser.c | 1231 ++++++++++++++++++++++++++++--------------- 5 files changed, 948 insertions(+), 523 deletions(-) diff --git a/corpus/tests.txt b/corpus/tests.txt index 64dfd75..7ba0a45 100644 --- a/corpus/tests.txt +++ b/corpus/tests.txt @@ -46,40 +46,20 @@ x.x Operators ================== -x = y -x + y -x | y -x - y -x / y -x ; y +x = y + y; --- (source_file (expression - (identifier) - (operator) (identifier)) + (operator) (expression - (identifier) - (operator) (identifier)) + (operator) (expression - (identifier) - (operator) (identifier)) - (expression - (identifier) - (operator) - (identifier)) - (expression - (identifier) - (operator) - (identifier)) - (expression - (identifier) - (operator) - (identifier))) + (operator)) ================== String @@ -105,6 +85,19 @@ Integer (expression (integer))) +================== +Float +================== + +1.0 + +--- + +(source_file + (expression + (float))) + + ================== List ================== @@ -121,5 +114,31 @@ List (expression (integer))))) +================== +Empty +================== + +() + +--- + +(source_file + (expression + (empty))) + +================== +Tool +================== + +random_boolean(); + +--- + +(source_file + (expression + (tool)) + (expression + (empty)) + (operator)) diff --git a/grammar.js b/grammar.js index 7aed883..2abe45d 100644 --- a/grammar.js +++ b/grammar.js @@ -2,17 +2,18 @@ module.exports = grammar({ name: 'dust', rules: { - source_file: $ => repeat(choice($.comment, $.expression)), + source_file: $ => repeat(choice($.comment, $.expression, $.operator)), comment: $ => /(#)(.+?)([\n\r])/, expression: $ => choice( $.identifier, $.integer, + $.float, $.string, $.list, - $.macro, - seq($.identifier, $.operator, $.identifier) + $.tool, + $.empty, ), identifier: $ => /[a-zA-Z|_|.]+(_[a-zA-Z]+)*/, @@ -27,21 +28,28 @@ module.exports = grammar({ '&' ), - integer: $ => /\d/, + tool: $ => choice( + "random", + "random_boolean", + "random_integer", + "random_string", + "random_float" + ), + + float: $ => /\d+\.\d*/, + + integer: $ => /\d+/, string: $ => /"(.*?)\"/, function: $ => /'(.*?)\'/, + empty: $ => "()", + list: $ => seq( '(', repeat1(seq($.expression, optional(','))), ')' ), - - macro: $ => choice( - "assert", - "assert_equal" - ) } }); diff --git a/src/grammar.json b/src/grammar.json index 1b06899..58b79a7 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -13,6 +13,10 @@ { "type": "SYMBOL", "name": "expression" + }, + { + "type": "SYMBOL", + "name": "operator" } ] } @@ -32,6 +36,10 @@ "type": "SYMBOL", "name": "integer" }, + { + "type": "SYMBOL", + "name": "float" + }, { "type": "SYMBOL", "name": "string" @@ -42,24 +50,11 @@ }, { "type": "SYMBOL", - "name": "macro" + "name": "tool" }, { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "SYMBOL", - "name": "operator" - }, - { - "type": "SYMBOL", - "name": "identifier" - } - ] + "type": "SYMBOL", + "name": "empty" } ] }, @@ -100,9 +95,38 @@ } ] }, + "tool": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "random" + }, + { + "type": "STRING", + "value": "random_boolean" + }, + { + "type": "STRING", + "value": "random_integer" + }, + { + "type": "STRING", + "value": "random_string" + }, + { + "type": "STRING", + "value": "random_float" + } + ] + }, + "float": { + "type": "PATTERN", + "value": "\\d+\\.\\d*" + }, "integer": { "type": "PATTERN", - "value": "\\d" + "value": "\\d+" }, "string": { "type": "PATTERN", @@ -112,6 +136,10 @@ "type": "PATTERN", "value": "'(.*?)\\'" }, + "empty": { + "type": "STRING", + "value": "()" + }, "list": { "type": "SEQ", "members": [ @@ -148,19 +176,6 @@ "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 17d343c..8465b97 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -4,9 +4,17 @@ "named": true, "fields": {}, "children": { - "multiple": true, + "multiple": false, "required": true, "types": [ + { + "type": "empty", + "named": true + }, + { + "type": "float", + "named": true + }, { "type": "identifier", "named": true @@ -19,17 +27,13 @@ "type": "list", "named": true }, - { - "type": "macro", - "named": true - }, - { - "type": "operator", - "named": true - }, { "type": "string", "named": true + }, + { + "type": "tool", + "named": true } ] } @@ -49,11 +53,6 @@ ] } }, - { - "type": "macro", - "named": true, - "fields": {} - }, { "type": "operator", "named": true, @@ -74,10 +73,19 @@ { "type": "expression", "named": true + }, + { + "type": "operator", + "named": true } ] } }, + { + "type": "tool", + "named": true, + "fields": {} + }, { "type": "&", "named": false @@ -114,18 +122,18 @@ "type": "=", "named": false }, - { - "type": "assert", - "named": false - }, - { - "type": "assert_equal", - "named": false - }, { "type": "comment", "named": true }, + { + "type": "empty", + "named": true + }, + { + "type": "float", + "named": true + }, { "type": "identifier", "named": true @@ -134,6 +142,26 @@ "type": "integer", "named": true }, + { + "type": "random", + "named": false + }, + { + "type": "random_boolean", + "named": false + }, + { + "type": "random_float", + "named": false + }, + { + "type": "random_integer", + "named": false + }, + { + "type": "random_string", + "named": false + }, { "type": "string", "named": true diff --git a/src/parser.c b/src/parser.c index b2334ce..9243d48 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,11 +6,11 @@ #endif #define LANGUAGE_VERSION 14 -#define STATE_COUNT 17 -#define LARGE_STATE_COUNT 3 -#define SYMBOL_COUNT 25 +#define STATE_COUNT 19 +#define LARGE_STATE_COUNT 11 +#define SYMBOL_COUNT 30 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 18 +#define TOKEN_COUNT 23 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 0 #define MAX_ALIAS_SEQUENCE_LENGTH 3 @@ -26,21 +26,26 @@ enum { anon_sym_SLASH = 7, anon_sym_PIPE = 8, anon_sym_AMP = 9, - sym_integer = 10, - sym_string = 11, - sym_function = 12, - anon_sym_LPAREN = 13, - anon_sym_COMMA = 14, - anon_sym_RPAREN = 15, - 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, + anon_sym_random = 10, + anon_sym_random_boolean = 11, + anon_sym_random_integer = 12, + anon_sym_random_string = 13, + anon_sym_random_float = 14, + sym_float = 15, + sym_integer = 16, + sym_string = 17, + sym_function = 18, + sym_empty = 19, + anon_sym_LPAREN = 20, + anon_sym_COMMA = 21, + anon_sym_RPAREN = 22, + sym_source_file = 23, + sym_expression = 24, + sym_operator = 25, + sym_tool = 26, + sym_list = 27, + aux_sym_source_file_repeat1 = 28, + aux_sym_list_repeat1 = 29, }; static const char * const ts_symbol_names[] = { @@ -54,19 +59,24 @@ static const char * const ts_symbol_names[] = { [anon_sym_SLASH] = "/", [anon_sym_PIPE] = "|", [anon_sym_AMP] = "&", + [anon_sym_random] = "random", + [anon_sym_random_boolean] = "random_boolean", + [anon_sym_random_integer] = "random_integer", + [anon_sym_random_string] = "random_string", + [anon_sym_random_float] = "random_float", + [sym_float] = "float", [sym_integer] = "integer", [sym_string] = "string", [sym_function] = "function", + [sym_empty] = "empty", [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_tool] = "tool", [sym_list] = "list", - [sym_macro] = "macro", [aux_sym_source_file_repeat1] = "source_file_repeat1", [aux_sym_list_repeat1] = "list_repeat1", }; @@ -82,19 +92,24 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_SLASH] = anon_sym_SLASH, [anon_sym_PIPE] = anon_sym_PIPE, [anon_sym_AMP] = anon_sym_AMP, + [anon_sym_random] = anon_sym_random, + [anon_sym_random_boolean] = anon_sym_random_boolean, + [anon_sym_random_integer] = anon_sym_random_integer, + [anon_sym_random_string] = anon_sym_random_string, + [anon_sym_random_float] = anon_sym_random_float, + [sym_float] = sym_float, [sym_integer] = sym_integer, [sym_string] = sym_string, [sym_function] = sym_function, + [sym_empty] = sym_empty, [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_tool] = sym_tool, [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, }; @@ -140,6 +155,30 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, + [anon_sym_random] = { + .visible = true, + .named = false, + }, + [anon_sym_random_boolean] = { + .visible = true, + .named = false, + }, + [anon_sym_random_integer] = { + .visible = true, + .named = false, + }, + [anon_sym_random_string] = { + .visible = true, + .named = false, + }, + [anon_sym_random_float] = { + .visible = true, + .named = false, + }, + [sym_float] = { + .visible = true, + .named = true, + }, [sym_integer] = { .visible = true, .named = true, @@ -152,6 +191,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_empty] = { + .visible = true, + .named = true, + }, [anon_sym_LPAREN] = { .visible = true, .named = false, @@ -164,14 +207,6 @@ 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, @@ -184,11 +219,11 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [sym_list] = { + [sym_tool] = { .visible = true, .named = true, }, - [sym_macro] = { + [sym_list] = { .visible = true, .named = true, }, @@ -221,13 +256,15 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [7] = 7, [8] = 8, [9] = 9, - [10] = 10, + [10] = 8, [11] = 11, - [12] = 12, + [12] = 11, [13] = 13, - [14] = 14, - [15] = 15, - [16] = 16, + [14] = 4, + [15] = 6, + [16] = 7, + [17] = 17, + [18] = 18, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -235,263 +272,440 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(7); - if (lookahead == '"') ADVANCE(2); + if (eof) ADVANCE(6); + if (lookahead == '"') ADVANCE(3); if (lookahead == '#') ADVANCE(5); - if (lookahead == '&') ADVANCE(28); - if (lookahead == '\'') ADVANCE(3); - 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 == '&') ADVANCE(44); + if (lookahead == '\'') ADVANCE(4); + if (lookahead == '(') ADVANCE(55); + if (lookahead == ')') ADVANCE(57); + if (lookahead == '+') ADVANCE(40); + if (lookahead == ',') ADVANCE(56); + if (lookahead == '-') ADVANCE(39); + if (lookahead == '/') ADVANCE(42); + if (lookahead == ';') ADVANCE(41); + if (lookahead == '=') ADVANCE(38); + if (lookahead == 'r') ADVANCE(9); + if (lookahead == '|') ADVANCE(43); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(29); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(51); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(37); END_STATE(); case 1: - if (lookahead == '\n') ADVANCE(8); - if (lookahead == '\r') ADVANCE(9); + if (lookahead == '\n') ADVANCE(7); + if (lookahead == '\r') ADVANCE(8); if (lookahead != 0) ADVANCE(1); END_STATE(); case 2: - if (lookahead == '"') ADVANCE(30); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(2); - END_STATE(); - case 3: - if (lookahead == '\'') ADVANCE(31); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(3); - END_STATE(); - case 4: + if (lookahead == '"') ADVANCE(3); + if (lookahead == '(') ADVANCE(55); + if (lookahead == ')') ADVANCE(57); + if (lookahead == ',') ADVANCE(56); + if (lookahead == 'r') ADVANCE(9); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(4) + lookahead == ' ') SKIP(2) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(51); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + END_STATE(); + case 3: + if (lookahead == '"') ADVANCE(52); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(3); + END_STATE(); + case 4: + if (lookahead == '\'') ADVANCE(53); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(4); END_STATE(); case 5: if (lookahead != 0 && lookahead != '\n') ADVANCE(1); END_STATE(); case 6: - 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); + ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); case 7: - ACCEPT_TOKEN(ts_builtin_sym_end); + ACCEPT_TOKEN(sym_comment); 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_comment); - if (lookahead == '\n') ADVANCE(8); - if (lookahead == '\r') ADVANCE(9); - if (lookahead != 0) ADVANCE(1); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'a') ADVANCE(23); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); END_STATE(); case 10: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'a') ADVANCE(13); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'a') ADVANCE(24); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 11: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'e') ADVANCE(15); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'a') ADVANCE(35); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 12: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'e') ADVANCE(14); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'b') ADVANCE(29); + if (lookahead == 'f') ADVANCE(21); + if (lookahead == 'i') ADVANCE(25); + if (lookahead == 's') ADVANCE(33); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 13: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'l') ADVANCE(36); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'd') ADVANCE(27); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); END_STATE(); case 14: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'q') ADVANCE(19); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'e') ADVANCE(18); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 15: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'r') ADVANCE(18); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'e') ADVANCE(32); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 16: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 's') ADVANCE(11); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'e') ADVANCE(10); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 17: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 's') ADVANCE(16); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'g') ADVANCE(48); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 18: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 't') ADVANCE(35); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'g') ADVANCE(15); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 19: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); - if (lookahead == 'u') ADVANCE(10); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'i') ADVANCE(26); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 20: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'l') ADVANCE(16); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 21: ACCEPT_TOKEN(sym_identifier); - if (lookahead == '_') ADVANCE(20); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'l') ADVANCE(28); if (lookahead == '.' || - ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); 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); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'm') ADVANCE(45); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); + END_STATE(); + case 23: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'n') ADVANCE(13); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); + END_STATE(); + case 24: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'n') ADVANCE(46); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 25: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'n') ADVANCE(34); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 26: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'n') ADVANCE(17); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 27: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'o') ADVANCE(22); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); END_STATE(); case 28: - ACCEPT_TOKEN(anon_sym_AMP); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'o') ADVANCE(11); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 29: - ACCEPT_TOKEN(sym_integer); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'o') ADVANCE(30); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 30: - ACCEPT_TOKEN(sym_string); - if (lookahead == '"') ADVANCE(30); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(2); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'o') ADVANCE(20); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 31: - ACCEPT_TOKEN(sym_function); - if (lookahead == '\'') ADVANCE(31); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(3); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'r') ADVANCE(19); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 32: - ACCEPT_TOKEN(anon_sym_LPAREN); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 'r') ADVANCE(47); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 33: - ACCEPT_TOKEN(anon_sym_COMMA); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 't') ADVANCE(31); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 34: - ACCEPT_TOKEN(anon_sym_RPAREN); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 't') ADVANCE(14); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); END_STATE(); case 35: - ACCEPT_TOKEN(anon_sym_assert); + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == 't') ADVANCE(49); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 36: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 37: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 39: + ACCEPT_TOKEN(anon_sym_DASH); + END_STATE(); + case 40: + ACCEPT_TOKEN(anon_sym_PLUS); + END_STATE(); + case 41: + ACCEPT_TOKEN(anon_sym_SEMI); + END_STATE(); + case 42: + ACCEPT_TOKEN(anon_sym_SLASH); + END_STATE(); + case 43: + ACCEPT_TOKEN(anon_sym_PIPE); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z') || + lookahead == '|') ADVANCE(37); + END_STATE(); + case 44: + ACCEPT_TOKEN(anon_sym_AMP); + END_STATE(); + case 45: + ACCEPT_TOKEN(anon_sym_random); if (lookahead == '_') ADVANCE(12); if (lookahead == '.' || ('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z') || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); END_STATE(); - case 36: - ACCEPT_TOKEN(anon_sym_assert_equal); - if (lookahead == '_') ADVANCE(20); + case 46: + ACCEPT_TOKEN(anon_sym_random_boolean); + if (lookahead == '_') ADVANCE(36); if (lookahead == '.' || - lookahead == '|') ADVANCE(21); + lookahead == '|') ADVANCE(37); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 47: + ACCEPT_TOKEN(anon_sym_random_integer); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 48: + ACCEPT_TOKEN(anon_sym_random_string); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 49: + ACCEPT_TOKEN(anon_sym_random_float); + if (lookahead == '_') ADVANCE(36); + if (lookahead == '.' || + lookahead == '|') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + END_STATE(); + case 50: + ACCEPT_TOKEN(sym_float); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(50); + END_STATE(); + case 51: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(50); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(51); + END_STATE(); + case 52: + ACCEPT_TOKEN(sym_string); + if (lookahead == '"') ADVANCE(52); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(3); + END_STATE(); + case 53: + ACCEPT_TOKEN(sym_function); + if (lookahead == '\'') ADVANCE(53); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(4); + END_STATE(); + case 54: + ACCEPT_TOKEN(sym_empty); + END_STATE(); + case 55: + ACCEPT_TOKEN(anon_sym_LPAREN); + if (lookahead == ')') ADVANCE(54); + END_STATE(); + case 56: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 57: + ACCEPT_TOKEN(anon_sym_RPAREN); END_STATE(); default: return false; @@ -500,22 +714,24 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, - [1] = {.lex_state = 6}, + [1] = {.lex_state = 0}, [2] = {.lex_state = 0}, - [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}, + [3] = {.lex_state = 0}, + [4] = {.lex_state = 0}, + [5] = {.lex_state = 0}, + [6] = {.lex_state = 0}, + [7] = {.lex_state = 0}, + [8] = {.lex_state = 2}, + [9] = {.lex_state = 2}, + [10] = {.lex_state = 2}, + [11] = {.lex_state = 2}, + [12] = {.lex_state = 2}, + [13] = {.lex_state = 2}, + [14] = {.lex_state = 2}, + [15] = {.lex_state = 2}, + [16] = {.lex_state = 2}, + [17] = {.lex_state = 2}, + [18] = {.lex_state = 0}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { @@ -530,295 +746,434 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_SLASH] = ACTIONS(1), [anon_sym_PIPE] = ACTIONS(1), [anon_sym_AMP] = ACTIONS(1), + [anon_sym_random] = ACTIONS(1), + [anon_sym_random_boolean] = ACTIONS(1), + [anon_sym_random_integer] = ACTIONS(1), + [anon_sym_random_string] = ACTIONS(1), + [anon_sym_random_float] = ACTIONS(1), + [sym_float] = ACTIONS(1), [sym_integer] = ACTIONS(1), [sym_string] = ACTIONS(1), [sym_function] = ACTIONS(1), + [sym_empty] = ACTIONS(1), [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(14), - [sym_expression] = STATE(3), - [sym_list] = STATE(7), - [sym_macro] = STATE(7), - [aux_sym_source_file_repeat1] = STATE(3), + [sym_source_file] = STATE(18), + [sym_expression] = STATE(2), + [sym_operator] = STATE(2), + [sym_tool] = STATE(4), + [sym_list] = STATE(4), + [aux_sym_source_file_repeat1] = STATE(2), [ts_builtin_sym_end] = ACTIONS(3), [sym_comment] = ACTIONS(5), [sym_identifier] = ACTIONS(7), - [sym_integer] = ACTIONS(9), - [sym_string] = ACTIONS(9), - [anon_sym_LPAREN] = ACTIONS(11), - [anon_sym_assert] = ACTIONS(13), - [anon_sym_assert_equal] = ACTIONS(13), + [anon_sym_EQ] = ACTIONS(9), + [anon_sym_DASH] = ACTIONS(9), + [anon_sym_PLUS] = ACTIONS(9), + [anon_sym_SEMI] = ACTIONS(9), + [anon_sym_SLASH] = ACTIONS(9), + [anon_sym_PIPE] = ACTIONS(11), + [anon_sym_AMP] = ACTIONS(9), + [anon_sym_random] = ACTIONS(13), + [anon_sym_random_boolean] = ACTIONS(13), + [anon_sym_random_integer] = ACTIONS(13), + [anon_sym_random_string] = ACTIONS(13), + [anon_sym_random_float] = ACTIONS(13), + [sym_float] = ACTIONS(15), + [sym_integer] = ACTIONS(7), + [sym_string] = ACTIONS(15), + [sym_empty] = ACTIONS(15), + [anon_sym_LPAREN] = ACTIONS(17), }, [2] = { - [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_expression] = STATE(3), + [sym_operator] = STATE(3), + [sym_tool] = STATE(4), + [sym_list] = STATE(4), + [aux_sym_source_file_repeat1] = STATE(3), + [ts_builtin_sym_end] = ACTIONS(19), + [sym_comment] = ACTIONS(21), + [sym_identifier] = ACTIONS(7), + [anon_sym_EQ] = ACTIONS(9), + [anon_sym_DASH] = ACTIONS(9), + [anon_sym_PLUS] = ACTIONS(9), + [anon_sym_SEMI] = ACTIONS(9), + [anon_sym_SLASH] = ACTIONS(9), + [anon_sym_PIPE] = ACTIONS(11), + [anon_sym_AMP] = ACTIONS(9), + [anon_sym_random] = ACTIONS(13), + [anon_sym_random_boolean] = ACTIONS(13), + [anon_sym_random_integer] = ACTIONS(13), + [anon_sym_random_string] = ACTIONS(13), + [anon_sym_random_float] = ACTIONS(13), + [sym_float] = ACTIONS(15), + [sym_integer] = ACTIONS(7), [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), + [sym_empty] = ACTIONS(15), + [anon_sym_LPAREN] = ACTIONS(17), + }, + [3] = { + [sym_expression] = STATE(3), + [sym_operator] = STATE(3), + [sym_tool] = STATE(4), + [sym_list] = STATE(4), + [aux_sym_source_file_repeat1] = STATE(3), + [ts_builtin_sym_end] = ACTIONS(23), + [sym_comment] = ACTIONS(25), + [sym_identifier] = ACTIONS(28), + [anon_sym_EQ] = ACTIONS(31), + [anon_sym_DASH] = ACTIONS(31), + [anon_sym_PLUS] = ACTIONS(31), + [anon_sym_SEMI] = ACTIONS(31), + [anon_sym_SLASH] = ACTIONS(31), + [anon_sym_PIPE] = ACTIONS(34), + [anon_sym_AMP] = ACTIONS(31), + [anon_sym_random] = ACTIONS(37), + [anon_sym_random_boolean] = ACTIONS(37), + [anon_sym_random_integer] = ACTIONS(37), + [anon_sym_random_string] = ACTIONS(37), + [anon_sym_random_float] = ACTIONS(37), + [sym_float] = ACTIONS(40), + [sym_integer] = ACTIONS(28), + [sym_string] = ACTIONS(40), + [sym_empty] = ACTIONS(40), + [anon_sym_LPAREN] = ACTIONS(43), + }, + [4] = { + [ts_builtin_sym_end] = ACTIONS(46), + [sym_comment] = ACTIONS(46), + [sym_identifier] = ACTIONS(48), + [anon_sym_EQ] = ACTIONS(46), + [anon_sym_DASH] = ACTIONS(46), + [anon_sym_PLUS] = ACTIONS(46), + [anon_sym_SEMI] = ACTIONS(46), + [anon_sym_SLASH] = ACTIONS(46), + [anon_sym_PIPE] = ACTIONS(48), + [anon_sym_AMP] = ACTIONS(46), + [anon_sym_random] = ACTIONS(48), + [anon_sym_random_boolean] = ACTIONS(48), + [anon_sym_random_integer] = ACTIONS(48), + [anon_sym_random_string] = ACTIONS(48), + [anon_sym_random_float] = ACTIONS(48), + [sym_float] = ACTIONS(46), + [sym_integer] = ACTIONS(48), + [sym_string] = ACTIONS(46), + [sym_empty] = ACTIONS(46), + [anon_sym_LPAREN] = ACTIONS(48), + }, + [5] = { + [ts_builtin_sym_end] = ACTIONS(50), + [sym_comment] = ACTIONS(50), + [sym_identifier] = ACTIONS(52), + [anon_sym_EQ] = ACTIONS(50), + [anon_sym_DASH] = ACTIONS(50), + [anon_sym_PLUS] = ACTIONS(50), + [anon_sym_SEMI] = ACTIONS(50), + [anon_sym_SLASH] = ACTIONS(50), + [anon_sym_PIPE] = ACTIONS(52), + [anon_sym_AMP] = ACTIONS(50), + [anon_sym_random] = ACTIONS(52), + [anon_sym_random_boolean] = ACTIONS(52), + [anon_sym_random_integer] = ACTIONS(52), + [anon_sym_random_string] = ACTIONS(52), + [anon_sym_random_float] = ACTIONS(52), + [sym_float] = ACTIONS(50), + [sym_integer] = ACTIONS(52), + [sym_string] = ACTIONS(50), + [sym_empty] = ACTIONS(50), + [anon_sym_LPAREN] = ACTIONS(52), + }, + [6] = { + [ts_builtin_sym_end] = ACTIONS(54), + [sym_comment] = ACTIONS(54), + [sym_identifier] = ACTIONS(56), + [anon_sym_EQ] = ACTIONS(54), + [anon_sym_DASH] = ACTIONS(54), + [anon_sym_PLUS] = ACTIONS(54), + [anon_sym_SEMI] = ACTIONS(54), + [anon_sym_SLASH] = ACTIONS(54), + [anon_sym_PIPE] = ACTIONS(56), + [anon_sym_AMP] = ACTIONS(54), + [anon_sym_random] = ACTIONS(56), + [anon_sym_random_boolean] = ACTIONS(56), + [anon_sym_random_integer] = ACTIONS(56), + [anon_sym_random_string] = ACTIONS(56), + [anon_sym_random_float] = ACTIONS(56), + [sym_float] = ACTIONS(54), + [sym_integer] = ACTIONS(56), + [sym_string] = ACTIONS(54), + [sym_empty] = ACTIONS(54), + [anon_sym_LPAREN] = ACTIONS(56), + }, + [7] = { + [ts_builtin_sym_end] = ACTIONS(58), + [sym_comment] = ACTIONS(58), + [sym_identifier] = ACTIONS(60), + [anon_sym_EQ] = ACTIONS(58), + [anon_sym_DASH] = ACTIONS(58), + [anon_sym_PLUS] = ACTIONS(58), + [anon_sym_SEMI] = ACTIONS(58), + [anon_sym_SLASH] = ACTIONS(58), + [anon_sym_PIPE] = ACTIONS(60), + [anon_sym_AMP] = ACTIONS(58), + [anon_sym_random] = ACTIONS(60), + [anon_sym_random_boolean] = ACTIONS(60), + [anon_sym_random_integer] = ACTIONS(60), + [anon_sym_random_string] = ACTIONS(60), + [anon_sym_random_float] = ACTIONS(60), + [sym_float] = ACTIONS(58), + [sym_integer] = ACTIONS(60), + [sym_string] = ACTIONS(58), + [sym_empty] = ACTIONS(58), + [anon_sym_LPAREN] = ACTIONS(60), + }, + [8] = { + [sym_expression] = STATE(13), + [sym_tool] = STATE(14), + [sym_list] = STATE(14), + [aux_sym_list_repeat1] = STATE(9), + [sym_identifier] = ACTIONS(62), + [anon_sym_random] = ACTIONS(64), + [anon_sym_random_boolean] = ACTIONS(64), + [anon_sym_random_integer] = ACTIONS(64), + [anon_sym_random_string] = ACTIONS(64), + [anon_sym_random_float] = ACTIONS(64), + [sym_float] = ACTIONS(66), + [sym_integer] = ACTIONS(62), + [sym_string] = ACTIONS(66), + [sym_empty] = ACTIONS(66), + [anon_sym_LPAREN] = ACTIONS(68), + [anon_sym_RPAREN] = ACTIONS(70), + }, + [9] = { + [sym_expression] = STATE(13), + [sym_tool] = STATE(14), + [sym_list] = STATE(14), + [aux_sym_list_repeat1] = STATE(9), + [sym_identifier] = ACTIONS(72), + [anon_sym_random] = ACTIONS(75), + [anon_sym_random_boolean] = ACTIONS(75), + [anon_sym_random_integer] = ACTIONS(75), + [anon_sym_random_string] = ACTIONS(75), + [anon_sym_random_float] = ACTIONS(75), + [sym_float] = ACTIONS(78), + [sym_integer] = ACTIONS(72), + [sym_string] = ACTIONS(78), + [sym_empty] = ACTIONS(78), + [anon_sym_LPAREN] = ACTIONS(81), + [anon_sym_RPAREN] = ACTIONS(84), + }, + [10] = { + [sym_expression] = STATE(13), + [sym_tool] = STATE(14), + [sym_list] = STATE(14), + [aux_sym_list_repeat1] = STATE(9), + [sym_identifier] = ACTIONS(62), + [anon_sym_random] = ACTIONS(64), + [anon_sym_random_boolean] = ACTIONS(64), + [anon_sym_random_integer] = ACTIONS(64), + [anon_sym_random_string] = ACTIONS(64), + [anon_sym_random_float] = ACTIONS(64), + [sym_float] = ACTIONS(66), + [sym_integer] = ACTIONS(62), + [sym_string] = ACTIONS(66), + [sym_empty] = ACTIONS(66), + [anon_sym_LPAREN] = ACTIONS(68), + [anon_sym_RPAREN] = ACTIONS(86), }, }; static const uint16_t ts_small_parse_table[] = { - [0] = 8, - ACTIONS(7), 1, - sym_identifier, - ACTIONS(11), 1, + [0] = 7, + ACTIONS(68), 1, anon_sym_LPAREN, - ACTIONS(23), 1, - ts_builtin_sym_end, - ACTIONS(25), 1, - sym_comment, - ACTIONS(9), 2, - sym_integer, - sym_string, - ACTIONS(13), 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, - [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, - 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, - ACTIONS(44), 1, - anon_sym_RPAREN, - STATE(6), 1, + STATE(8), 1, aux_sym_list_repeat1, - STATE(12), 1, + STATE(13), 1, sym_expression, - ACTIONS(9), 2, + ACTIONS(62), 2, + sym_identifier, sym_integer, - sym_string, - ACTIONS(13), 2, - anon_sym_assert, - anon_sym_assert_equal, - STATE(7), 2, + STATE(14), 2, + sym_tool, 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, - ACTIONS(57), 2, - anon_sym_assert, - anon_sym_assert_equal, - STATE(7), 2, - sym_list, - sym_macro, - [114] = 2, - ACTIONS(17), 3, - sym_identifier, - anon_sym_assert, - anon_sym_assert_equal, - ACTIONS(15), 7, - ts_builtin_sym_end, - sym_comment, - sym_integer, - sym_string, - anon_sym_LPAREN, - anon_sym_COMMA, - anon_sym_RPAREN, - [129] = 7, - ACTIONS(7), 1, - sym_identifier, - 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_float, sym_string, + sym_empty, + ACTIONS(64), 5, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, + [30] = 7, + ACTIONS(68), 1, anon_sym_LPAREN, + STATE(10), 1, + aux_sym_list_repeat1, + STATE(13), 1, + sym_expression, + ACTIONS(62), 2, + sym_identifier, + sym_integer, + STATE(14), 2, + sym_tool, + sym_list, + ACTIONS(66), 3, + sym_float, + sym_string, + sym_empty, + ACTIONS(64), 5, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, + [60] = 3, + ACTIONS(92), 1, + anon_sym_COMMA, + ACTIONS(90), 4, + sym_float, + sym_string, + sym_empty, + anon_sym_RPAREN, + ACTIONS(88), 8, + sym_identifier, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, + sym_integer, + anon_sym_LPAREN, + [80] = 2, + ACTIONS(46), 5, + sym_float, + sym_string, + sym_empty, anon_sym_COMMA, anon_sym_RPAREN, - [184] = 2, - ACTIONS(70), 3, + ACTIONS(48), 8, sym_identifier, - anon_sym_assert, - anon_sym_assert_equal, - ACTIONS(68), 7, - ts_builtin_sym_end, - sym_comment, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, sym_integer, - sym_string, anon_sym_LPAREN, + [98] = 2, + ACTIONS(54), 5, + sym_float, + sym_string, + sym_empty, anon_sym_COMMA, anon_sym_RPAREN, - [199] = 3, - ACTIONS(76), 1, + ACTIONS(56), 8, + sym_identifier, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, + sym_integer, + anon_sym_LPAREN, + [116] = 2, + ACTIONS(58), 5, + sym_float, + sym_string, + sym_empty, 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, + ACTIONS(60), 8, sym_identifier, - anon_sym_assert, - anon_sym_assert_equal, - ACTIONS(55), 4, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, sym_integer, - sym_string, anon_sym_LPAREN, + [134] = 2, + ACTIONS(84), 4, + sym_float, + sym_string, + sym_empty, anon_sym_RPAREN, - [226] = 1, - ACTIONS(80), 1, + ACTIONS(94), 8, + sym_identifier, + anon_sym_random, + anon_sym_random_boolean, + anon_sym_random_integer, + anon_sym_random_string, + anon_sym_random_float, + sym_integer, + anon_sym_LPAREN, + [151] = 1, + ACTIONS(96), 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)] = 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, + [SMALL_STATE(11)] = 0, + [SMALL_STATE(12)] = 30, + [SMALL_STATE(13)] = 60, + [SMALL_STATE(14)] = 80, + [SMALL_STATE(15)] = 98, + [SMALL_STATE(16)] = 116, + [SMALL_STATE(17)] = 134, + [SMALL_STATE(18)] = 151, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [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 = 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), + [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5), + [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(6), + [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), + [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [25] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(3), + [28] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), + [31] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), + [34] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), + [37] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(6), + [40] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), + [43] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(11), + [46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), + [48] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), + [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1), + [52] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_operator, 1), + [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_tool, 1), + [56] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_tool, 1), + [58] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), + [60] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3), + [62] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), + [64] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15), + [66] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), + [68] = {.entry = {.count = 1, .reusable = false}}, SHIFT(12), + [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [72] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(14), + [75] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(15), + [78] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(14), + [81] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(12), + [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), + [86] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [88] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1), + [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1), + [92] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [94] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), + [96] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), }; #ifdef __cplusplus