Add statment tests

This commit is contained in:
Jeff 2023-09-27 19:10:21 -04:00
parent ee5ba3bf3f
commit dd857a8291
5 changed files with 415 additions and 423 deletions

View File

@ -10,15 +10,18 @@ x;
(source (source
(statement (statement
(expression
(value (value
(integer)) (integer)))
(close)) (close))
(statement (statement
(expression
(value (value
(string)) (string)))
(close)) (close))
(statement (statement
(identifier) (expression
(identifier))
(close))) (close)))
================== ==================
@ -32,19 +35,37 @@ y = "one";
(source (source
(statement (statement
(expression
(identifier) (identifier)
(operator (operator)
(assignment)) (value
(integer)))
(close))
(statement (statement
(expression
(identifier)
(operator)
(value
(string)))
(close)))
==================
Complex Assignment
==================
x = 1 + 1;
---
(source
(statement
(expression
(identifier)
(operator)
(expression
(value (value
(integer)) (integer))
(close))) (operator)
(statement
(identifier)
(operator
(assignment))
(statement
(value (value
(string)) (integer))))
(close)))) (close)))

View File

@ -6,10 +6,22 @@ module.exports = grammar({
$.statement, $.statement,
)), )),
statement: $ => choice( statement: $ => seq($.expression, $.close),
seq($.value, $.close),
seq($.identifier, $.close), expression: $ => choice(
seq($.identifier, $.operator, $.statement), $.identifier,
prec(1, $.value),
prec(2, seq(
choice(
$.value,
$.identifier,
),
$.operator,
choice(
$.value,
$.identifier,
$.expression,
))),
), ),
close: $ => ";", close: $ => ";",
@ -50,13 +62,7 @@ module.exports = grammar({
operator: $ => choice( operator: $ => choice(
'+', '+',
'-', '-',
$.assignment,
),
assignment: $ => choice(
'=', '=',
'+=',
'-=',
), ),
} }
}); });

View File

@ -14,10 +14,41 @@
} }
}, },
"statement": { "statement": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "close"
}
]
},
"expression": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "PREC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "value"
}
},
{
"type": "PREC",
"value": 2,
"content": {
"type": "SEQ", "type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "SYMBOL",
@ -25,41 +56,35 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "close" "name": "identifier"
} }
] ]
}, },
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "close"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "operator" "name": "operator"
}, },
{
"type": "CHOICE",
"members": [
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "statement" "name": "value"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "expression"
} }
] ]
} }
] ]
}
}
]
}, },
"close": { "close": {
"type": "STRING", "type": "STRING",
@ -183,26 +208,9 @@
"type": "STRING", "type": "STRING",
"value": "-" "value": "-"
}, },
{
"type": "SYMBOL",
"name": "assignment"
}
]
},
"assignment": {
"type": "CHOICE",
"members": [
{ {
"type": "STRING", "type": "STRING",
"value": "=" "value": "="
},
{
"type": "STRING",
"value": "+="
},
{
"type": "STRING",
"value": "-="
} }
] ]
} }

View File

@ -1,14 +1,36 @@
[ [
{
"type": "assignment",
"named": true,
"fields": {}
},
{ {
"type": "boolean", "type": "boolean",
"named": true, "named": true,
"fields": {} "fields": {}
}, },
{
"type": "expression",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "expression",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "operator",
"named": true
},
{
"type": "value",
"named": true
}
]
}
},
{ {
"type": "list", "type": "list",
"named": true, "named": true,
@ -27,17 +49,7 @@
{ {
"type": "operator", "type": "operator",
"named": true, "named": true,
"fields": {}, "fields": {}
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "assignment",
"named": true
}
]
}
}, },
{ {
"type": "source", "type": "source",
@ -67,19 +79,7 @@
"named": true "named": true
}, },
{ {
"type": "identifier", "type": "expression",
"named": true
},
{
"type": "operator",
"named": true
},
{
"type": "statement",
"named": true
},
{
"type": "value",
"named": true "named": true
} }
] ]
@ -136,10 +136,6 @@
"type": "+", "type": "+",
"named": false "named": false
}, },
{
"type": "+=",
"named": false
},
{ {
"type": ",", "type": ",",
"named": false "named": false
@ -148,10 +144,6 @@
"type": "-", "type": "-",
"named": false "named": false
}, },
{
"type": "-=",
"named": false
},
{ {
"type": "=", "type": "=",
"named": false "named": false

View File

@ -6,11 +6,11 @@
#endif #endif
#define LANGUAGE_VERSION 14 #define LANGUAGE_VERSION 14
#define STATE_COUNT 20 #define STATE_COUNT 22
#define LARGE_STATE_COUNT 4 #define LARGE_STATE_COUNT 10
#define SYMBOL_COUNT 27 #define SYMBOL_COUNT 25
#define ALIAS_COUNT 0 #define ALIAS_COUNT 0
#define TOKEN_COUNT 18 #define TOKEN_COUNT 16
#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,17 +32,15 @@ enum {
anon_sym_PLUS = 13, anon_sym_PLUS = 13,
anon_sym_DASH = 14, anon_sym_DASH = 14,
anon_sym_EQ = 15, anon_sym_EQ = 15,
anon_sym_PLUS_EQ = 16, sym_source = 16,
anon_sym_DASH_EQ = 17, sym_statement = 17,
sym_source = 18, sym_expression = 18,
sym_statement = 19, sym_value = 19,
sym_value = 20, sym_boolean = 20,
sym_boolean = 21, sym_list = 21,
sym_list = 22, sym_operator = 22,
sym_operator = 23, aux_sym_source_repeat1 = 23,
sym_assignment = 24, aux_sym_list_repeat1 = 24,
aux_sym_source_repeat1 = 25,
aux_sym_list_repeat1 = 26,
}; };
static const char * const ts_symbol_names[] = { static const char * const ts_symbol_names[] = {
@ -62,15 +60,13 @@ static const char * const ts_symbol_names[] = {
[anon_sym_PLUS] = "+", [anon_sym_PLUS] = "+",
[anon_sym_DASH] = "-", [anon_sym_DASH] = "-",
[anon_sym_EQ] = "=", [anon_sym_EQ] = "=",
[anon_sym_PLUS_EQ] = "+=",
[anon_sym_DASH_EQ] = "-=",
[sym_source] = "source", [sym_source] = "source",
[sym_statement] = "statement", [sym_statement] = "statement",
[sym_expression] = "expression",
[sym_value] = "value", [sym_value] = "value",
[sym_boolean] = "boolean", [sym_boolean] = "boolean",
[sym_list] = "list", [sym_list] = "list",
[sym_operator] = "operator", [sym_operator] = "operator",
[sym_assignment] = "assignment",
[aux_sym_source_repeat1] = "source_repeat1", [aux_sym_source_repeat1] = "source_repeat1",
[aux_sym_list_repeat1] = "list_repeat1", [aux_sym_list_repeat1] = "list_repeat1",
}; };
@ -92,15 +88,13 @@ static const TSSymbol ts_symbol_map[] = {
[anon_sym_PLUS] = anon_sym_PLUS, [anon_sym_PLUS] = anon_sym_PLUS,
[anon_sym_DASH] = anon_sym_DASH, [anon_sym_DASH] = anon_sym_DASH,
[anon_sym_EQ] = anon_sym_EQ, [anon_sym_EQ] = anon_sym_EQ,
[anon_sym_PLUS_EQ] = anon_sym_PLUS_EQ,
[anon_sym_DASH_EQ] = anon_sym_DASH_EQ,
[sym_source] = sym_source, [sym_source] = sym_source,
[sym_statement] = sym_statement, [sym_statement] = sym_statement,
[sym_expression] = sym_expression,
[sym_value] = sym_value, [sym_value] = sym_value,
[sym_boolean] = sym_boolean, [sym_boolean] = sym_boolean,
[sym_list] = sym_list, [sym_list] = sym_list,
[sym_operator] = sym_operator, [sym_operator] = sym_operator,
[sym_assignment] = sym_assignment,
[aux_sym_source_repeat1] = aux_sym_source_repeat1, [aux_sym_source_repeat1] = aux_sym_source_repeat1,
[aux_sym_list_repeat1] = aux_sym_list_repeat1, [aux_sym_list_repeat1] = aux_sym_list_repeat1,
}; };
@ -170,14 +164,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = false, .named = false,
}, },
[anon_sym_PLUS_EQ] = {
.visible = true,
.named = false,
},
[anon_sym_DASH_EQ] = {
.visible = true,
.named = false,
},
[sym_source] = { [sym_source] = {
.visible = true, .visible = true,
.named = true, .named = true,
@ -186,6 +172,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = true, .named = true,
}, },
[sym_expression] = {
.visible = true,
.named = true,
},
[sym_value] = { [sym_value] = {
.visible = true, .visible = true,
.named = true, .named = true,
@ -202,10 +192,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = true, .named = true,
}, },
[sym_assignment] = {
.visible = true,
.named = true,
},
[aux_sym_source_repeat1] = { [aux_sym_source_repeat1] = {
.visible = false, .visible = false,
.named = false, .named = false,
@ -245,6 +231,8 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = {
[17] = 17, [17] = 17,
[18] = 18, [18] = 18,
[19] = 19, [19] = 19,
[20] = 20,
[21] = 21,
}; };
static bool ts_lex(TSLexer *lexer, TSStateId state) { static bool ts_lex(TSLexer *lexer, TSStateId state) {
@ -307,8 +295,11 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
lookahead == '`') ADVANCE(10); lookahead == '`') ADVANCE(10);
if (lookahead == '(') ADVANCE(31); if (lookahead == '(') ADVANCE(31);
if (lookahead == ')') ADVANCE(33); if (lookahead == ')') ADVANCE(33);
if (lookahead == '+') ADVANCE(34);
if (lookahead == ',') ADVANCE(32); if (lookahead == ',') ADVANCE(32);
if (lookahead == '-') ADVANCE(35);
if (lookahead == ';') ADVANCE(12); if (lookahead == ';') ADVANCE(12);
if (lookahead == '=') ADVANCE(36);
if (lookahead == 'f') ADVANCE(1); if (lookahead == 'f') ADVANCE(1);
if (lookahead == 't') ADVANCE(5); if (lookahead == 't') ADVANCE(5);
if (lookahead == '{') ADVANCE(8); if (lookahead == '{') ADVANCE(8);
@ -470,21 +461,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE(); END_STATE();
case 34: case 34:
ACCEPT_TOKEN(anon_sym_PLUS); ACCEPT_TOKEN(anon_sym_PLUS);
if (lookahead == '=') ADVANCE(37);
END_STATE(); END_STATE();
case 35: case 35:
ACCEPT_TOKEN(anon_sym_DASH); ACCEPT_TOKEN(anon_sym_DASH);
if (lookahead == '=') ADVANCE(38);
END_STATE(); END_STATE();
case 36: case 36:
ACCEPT_TOKEN(anon_sym_EQ); ACCEPT_TOKEN(anon_sym_EQ);
END_STATE(); END_STATE();
case 37:
ACCEPT_TOKEN(anon_sym_PLUS_EQ);
END_STATE();
case 38:
ACCEPT_TOKEN(anon_sym_DASH_EQ);
END_STATE();
default: default:
return false; return false;
} }
@ -495,22 +478,24 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[1] = {.lex_state = 0}, [1] = {.lex_state = 0},
[2] = {.lex_state = 0}, [2] = {.lex_state = 0},
[3] = {.lex_state = 0}, [3] = {.lex_state = 0},
[4] = {.lex_state = 0}, [4] = {.lex_state = 9},
[5] = {.lex_state = 9}, [5] = {.lex_state = 9},
[6] = {.lex_state = 9}, [6] = {.lex_state = 9},
[7] = {.lex_state = 9}, [7] = {.lex_state = 0},
[8] = {.lex_state = 9}, [8] = {.lex_state = 9},
[9] = {.lex_state = 9}, [9] = {.lex_state = 9},
[10] = {.lex_state = 9}, [10] = {.lex_state = 9},
[11] = {.lex_state = 0}, [11] = {.lex_state = 9},
[12] = {.lex_state = 9}, [12] = {.lex_state = 0},
[13] = {.lex_state = 0}, [13] = {.lex_state = 0},
[14] = {.lex_state = 0}, [14] = {.lex_state = 9},
[15] = {.lex_state = 0}, [15] = {.lex_state = 0},
[16] = {.lex_state = 9}, [16] = {.lex_state = 0},
[17] = {.lex_state = 0}, [17] = {.lex_state = 0},
[18] = {.lex_state = 0}, [18] = {.lex_state = 0},
[19] = {.lex_state = 0}, [19] = {.lex_state = 0},
[20] = {.lex_state = 0},
[21] = {.lex_state = 0},
}; };
static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
@ -531,16 +516,15 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
[anon_sym_PLUS] = ACTIONS(1), [anon_sym_PLUS] = ACTIONS(1),
[anon_sym_DASH] = ACTIONS(1), [anon_sym_DASH] = ACTIONS(1),
[anon_sym_EQ] = ACTIONS(1), [anon_sym_EQ] = ACTIONS(1),
[anon_sym_PLUS_EQ] = ACTIONS(1),
[anon_sym_DASH_EQ] = ACTIONS(1),
}, },
[1] = { [1] = {
[sym_source] = STATE(18), [sym_source] = STATE(21),
[sym_statement] = STATE(2), [sym_statement] = STATE(3),
[sym_value] = STATE(19), [sym_expression] = STATE(20),
[sym_boolean] = STATE(8), [sym_value] = STATE(16),
[sym_list] = STATE(8), [sym_boolean] = STATE(4),
[aux_sym_source_repeat1] = STATE(2), [sym_list] = STATE(4),
[aux_sym_source_repeat1] = STATE(3),
[ts_builtin_sym_end] = ACTIONS(3), [ts_builtin_sym_end] = ACTIONS(3),
[sym_identifier] = ACTIONS(5), [sym_identifier] = ACTIONS(5),
[sym_float] = ACTIONS(7), [sym_float] = ACTIONS(7),
@ -553,12 +537,31 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
[anon_sym_LPAREN] = ACTIONS(13), [anon_sym_LPAREN] = ACTIONS(13),
}, },
[2] = { [2] = {
[sym_statement] = STATE(3), [sym_statement] = STATE(2),
[sym_value] = STATE(19), [sym_expression] = STATE(20),
[sym_boolean] = STATE(8), [sym_value] = STATE(16),
[sym_list] = STATE(8), [sym_boolean] = STATE(4),
[aux_sym_source_repeat1] = STATE(3), [sym_list] = STATE(4),
[aux_sym_source_repeat1] = STATE(2),
[ts_builtin_sym_end] = ACTIONS(15), [ts_builtin_sym_end] = ACTIONS(15),
[sym_identifier] = ACTIONS(17),
[sym_float] = ACTIONS(20),
[sym_integer] = ACTIONS(23),
[sym_string] = ACTIONS(20),
[sym_function] = ACTIONS(20),
[sym_empty] = ACTIONS(20),
[anon_sym_true] = ACTIONS(26),
[anon_sym_false] = ACTIONS(26),
[anon_sym_LPAREN] = ACTIONS(29),
},
[3] = {
[sym_statement] = STATE(2),
[sym_expression] = STATE(20),
[sym_value] = STATE(16),
[sym_boolean] = STATE(4),
[sym_list] = STATE(4),
[aux_sym_source_repeat1] = STATE(2),
[ts_builtin_sym_end] = ACTIONS(32),
[sym_identifier] = ACTIONS(5), [sym_identifier] = ACTIONS(5),
[sym_float] = ACTIONS(7), [sym_float] = ACTIONS(7),
[sym_integer] = ACTIONS(9), [sym_integer] = ACTIONS(9),
@ -569,184 +572,151 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
[anon_sym_false] = ACTIONS(11), [anon_sym_false] = ACTIONS(11),
[anon_sym_LPAREN] = ACTIONS(13), [anon_sym_LPAREN] = ACTIONS(13),
}, },
[3] = { [4] = {
[sym_statement] = STATE(3), [sym_close] = ACTIONS(34),
[sym_value] = STATE(19), [sym_float] = ACTIONS(34),
[sym_boolean] = STATE(8), [sym_integer] = ACTIONS(36),
[sym_list] = STATE(8), [sym_string] = ACTIONS(34),
[aux_sym_source_repeat1] = STATE(3), [sym_function] = ACTIONS(34),
[ts_builtin_sym_end] = ACTIONS(17), [sym_empty] = ACTIONS(34),
[sym_identifier] = ACTIONS(19), [anon_sym_true] = ACTIONS(34),
[sym_float] = ACTIONS(22), [anon_sym_false] = ACTIONS(34),
[sym_integer] = ACTIONS(25), [anon_sym_LPAREN] = ACTIONS(36),
[sym_string] = ACTIONS(22), [anon_sym_COMMA] = ACTIONS(34),
[sym_function] = ACTIONS(22), [anon_sym_RPAREN] = ACTIONS(34),
[sym_empty] = ACTIONS(22), [anon_sym_PLUS] = ACTIONS(34),
[anon_sym_true] = ACTIONS(28), [anon_sym_DASH] = ACTIONS(34),
[anon_sym_false] = ACTIONS(28), [anon_sym_EQ] = ACTIONS(34),
[anon_sym_LPAREN] = ACTIONS(31), },
[5] = {
[sym_close] = ACTIONS(38),
[sym_float] = ACTIONS(38),
[sym_integer] = ACTIONS(40),
[sym_string] = ACTIONS(38),
[sym_function] = ACTIONS(38),
[sym_empty] = ACTIONS(38),
[anon_sym_true] = ACTIONS(38),
[anon_sym_false] = ACTIONS(38),
[anon_sym_LPAREN] = ACTIONS(40),
[anon_sym_COMMA] = ACTIONS(38),
[anon_sym_RPAREN] = ACTIONS(38),
[anon_sym_PLUS] = ACTIONS(38),
[anon_sym_DASH] = ACTIONS(38),
[anon_sym_EQ] = ACTIONS(38),
},
[6] = {
[sym_close] = ACTIONS(42),
[sym_float] = ACTIONS(42),
[sym_integer] = ACTIONS(44),
[sym_string] = ACTIONS(42),
[sym_function] = ACTIONS(42),
[sym_empty] = ACTIONS(42),
[anon_sym_true] = ACTIONS(42),
[anon_sym_false] = ACTIONS(42),
[anon_sym_LPAREN] = ACTIONS(44),
[anon_sym_COMMA] = ACTIONS(42),
[anon_sym_RPAREN] = ACTIONS(42),
[anon_sym_PLUS] = ACTIONS(42),
[anon_sym_DASH] = ACTIONS(42),
[anon_sym_EQ] = ACTIONS(42),
},
[7] = {
[sym_expression] = STATE(19),
[sym_value] = STATE(18),
[sym_boolean] = STATE(4),
[sym_list] = STATE(4),
[sym_identifier] = ACTIONS(46),
[sym_float] = ACTIONS(7),
[sym_integer] = ACTIONS(9),
[sym_string] = ACTIONS(7),
[sym_function] = ACTIONS(7),
[sym_empty] = ACTIONS(7),
[anon_sym_true] = ACTIONS(11),
[anon_sym_false] = ACTIONS(11),
[anon_sym_LPAREN] = ACTIONS(13),
},
[8] = {
[sym_value] = STATE(11),
[sym_boolean] = STATE(4),
[sym_list] = STATE(4),
[aux_sym_list_repeat1] = STATE(8),
[sym_float] = ACTIONS(48),
[sym_integer] = ACTIONS(51),
[sym_string] = ACTIONS(48),
[sym_function] = ACTIONS(48),
[sym_empty] = ACTIONS(48),
[anon_sym_true] = ACTIONS(54),
[anon_sym_false] = ACTIONS(54),
[anon_sym_LPAREN] = ACTIONS(57),
[anon_sym_RPAREN] = ACTIONS(60),
},
[9] = {
[sym_value] = STATE(11),
[sym_boolean] = STATE(4),
[sym_list] = STATE(4),
[aux_sym_list_repeat1] = STATE(8),
[sym_float] = ACTIONS(7),
[sym_integer] = ACTIONS(9),
[sym_string] = ACTIONS(7),
[sym_function] = ACTIONS(7),
[sym_empty] = ACTIONS(7),
[anon_sym_true] = ACTIONS(62),
[anon_sym_false] = ACTIONS(62),
[anon_sym_LPAREN] = ACTIONS(13),
[anon_sym_RPAREN] = ACTIONS(64),
}, },
}; };
static const uint16_t ts_small_parse_table[] = { static const uint16_t ts_small_parse_table[] = {
[0] = 8, [0] = 7,
ACTIONS(5), 1,
sym_identifier,
ACTIONS(9), 1, ACTIONS(9), 1,
sym_integer, sym_integer,
ACTIONS(13), 1, ACTIONS(13), 1,
anon_sym_LPAREN, anon_sym_LPAREN,
STATE(13), 1, STATE(9), 1,
sym_statement,
STATE(19), 1,
sym_value,
ACTIONS(11), 2,
anon_sym_true,
anon_sym_false,
STATE(8), 2,
sym_boolean,
sym_list,
ACTIONS(7), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
[30] = 8,
ACTIONS(9), 1,
sym_integer,
ACTIONS(13), 1,
anon_sym_LPAREN,
ACTIONS(36), 1,
anon_sym_RPAREN,
STATE(6), 1,
aux_sym_list_repeat1, aux_sym_list_repeat1,
STATE(12), 1, STATE(11), 1,
sym_value, sym_value,
ACTIONS(34), 2,
anon_sym_true,
anon_sym_false,
STATE(8), 2,
sym_boolean,
sym_list,
ACTIONS(7), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
[60] = 8,
ACTIONS(41), 1,
sym_integer,
ACTIONS(47), 1,
anon_sym_LPAREN,
ACTIONS(50), 1,
anon_sym_RPAREN,
STATE(6), 1,
aux_sym_list_repeat1,
STATE(12), 1,
sym_value,
ACTIONS(44), 2,
anon_sym_true,
anon_sym_false,
STATE(8), 2,
sym_boolean,
sym_list,
ACTIONS(38), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
[90] = 7,
ACTIONS(9), 1,
sym_integer,
ACTIONS(13), 1,
anon_sym_LPAREN,
STATE(5), 1,
aux_sym_list_repeat1,
STATE(12), 1,
sym_value,
ACTIONS(34), 2,
anon_sym_true,
anon_sym_false,
STATE(8), 2,
sym_boolean,
sym_list,
ACTIONS(7), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
[117] = 2,
ACTIONS(54), 2,
sym_integer,
anon_sym_LPAREN,
ACTIONS(52), 9,
sym_close,
sym_float,
sym_string,
sym_function,
sym_empty,
anon_sym_true,
anon_sym_false,
anon_sym_COMMA,
anon_sym_RPAREN,
[133] = 2,
ACTIONS(58), 2,
sym_integer,
anon_sym_LPAREN,
ACTIONS(56), 9,
sym_close,
sym_float,
sym_string,
sym_function,
sym_empty,
anon_sym_true,
anon_sym_false,
anon_sym_COMMA,
anon_sym_RPAREN,
[149] = 2,
ACTIONS(62), 2, ACTIONS(62), 2,
anon_sym_true,
anon_sym_false,
STATE(4), 2,
sym_boolean,
sym_list,
ACTIONS(7), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
[27] = 3,
ACTIONS(70), 1,
anon_sym_COMMA,
ACTIONS(68), 2,
sym_integer, sym_integer,
anon_sym_LPAREN, anon_sym_LPAREN,
ACTIONS(60), 9, ACTIONS(66), 7,
sym_close,
sym_float, sym_float,
sym_string, sym_string,
sym_function, sym_function,
sym_empty, sym_empty,
anon_sym_true, anon_sym_true,
anon_sym_false, anon_sym_false,
anon_sym_COMMA,
anon_sym_RPAREN, anon_sym_RPAREN,
[165] = 2, [44] = 2,
ACTIONS(64), 5, ACTIONS(72), 5,
ts_builtin_sym_end, ts_builtin_sym_end,
sym_float, sym_float,
sym_string, sym_string,
sym_function, sym_function,
sym_empty, sym_empty,
ACTIONS(66), 5, ACTIONS(74), 5,
sym_identifier, sym_identifier,
sym_integer, sym_integer,
anon_sym_true, anon_sym_true,
anon_sym_false, anon_sym_false,
anon_sym_LPAREN, anon_sym_LPAREN,
[180] = 3, [59] = 2,
ACTIONS(72), 1, ACTIONS(78), 4,
anon_sym_COMMA,
ACTIONS(70), 2,
sym_integer,
anon_sym_LPAREN,
ACTIONS(68), 7,
sym_float,
sym_string,
sym_function,
sym_empty,
anon_sym_true,
anon_sym_false,
anon_sym_RPAREN,
[197] = 2,
ACTIONS(74), 5,
ts_builtin_sym_end,
sym_float, sym_float,
sym_string, sym_string,
sym_function, sym_function,
@ -757,35 +727,11 @@ static const uint16_t ts_small_parse_table[] = {
anon_sym_true, anon_sym_true,
anon_sym_false, anon_sym_false,
anon_sym_LPAREN, anon_sym_LPAREN,
[212] = 2, [73] = 2,
ACTIONS(80), 4, ACTIONS(80), 2,
sym_float,
sym_string,
sym_function,
sym_empty,
ACTIONS(78), 5,
sym_identifier,
sym_integer,
anon_sym_true,
anon_sym_false,
anon_sym_LPAREN,
[226] = 2,
ACTIONS(84), 4,
sym_float,
sym_string,
sym_function,
sym_empty,
ACTIONS(82), 5,
sym_identifier,
sym_integer,
anon_sym_true,
anon_sym_false,
anon_sym_LPAREN,
[240] = 2,
ACTIONS(86), 2,
sym_integer, sym_integer,
anon_sym_LPAREN, anon_sym_LPAREN,
ACTIONS(50), 7, ACTIONS(60), 7,
sym_float, sym_float,
sym_string, sym_string,
sym_function, sym_function,
@ -793,92 +739,111 @@ static const uint16_t ts_small_parse_table[] = {
anon_sym_true, anon_sym_true,
anon_sym_false, anon_sym_false,
anon_sym_RPAREN, anon_sym_RPAREN,
[254] = 5, [87] = 3,
ACTIONS(88), 1, ACTIONS(82), 1,
sym_close, sym_close,
STATE(4), 1, STATE(7), 1,
sym_operator, sym_operator,
STATE(14), 1, ACTIONS(84), 3,
sym_assignment,
ACTIONS(90), 2,
anon_sym_PLUS, anon_sym_PLUS,
anon_sym_DASH, anon_sym_DASH,
ACTIONS(92), 3,
anon_sym_EQ, anon_sym_EQ,
anon_sym_PLUS_EQ, [99] = 3,
anon_sym_DASH_EQ, ACTIONS(82), 1,
[273] = 1, sym_close,
ACTIONS(94), 1, STATE(7), 1,
ts_builtin_sym_end, sym_operator,
[277] = 1, ACTIONS(84), 3,
anon_sym_PLUS,
anon_sym_DASH,
anon_sym_EQ,
[111] = 3,
ACTIONS(86), 1,
sym_close,
STATE(7), 1,
sym_operator,
ACTIONS(84), 3,
anon_sym_PLUS,
anon_sym_DASH,
anon_sym_EQ,
[123] = 3,
ACTIONS(86), 1,
sym_close,
STATE(7), 1,
sym_operator,
ACTIONS(84), 3,
anon_sym_PLUS,
anon_sym_DASH,
anon_sym_EQ,
[135] = 1,
ACTIONS(86), 1,
sym_close,
[139] = 1,
ACTIONS(88), 1, ACTIONS(88), 1,
sym_close, sym_close,
[143] = 1,
ACTIONS(90), 1,
ts_builtin_sym_end,
}; };
static const uint32_t ts_small_parse_table_map[] = { static const uint32_t ts_small_parse_table_map[] = {
[SMALL_STATE(4)] = 0, [SMALL_STATE(10)] = 0,
[SMALL_STATE(5)] = 30, [SMALL_STATE(11)] = 27,
[SMALL_STATE(6)] = 60, [SMALL_STATE(12)] = 44,
[SMALL_STATE(7)] = 90, [SMALL_STATE(13)] = 59,
[SMALL_STATE(8)] = 117, [SMALL_STATE(14)] = 73,
[SMALL_STATE(9)] = 133, [SMALL_STATE(15)] = 87,
[SMALL_STATE(10)] = 149, [SMALL_STATE(16)] = 99,
[SMALL_STATE(11)] = 165, [SMALL_STATE(17)] = 111,
[SMALL_STATE(12)] = 180, [SMALL_STATE(18)] = 123,
[SMALL_STATE(13)] = 197, [SMALL_STATE(19)] = 135,
[SMALL_STATE(14)] = 212, [SMALL_STATE(20)] = 139,
[SMALL_STATE(15)] = 226, [SMALL_STATE(21)] = 143,
[SMALL_STATE(16)] = 240,
[SMALL_STATE(17)] = 254,
[SMALL_STATE(18)] = 273,
[SMALL_STATE(19)] = 277,
}; };
static const TSParseActionEntry ts_parse_actions[] = { static const TSParseActionEntry ts_parse_actions[] = {
[0] = {.entry = {.count = 0, .reusable = false}}, [0] = {.entry = {.count = 0, .reusable = false}},
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
[3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 0), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 0),
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15),
[7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4),
[9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(8), [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4),
[11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5),
[13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(7), [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10),
[15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 1), [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2),
[17] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2), [17] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(15),
[19] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(17), [20] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(4),
[22] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(8), [23] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(4),
[25] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(8), [26] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(5),
[28] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(9), [29] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(10),
[31] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(7), [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 1),
[34] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_value, 1),
[36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), [36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_value, 1),
[38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8), [38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1),
[41] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8), [40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1),
[44] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(9), [42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3),
[47] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(7), [44] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3),
[50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), [46] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17),
[52] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_value, 1), [48] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(4),
[54] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_value, 1), [51] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(4),
[56] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), [54] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(5),
[58] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1), [57] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(10),
[60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2),
[62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3), [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5),
[64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 2), [64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6),
[66] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 2), [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1),
[68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1), [68] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1),
[70] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1), [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
[72] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 2),
[74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 3), [74] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 2),
[76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 3), [76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_operator, 1),
[78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_operator, 1), [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1),
[80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1), [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2),
[82] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 1), [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1),
[84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 1), [84] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
[86] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3),
[88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), [88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12),
[90] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), [90] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
[92] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
[94] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
}; };
#ifdef __cplusplus #ifdef __cplusplus