Add macro parsing

This commit is contained in:
Jeff 2023-08-22 19:02:07 -04:00
parent ff5965f423
commit 5995338720
5 changed files with 504 additions and 256 deletions

View File

@ -11,6 +11,7 @@ module.exports = grammar({
$.integer, $.integer,
$.string, $.string,
$.list, $.list,
$.macro,
seq($.identifier, $.operator, $.identifier) seq($.identifier, $.operator, $.identifier)
), ),
@ -37,5 +38,10 @@ module.exports = grammar({
repeat1(seq($.expression, optional(','))), repeat1(seq($.expression, optional(','))),
')' ')'
), ),
macro: $ => choice(
"assert",
"assert_equal"
)
} }
}); });

View File

@ -2,3 +2,4 @@
(operator) @operator (operator) @operator
(integer) @number.integer (integer) @number.integer
(string) @string (string) @string
(macro) @functions.builtin

View File

@ -40,6 +40,10 @@
"type": "SYMBOL", "type": "SYMBOL",
"name": "list" "name": "list"
}, },
{
"type": "SYMBOL",
"name": "macro"
},
{ {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -144,6 +148,19 @@
"value": ")" "value": ")"
} }
] ]
},
"macro": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "assert"
},
{
"type": "STRING",
"value": "assert_equal"
}
]
} }
}, },
"extras": [ "extras": [

View File

@ -19,6 +19,10 @@
"type": "list", "type": "list",
"named": true "named": true
}, },
{
"type": "macro",
"named": true
},
{ {
"type": "operator", "type": "operator",
"named": true "named": true
@ -45,6 +49,11 @@
] ]
} }
}, },
{
"type": "macro",
"named": true,
"fields": {}
},
{ {
"type": "operator", "type": "operator",
"named": true, "named": true,
@ -105,6 +114,14 @@
"type": "=", "type": "=",
"named": false "named": false
}, },
{
"type": "assert",
"named": false
},
{
"type": "assert_equal",
"named": false
},
{ {
"type": "comment", "type": "comment",
"named": true "named": true

View File

@ -6,11 +6,11 @@
#endif #endif
#define LANGUAGE_VERSION 14 #define LANGUAGE_VERSION 14
#define STATE_COUNT 16 #define STATE_COUNT 17
#define LARGE_STATE_COUNT 3 #define LARGE_STATE_COUNT 3
#define SYMBOL_COUNT 22 #define SYMBOL_COUNT 25
#define ALIAS_COUNT 0 #define ALIAS_COUNT 0
#define TOKEN_COUNT 16 #define TOKEN_COUNT 18
#define EXTERNAL_TOKEN_COUNT 0 #define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 0 #define FIELD_COUNT 0
#define MAX_ALIAS_SEQUENCE_LENGTH 3 #define MAX_ALIAS_SEQUENCE_LENGTH 3
@ -32,12 +32,15 @@ enum {
anon_sym_LPAREN = 13, anon_sym_LPAREN = 13,
anon_sym_COMMA = 14, anon_sym_COMMA = 14,
anon_sym_RPAREN = 15, anon_sym_RPAREN = 15,
sym_source_file = 16, anon_sym_assert = 16,
sym_expression = 17, anon_sym_assert_equal = 17,
sym_operator = 18, sym_source_file = 18,
sym_list = 19, sym_expression = 19,
aux_sym_source_file_repeat1 = 20, sym_operator = 20,
aux_sym_list_repeat1 = 21, sym_list = 21,
sym_macro = 22,
aux_sym_source_file_repeat1 = 23,
aux_sym_list_repeat1 = 24,
}; };
static const char * const ts_symbol_names[] = { static const char * const ts_symbol_names[] = {
@ -57,10 +60,13 @@ static const char * const ts_symbol_names[] = {
[anon_sym_LPAREN] = "(", [anon_sym_LPAREN] = "(",
[anon_sym_COMMA] = ",", [anon_sym_COMMA] = ",",
[anon_sym_RPAREN] = ")", [anon_sym_RPAREN] = ")",
[anon_sym_assert] = "assert",
[anon_sym_assert_equal] = "assert_equal",
[sym_source_file] = "source_file", [sym_source_file] = "source_file",
[sym_expression] = "expression", [sym_expression] = "expression",
[sym_operator] = "operator", [sym_operator] = "operator",
[sym_list] = "list", [sym_list] = "list",
[sym_macro] = "macro",
[aux_sym_source_file_repeat1] = "source_file_repeat1", [aux_sym_source_file_repeat1] = "source_file_repeat1",
[aux_sym_list_repeat1] = "list_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_LPAREN] = anon_sym_LPAREN,
[anon_sym_COMMA] = anon_sym_COMMA, [anon_sym_COMMA] = anon_sym_COMMA,
[anon_sym_RPAREN] = anon_sym_RPAREN, [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_source_file] = sym_source_file,
[sym_expression] = sym_expression, [sym_expression] = sym_expression,
[sym_operator] = sym_operator, [sym_operator] = sym_operator,
[sym_list] = sym_list, [sym_list] = sym_list,
[sym_macro] = sym_macro,
[aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1,
[aux_sym_list_repeat1] = aux_sym_list_repeat1, [aux_sym_list_repeat1] = aux_sym_list_repeat1,
}; };
@ -155,6 +164,14 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = false, .named = false,
}, },
[anon_sym_assert] = {
.visible = true,
.named = false,
},
[anon_sym_assert_equal] = {
.visible = true,
.named = false,
},
[sym_source_file] = { [sym_source_file] = {
.visible = true, .visible = true,
.named = true, .named = true,
@ -171,6 +188,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = true, .named = true,
}, },
[sym_macro] = {
.visible = true,
.named = true,
},
[aux_sym_source_file_repeat1] = { [aux_sym_source_file_repeat1] = {
.visible = false, .visible = false,
.named = false, .named = false,
@ -206,6 +227,7 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = {
[13] = 13, [13] = 13,
[14] = 14, [14] = 14,
[15] = 15, [15] = 15,
[16] = 16,
}; };
static bool ts_lex(TSLexer *lexer, TSStateId state) { static bool ts_lex(TSLexer *lexer, TSStateId state) {
@ -213,145 +235,264 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
eof = lexer->eof(lexer); eof = lexer->eof(lexer);
switch (state) { switch (state) {
case 0: case 0:
if (eof) ADVANCE(6); if (eof) ADVANCE(7);
if (lookahead == '"') ADVANCE(2); if (lookahead == '"') ADVANCE(2);
if (lookahead == '#') ADVANCE(4); if (lookahead == '#') ADVANCE(5);
if (lookahead == '&') ADVANCE(17); if (lookahead == '&') ADVANCE(28);
if (lookahead == '\'') ADVANCE(3); if (lookahead == '\'') ADVANCE(3);
if (lookahead == '(') ADVANCE(21); if (lookahead == '(') ADVANCE(32);
if (lookahead == ')') ADVANCE(23); if (lookahead == ')') ADVANCE(34);
if (lookahead == '+') ADVANCE(13); if (lookahead == '+') ADVANCE(24);
if (lookahead == ',') ADVANCE(22); if (lookahead == ',') ADVANCE(33);
if (lookahead == '-') ADVANCE(12); if (lookahead == '-') ADVANCE(23);
if (lookahead == '/') ADVANCE(15); if (lookahead == '/') ADVANCE(26);
if (lookahead == ';') ADVANCE(14); if (lookahead == ';') ADVANCE(25);
if (lookahead == '=') ADVANCE(11); if (lookahead == '=') ADVANCE(22);
if (lookahead == '|') ADVANCE(16); if (lookahead == 'a') ADVANCE(17);
if (lookahead == '|') ADVANCE(27);
if (lookahead == '\t' || if (lookahead == '\t' ||
lookahead == '\n' || lookahead == '\n' ||
lookahead == '\r' || lookahead == '\r' ||
lookahead == ' ') SKIP(0) lookahead == ' ') SKIP(0)
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(18); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(29);
if (lookahead == '.' || if (lookahead == '.' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' || lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(10); ('b' <= lookahead && lookahead <= 'z')) ADVANCE(21);
END_STATE(); END_STATE();
case 1: case 1:
if (lookahead == '\n') ADVANCE(7); if (lookahead == '\n') ADVANCE(8);
if (lookahead == '\r') ADVANCE(8); if (lookahead == '\r') ADVANCE(9);
if (lookahead != 0) ADVANCE(1); if (lookahead != 0) ADVANCE(1);
END_STATE(); END_STATE();
case 2: case 2:
if (lookahead == '"') ADVANCE(19); if (lookahead == '"') ADVANCE(30);
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '\n') ADVANCE(2); lookahead != '\n') ADVANCE(2);
END_STATE(); END_STATE();
case 3: case 3:
if (lookahead == '\'') ADVANCE(20); if (lookahead == '\'') ADVANCE(31);
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '\n') ADVANCE(3); lookahead != '\n') ADVANCE(3);
END_STATE(); END_STATE();
case 4: 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' || if (lookahead == '\t' ||
lookahead == '\n' || lookahead == '\n' ||
lookahead == '\r' || lookahead == '\r' ||
lookahead == ' ') SKIP(5) lookahead == ' ') SKIP(4)
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(18);
if (lookahead == '.' || if (lookahead == '.' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' || lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z') || ('a' <= lookahead && lookahead <= 'z') ||
lookahead == '|') ADVANCE(10); lookahead == '|') ADVANCE(21);
END_STATE();
case 5:
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(1);
END_STATE(); END_STATE();
case 6: 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(); END_STATE();
case 7: case 7:
ACCEPT_TOKEN(sym_comment); ACCEPT_TOKEN(ts_builtin_sym_end);
END_STATE(); END_STATE();
case 8: case 8:
ACCEPT_TOKEN(sym_comment); ACCEPT_TOKEN(sym_comment);
if (lookahead == '\n') ADVANCE(7);
if (lookahead == '\r') ADVANCE(8);
if (lookahead != 0) ADVANCE(1);
END_STATE(); END_STATE();
case 9: case 9:
ACCEPT_TOKEN(sym_identifier); ACCEPT_TOKEN(sym_comment);
if (lookahead == '_') ADVANCE(9); if (lookahead == '\n') ADVANCE(8);
if (lookahead == '.' || if (lookahead == '\r') ADVANCE(9);
lookahead == '|') ADVANCE(10); if (lookahead != 0) ADVANCE(1);
if (('A' <= lookahead && lookahead <= 'Z') ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(9);
END_STATE(); END_STATE();
case 10: case 10:
ACCEPT_TOKEN(sym_identifier); ACCEPT_TOKEN(sym_identifier);
if (lookahead == '_') ADVANCE(9); if (lookahead == '_') ADVANCE(20);
if (lookahead == 'a') ADVANCE(13);
if (lookahead == '.' || if (lookahead == '.' ||
('A' <= lookahead && lookahead <= 'Z') || lookahead == '|') ADVANCE(21);
('a' <= lookahead && lookahead <= 'z') || if (('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '|') ADVANCE(10); ('b' <= lookahead && lookahead <= 'z')) ADVANCE(20);
END_STATE(); END_STATE();
case 11: case 11:
ACCEPT_TOKEN(anon_sym_EQ); ACCEPT_TOKEN(sym_identifier);
END_STATE(); if (lookahead == '_') ADVANCE(20);
case 12: if (lookahead == 'e') ADVANCE(15);
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);
if (lookahead == '.' || if (lookahead == '.' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
('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(); END_STATE();
case 17: 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(); END_STATE();
case 18: 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(); END_STATE();
case 19: 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); ACCEPT_TOKEN(sym_string);
if (lookahead == '"') ADVANCE(19); if (lookahead == '"') ADVANCE(30);
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '\n') ADVANCE(2); lookahead != '\n') ADVANCE(2);
END_STATE(); END_STATE();
case 20: case 31:
ACCEPT_TOKEN(sym_function); ACCEPT_TOKEN(sym_function);
if (lookahead == '\'') ADVANCE(20); if (lookahead == '\'') ADVANCE(31);
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '\n') ADVANCE(3); lookahead != '\n') ADVANCE(3);
END_STATE(); END_STATE();
case 21: case 32:
ACCEPT_TOKEN(anon_sym_LPAREN); ACCEPT_TOKEN(anon_sym_LPAREN);
END_STATE(); END_STATE();
case 22: case 33:
ACCEPT_TOKEN(anon_sym_COMMA); ACCEPT_TOKEN(anon_sym_COMMA);
END_STATE(); END_STATE();
case 23: case 34:
ACCEPT_TOKEN(anon_sym_RPAREN); ACCEPT_TOKEN(anon_sym_RPAREN);
END_STATE(); 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: default:
return false; return false;
} }
@ -359,21 +500,22 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
static const TSLexMode ts_lex_modes[STATE_COUNT] = { static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[0] = {.lex_state = 0}, [0] = {.lex_state = 0},
[1] = {.lex_state = 5}, [1] = {.lex_state = 6},
[2] = {.lex_state = 0}, [2] = {.lex_state = 0},
[3] = {.lex_state = 5}, [3] = {.lex_state = 6},
[4] = {.lex_state = 5}, [4] = {.lex_state = 6},
[5] = {.lex_state = 5}, [5] = {.lex_state = 6},
[6] = {.lex_state = 5}, [6] = {.lex_state = 6},
[7] = {.lex_state = 5}, [7] = {.lex_state = 6},
[8] = {.lex_state = 5}, [8] = {.lex_state = 6},
[9] = {.lex_state = 5}, [9] = {.lex_state = 6},
[10] = {.lex_state = 5}, [10] = {.lex_state = 6},
[11] = {.lex_state = 5}, [11] = {.lex_state = 6},
[12] = {.lex_state = 5}, [12] = {.lex_state = 6},
[13] = {.lex_state = 0}, [13] = {.lex_state = 6},
[14] = {.lex_state = 5}, [14] = {.lex_state = 0},
[15] = {.lex_state = 5}, [15] = {.lex_state = 4},
[16] = {.lex_state = 4},
}; };
static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { 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_LPAREN] = ACTIONS(1),
[anon_sym_COMMA] = ACTIONS(1), [anon_sym_COMMA] = ACTIONS(1),
[anon_sym_RPAREN] = ACTIONS(1), [anon_sym_RPAREN] = ACTIONS(1),
[anon_sym_assert] = ACTIONS(1),
[anon_sym_assert_equal] = ACTIONS(1),
}, },
[1] = { [1] = {
[sym_source_file] = STATE(13), [sym_source_file] = STATE(14),
[sym_expression] = STATE(3), [sym_expression] = STATE(3),
[sym_list] = STATE(5), [sym_list] = STATE(7),
[sym_macro] = STATE(7),
[aux_sym_source_file_repeat1] = STATE(3), [aux_sym_source_file_repeat1] = STATE(3),
[ts_builtin_sym_end] = ACTIONS(3), [ts_builtin_sym_end] = ACTIONS(3),
[sym_comment] = ACTIONS(5), [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_integer] = ACTIONS(9),
[sym_string] = ACTIONS(9), [sym_string] = ACTIONS(9),
[anon_sym_LPAREN] = ACTIONS(11), [anon_sym_LPAREN] = ACTIONS(11),
[anon_sym_assert] = ACTIONS(13),
[anon_sym_assert_equal] = ACTIONS(13),
}, },
[2] = { [2] = {
[sym_operator] = STATE(15), [sym_operator] = STATE(16),
[ts_builtin_sym_end] = ACTIONS(13), [ts_builtin_sym_end] = ACTIONS(15),
[sym_comment] = ACTIONS(13), [sym_comment] = ACTIONS(15),
[sym_identifier] = ACTIONS(15), [sym_identifier] = ACTIONS(17),
[anon_sym_EQ] = ACTIONS(17), [anon_sym_EQ] = ACTIONS(19),
[anon_sym_DASH] = ACTIONS(17), [anon_sym_DASH] = ACTIONS(19),
[anon_sym_PLUS] = ACTIONS(17), [anon_sym_PLUS] = ACTIONS(19),
[anon_sym_SEMI] = ACTIONS(17), [anon_sym_SEMI] = ACTIONS(19),
[anon_sym_SLASH] = ACTIONS(17), [anon_sym_SLASH] = ACTIONS(19),
[anon_sym_PIPE] = ACTIONS(19), [anon_sym_PIPE] = ACTIONS(21),
[anon_sym_AMP] = ACTIONS(17), [anon_sym_AMP] = ACTIONS(19),
[sym_integer] = ACTIONS(13), [sym_integer] = ACTIONS(15),
[sym_string] = ACTIONS(13), [sym_string] = ACTIONS(15),
[anon_sym_LPAREN] = ACTIONS(13), [anon_sym_LPAREN] = ACTIONS(15),
[anon_sym_COMMA] = ACTIONS(13), [anon_sym_COMMA] = ACTIONS(15),
[anon_sym_RPAREN] = ACTIONS(13), [anon_sym_RPAREN] = ACTIONS(15),
[anon_sym_assert] = ACTIONS(17),
[anon_sym_assert_equal] = ACTIONS(17),
}, },
}; };
static const uint16_t ts_small_parse_table[] = { static const uint16_t ts_small_parse_table[] = {
[0] = 7, [0] = 8,
ACTIONS(7), 1, ACTIONS(7), 1,
sym_identifier, sym_identifier,
ACTIONS(11), 1, ACTIONS(11), 1,
anon_sym_LPAREN, anon_sym_LPAREN,
ACTIONS(21), 1,
ts_builtin_sym_end,
ACTIONS(23), 1, ACTIONS(23), 1,
sym_comment, ts_builtin_sym_end,
STATE(5), 1,
sym_list,
ACTIONS(9), 2,
sym_integer,
sym_string,
STATE(4), 2,
sym_expression,
aux_sym_source_file_repeat1,
[24] = 7,
ACTIONS(25), 1, ACTIONS(25), 1,
ts_builtin_sym_end,
ACTIONS(27), 1,
sym_comment, 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, ACTIONS(9), 2,
sym_integer, sym_integer,
sym_string, sym_string,
[82] = 1, ACTIONS(13), 2,
ACTIONS(41), 8, anon_sym_assert,
ts_builtin_sym_end, anon_sym_assert_equal,
sym_comment, STATE(4), 2,
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,
sym_expression, 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_integer,
sym_string, 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, ACTIONS(7), 1,
sym_identifier, sym_identifier,
ACTIONS(11), 1, ACTIONS(11), 1,
anon_sym_LPAREN, anon_sym_LPAREN,
STATE(5), 1, ACTIONS(44), 1,
sym_list, anon_sym_RPAREN,
STATE(6), 1, STATE(6), 1,
aux_sym_list_repeat1, aux_sym_list_repeat1,
STATE(11), 1, STATE(12), 1,
sym_expression, sym_expression,
ACTIONS(9), 2, ACTIONS(9), 2,
sym_integer, sym_integer,
sym_string, sym_string,
[147] = 2, ACTIONS(13), 2,
ACTIONS(58), 1, anon_sym_assert,
anon_sym_COMMA, anon_sym_assert_equal,
ACTIONS(56), 5, STATE(7), 2,
sym_list,
sym_macro,
[86] = 8,
ACTIONS(46), 1,
sym_identifier, 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_integer,
sym_string, sym_string,
anon_sym_LPAREN, ACTIONS(57), 2,
anon_sym_RPAREN, anon_sym_assert,
[158] = 1, anon_sym_assert_equal,
ACTIONS(54), 5, STATE(7), 2,
sym_list,
sym_macro,
[114] = 2,
ACTIONS(17), 3,
sym_identifier, sym_identifier,
sym_integer, anon_sym_assert,
sym_string, anon_sym_assert_equal,
anon_sym_LPAREN, ACTIONS(15), 7,
anon_sym_RPAREN,
[166] = 1,
ACTIONS(60), 1,
ts_builtin_sym_end, ts_builtin_sym_end,
[170] = 1, sym_comment,
ACTIONS(62), 1, sym_integer,
sym_string,
anon_sym_LPAREN,
anon_sym_COMMA,
anon_sym_RPAREN,
[129] = 7,
ACTIONS(7), 1,
sym_identifier, sym_identifier,
[174] = 1, ACTIONS(11), 1,
ACTIONS(64), 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, sym_identifier,
}; };
static const uint32_t ts_small_parse_table_map[] = { static const uint32_t ts_small_parse_table_map[] = {
[SMALL_STATE(3)] = 0, [SMALL_STATE(3)] = 0,
[SMALL_STATE(4)] = 24, [SMALL_STATE(4)] = 29,
[SMALL_STATE(5)] = 48, [SMALL_STATE(5)] = 58,
[SMALL_STATE(6)] = 59, [SMALL_STATE(6)] = 86,
[SMALL_STATE(7)] = 82, [SMALL_STATE(7)] = 114,
[SMALL_STATE(8)] = 93, [SMALL_STATE(8)] = 129,
[SMALL_STATE(9)] = 104, [SMALL_STATE(9)] = 154,
[SMALL_STATE(10)] = 127, [SMALL_STATE(10)] = 169,
[SMALL_STATE(11)] = 147, [SMALL_STATE(11)] = 184,
[SMALL_STATE(12)] = 158, [SMALL_STATE(12)] = 199,
[SMALL_STATE(13)] = 166, [SMALL_STATE(13)] = 214,
[SMALL_STATE(14)] = 170, [SMALL_STATE(14)] = 226,
[SMALL_STATE(15)] = 174, [SMALL_STATE(15)] = 230,
[SMALL_STATE(16)] = 234,
}; };
static const TSParseActionEntry ts_parse_actions[] = { static const TSParseActionEntry ts_parse_actions[] = {
@ -586,32 +784,41 @@ static const TSParseActionEntry ts_parse_actions[] = {
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
[3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0),
[5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3),
[7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
[9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7),
[11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
[13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9),
[15] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1),
[17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), [17] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1),
[19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
[21] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15),
[23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1),
[25] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4),
[27] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), [27] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2),
[30] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2), [29] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4),
[33] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), [32] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2),
[36] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(10), [35] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(7),
[39] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(8),
[41] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3), [41] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(9),
[43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11),
[45] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(2), [46] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(2),
[48] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(5), [49] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(7),
[51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(10), [52] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8),
[54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2),
[56] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1), [57] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(9),
[58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_macro, 1),
[60] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), [62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_macro, 1),
[62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1), [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3),
[64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), [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 #ifdef __cplusplus